Skip to content

Commit

Permalink
Few cleanups and references added
Browse files Browse the repository at this point in the history
  • Loading branch information
dawitnida committed Apr 4, 2019
1 parent 34081e4 commit 451235d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 36 deletions.
45 changes: 25 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ Check out the [official Packer documentation][packer-doc] for further reference.
### TODOs

- Documentations
- [ ] Getting started & usage
- [x] Getting started & usage
- [ ] Actions details
- Action for
- [x] Validate Action
- [ ] Inspect Action
- [ ] Build Action
- [ ] Directory set for all actions

## Getting started and usage
### Getting started and usage

To check this in action, please check [Packer actions demo project][packer-actions-demo] with a collection
of sample packer template files.

Variables

Expand All @@ -25,8 +28,8 @@ Variables
- `ACTION_COMMENT` : Enable/Disable PR comment from validate result

```
workflow "packer-validate-temp-x" {
resolves = "packer-validate-demo-1"
workflow "packer validate docker-image-template" {
resolves = "packer-validate-docker-image-template"
on = "pull_request"
}
Expand All @@ -35,26 +38,26 @@ action "filter-open-synced-pr" {
args = "action 'opened|synchronize'"
}
### For single template (eg. Dockers dir contains *.json template)
action "packer-validate-demo-1" {
# For single template (eg. dockers dir contains *.json template)
action "packer-validate-docker-image-template" {
uses = "dawitnida/packer-github-actions/validate@master"
needs = "filter-open-synced-pr"
secrets = [
"GITHUB_TOKEN",
]
env = {
TEMPLATE_FILE_NAME = "*.json"
PACKER_ACTION_WORKING_DIR = "Dockers"
PACKER_ACTION_WORKING_DIR = "dockers"
}
}
workflow "packer-validate-temp-y" {
resolves = "packer-validate-demo-2"
workflow "packer validate template-x with var-file" {
resolves = "packer-validate-template-x"
on = "pull_request"
}
### For specific template file (eg. sample-packer-template.json) with var-file arg
action "packer-validate-demo-2" {
# For specific template file (eg. packer-template-x.json) with var-file (global-vars.json) arg
action "packer-validate-template-x" {
uses = "dawitnida/packer-github-actions/validate@master"
needs = "filter-open-synced-pr"
secrets = [
Expand All @@ -64,32 +67,34 @@ action "packer-validate-demo-2" {
"-var-file=global-vars.json",
]
env = {
TEMPLATE_FILE_NAME = "demo-2.json"
TEMPLATE_FILE_NAME = "packer-template-x.json"
}
}
workflow "packer-validate-temp-z" {
resolves = "packer-validate-demo-3"
workflow "packer validate template-y without arg" {
resolves = "packer-validate-template-y"
on = "pull_request"
}
### For specific template file (eg. Dockers dir contains *.json template)
action "packer-validate-demo-3" {
# For specific template file (eg. packer-template-y.json) without any args
action "packer-validate-template-y" {
uses = "dawitnida/packer-github-actions/validate@master"
needs = "filter-open-synced-pr"
secrets = [
"GITHUB_TOKEN",
]
env = {
TEMPLATE_FILE_NAME = "demo-docker-template.json"
TEMPLATE_FILE_NAME = "packer-template-y.json"
}
}
```

**Figure 1.** *Packer validate complete check list diagram*
![checks-list-diagram](media/action-results.png)

## Author
### Author
[Dawit Nida](https://github.com/dawitnida)

[github-actions]: <https://github.com/features/actions>
[packer-doc]: <https://www.packer.io/docs/index.html>
[packer-actions-demo]: <https://github.com/dawitnida/packer-actions-demo>
[github-actions]: <https://github.com/features/actions>
[packer-doc]: <https://www.packer.io/docs/index.html>
36 changes: 20 additions & 16 deletions validate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ Check out the [packer validate command][packer-validate-doc] for further referen

## Usage

To check this in action, please check [Packer actions demo project][packer-actions-demo] with a collection
of sample packer template files.

Variables

- `PACKER_ACTION_WORKING_DIR` : Working directory
- `TEMPLATE_FILE_NAME` : Packer template file
- `ACTION_COMMENT` : Enable/Disable PR comment from validate result

```
workflow "packer-validate-temp-x" {
resolves = "packer-validate-demo-1"
workflow "packer validate docker-image-template" {
resolves = "packer-validate-docker-image-template"
on = "pull_request"
}
Expand All @@ -23,26 +26,26 @@ action "filter-open-synced-pr" {
args = "action 'opened|synchronize'"
}
### For single template (eg. Dockers dir contains *.json template)
action "packer-validate-demo-1" {
# For single template (eg. dockers dir contains *.json template)
action "packer-validate-docker-image-template" {
uses = "dawitnida/packer-github-actions/validate@master"
needs = "filter-open-synced-pr"
secrets = [
"GITHUB_TOKEN",
]
env = {
TEMPLATE_FILE_NAME = "*.json"
PACKER_ACTION_WORKING_DIR = "Dockers"
PACKER_ACTION_WORKING_DIR = "dockers"
}
}
workflow "packer-validate-temp-y" {
resolves = "packer-validate-demo-2"
workflow "packer validate template-x with var-file" {
resolves = "packer-validate-template-x"
on = "pull_request"
}
### For specific template file (eg. sample-packer-template.json) with var-file arg
action "packer-validate-demo-2" {
# For specific template file (eg. packer-template-x.json) with var-file (global-vars.json) arg
action "packer-validate-template-x" {
uses = "dawitnida/packer-github-actions/validate@master"
needs = "filter-open-synced-pr"
secrets = [
Expand All @@ -52,27 +55,28 @@ action "packer-validate-demo-2" {
"-var-file=global-vars.json",
]
env = {
TEMPLATE_FILE_NAME = "demo-2.json"
TEMPLATE_FILE_NAME = "packer-template-x.json"
}
}
workflow "packer-validate-temp-z" {
resolves = "packer-validate-demo-3"
workflow "packer validate template-y without arg" {
resolves = "packer-validate-template-y"
on = "pull_request"
}
### For specific template file (eg. Dockers dir contains *.json template)
action "packer-validate-demo-3" {
# For specific template file (eg. packer-template-y.json) without any args
action "packer-validate-template-y" {
uses = "dawitnida/packer-github-actions/validate@master"
needs = "filter-open-synced-pr"
secrets = [
"GITHUB_TOKEN",
]
env = {
TEMPLATE_FILE_NAME = "demo-docker-template.json"
TEMPLATE_FILE_NAME = "packer-template-y.json"
}
}
```

**Figure 1.** *Packer validate without args failed with a comment*
![failed-validation](../media/packer-template-y.png)

Expand All @@ -82,5 +86,5 @@ action "packer-validate-demo-3" {
**Figure 3.** *Packer validate complete check list diagram*
![checks-list-diagram](../media/action-results.png)


[packer-validate-doc]: <https://www.packer.io/docs/commands/validate.html>
[packer-actions-demo]: <https://github.com/dawitnida/packer-actions-demo>

0 comments on commit 451235d

Please sign in to comment.