adding detailed-exitcode
- Dominant language
- Go
- Stars
- 15.8k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Please search the existing issues for relevant feature requests, and use the
reaction feature
(https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
to add upvotes to pre-existing requests.
#### Community Note
Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.
#### Description
It would be nice addition to add additional parameter with detailed exit code, something like: `-detailed-exitcode`
This will be returning standard 0-1 codes but also additional which will be showing case when packer run partially or when it was not able to make build because for example AWS AMI with such name already existing.
#### Use Case(s)
I am using packer plugin github.com/ethanmdavidson/git which helps me manage version of builds. I want to cover most of CI/CD process natively in packer. So now I am using following versioning code:
```hcl
locals {
truncated_sha = substr(data.git-commit.cwd-head.hash, 0, 8)
version = data.git-repository.cwd.head == "master" && data.git-repository.cwd.is_clean ? var.version : "${var.version}-${local.truncated_sha}"
}
data "git-repository" "cwd" {}
data "git-commit" "cwd-head" {}
```
Currently when AMI was already build using amazon-ebs I get error:
```
........
==> jenkins.amazon-ebs.jenkins: Error: AMI Name: 'jenkins-1.0.0-62269622' is used by an existing AMI: ami-07025404d34e95d3e
Build 'jenkins.amazon-ebs.jenkins' errored after 3 seconds 514 milliseconds: Error: AMI Name: 'jenkins-1.0.0-62269622' is used by an existing AMI: ami-07025404d34e95d3e
==> Wait completed after 3 seconds 514 milliseconds
==> Some builds didn't complete successfully and had errors:
--> jenkins.amazon-ebs.jenkins: Error: AMI Name: 'jenkins-1.0.0-62269622' is used by an existing AMI: ami-07025404d34e95d3e
```
it would be nice to be able recognise using exit code that build was not done because arleady existing or in case of multiple AMIs build that was completed partially
#### Potential configuration
0 = Succeeded with all build jobs
1 = Error with all builds
2 = Succeeded partially
3 = Builds were not proceeded because they already existing
#### Potential References
https://www.terraform.io/cli/commands/plan#detailed-exitcode
Contributor guide
Assessment
This issue has not been assessed yet.