Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose artefact revision to Build Commands #4

Open
jinty opened this issue Aug 14, 2015 · 5 comments
Open

Expose artefact revision to Build Commands #4

jinty opened this issue Aug 14, 2015 · 5 comments

Comments

@jinty
Copy link

jinty commented Aug 14, 2015

Hi,

I've just started using CodePipeline with Github as source and Jenkins to build. However I find it impossible to get the git commit id from within the jenkins builder. I have a few uses for this:

  • Create a git tag for every successful live deployment
  • Generate a changelog from GIT between last successful live deployment and the current one so that support knows when a specific fix was installed and can communicate that to clients
  • Generate a unique version number for the current deployment. i.e 2.66.post55 (55 commits after version 2.66)

It would be great if I could access in the job, as an environment variable, the git commit id (or revision as it is called here: http://docs.aws.amazon.com/codepipeline/latest/APIReference/API_Artifact.html)

@jinty jinty changed the title Expose JobId to Build Commands Expose artefact revision to Build Commands Aug 14, 2015
@biagic
Copy link
Contributor

biagic commented Aug 14, 2015

Hi Brian,

Thank you for the feedback. We are working this (the Revision of an Artifact from a GitHub source action will be the git commit id), and we'll update this issue when it's ready.

@fabiosantoscode
Copy link

I'm affected as well. Our healthcheck used to contain the current commit hash and message, now it doesn't :(

@rangaataws
Copy link

Thank you for the feedback. The revisionId (Git SHA of GitHub or CodeCommit) is now returned in Artifact instance for all input artifacts in JobData of the Build or Deployment action. If your source action is of type Amazon S3, the revisionId is going to be Amazon S3 object VersionId.
http://docs.aws.amazon.com/codepipeline/latest/APIReference/API_Artifact.html
http://docs.aws.amazon.com/codepipeline/latest/APIReference/API_JobData.html

Thanks,

@biagic
Copy link
Contributor

biagic commented Sep 6, 2016

Now that PollForJobs and GetJobDetails return the revisionId (jobDetails.data.inputArtifacts[].revisionId), the plugin should expose them as environment variables, so they can be used when the job executes. For example:

# Input artifact names
CODE_PIPELINE_INPUT_ARTIFACTS=(InputOne InputTwo)
# Revision IDs
CODE_PIPELINE_REVISION_ID_InputOne=f018e28d56a5dae955b75eb1ea238304a6829f33
CODE_PIPELINE_REVISION_ID_InputTwo=8b1dfbce24c311df06c2c1b921de75e2db236338

For jobs with a single input artifact (most common use case), it might be convenient to use a fixed variable name:

CODE_PIPELINE_REVISION_ID=f018e28d56a5dae955b75eb1ea238304a6829f33

@ghost
Copy link

ghost commented Aug 21, 2017

Hi,
Any chance to get Commit_ID inside Jenkins job? Looks like it is still not implemented...

egoramazon added a commit that referenced this issue Oct 31, 2023
Refresh plugin for October 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants