• Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • None

      This addon currently allows for:

      `GIT_URL` as well as `GIT_URL_n` if there is more than one repo used in a build

      It also provides the var `GIT_COMMIT`  however, if you have more than one repo it does not provide access to `GIT_COMMIT_n`

          [JENKINS-45859] Environment Var GIT_COMMIT_n

          Mark Waite added a comment -

          Can you clarify the context where you're envisioning using multiple repositories?

          For example, if you're using multiple repositories in a FreeStyle job, then this enhancement is needed.

          If you're using multiple repositories in a scripted pipeline job, this enhancement is not likely to be needed, since JENKINS-26100 provides the value of the SHA1 checkout for each call to the checkout command (along with many other values related to the checkout).

          Mark Waite added a comment - Can you clarify the context where you're envisioning using multiple repositories? For example, if you're using multiple repositories in a FreeStyle job, then this enhancement is needed. If you're using multiple repositories in a scripted pipeline job, this enhancement is not likely to be needed, since JENKINS-26100 provides the value of the SHA1 checkout for each call to the checkout command (along with many other values related to the checkout).

          James Lord added a comment -

          It is a FreeStyle job, we have a embedded chip platform in which we need to cross compile a board support package inside a docker container.  To do this we clone a fork of a community repo along with a few private repos containing some of our proprietary tooling.

          Since this step is one of many, I would like to create an artifact listing each commit of each repo that was used in the build with the idea that this artifact will contain a full manifest of all resources (repos/commits, upstream artifacts along with the repos/commits used to build them) used in each build along the entire pipeline.

          Currently we have get all this info from the log files and I have been tasked with finding a way to automate the process.  One solution would be to recursively go through the entire folder structure of each build via a bash script, however using environment vars from Jenkins would make it a whole lot easier.

          James Lord added a comment - It is a FreeStyle job, we have a embedded chip platform in which we need to cross compile a board support package inside a docker container.  To do this we clone a fork of a community repo along with a few private repos containing some of our proprietary tooling. Since this step is one of many, I would like to create an artifact listing each commit of each repo that was used in the build with the idea that this artifact will contain a full manifest of all resources (repos/commits, upstream artifacts along with the repos/commits used to build them) used in each build along the entire pipeline. Currently we have get all this info from the log files and I have been tasked with finding a way to automate the process.  One solution would be to recursively go through the entire folder structure of each build via a bash script, however using environment vars from Jenkins would make it a whole lot easier.

          Pavel Roskin added a comment -

          I think it would be much better to specify a prefix or postfix for environment variables rather than use numbers that need to be guessed and that can change if more checkouts are added or removed (e.g. when converting from Jenkinsfile in the same repository to Jenkinsfile from a separate repository).

          So if I specify prefix as "ACTUAL_SOURCE_" for a specific checkout then I'll be able to use ACTUAL_SOURCE_GIT_COMMIT for the commit that was checked out with those settings. The setting should be accessible from declarative pipelines without using the "script" block.

          Pavel Roskin added a comment - I think it would be much better to specify a prefix or postfix for environment variables rather than use numbers that need to be guessed and that can change if more checkouts are added or removed (e.g. when converting from Jenkinsfile in the same repository to Jenkinsfile from a separate repository). So if I specify prefix as "ACTUAL_SOURCE_" for a specific checkout then I'll be able to use ACTUAL_SOURCE_GIT_COMMIT for the commit that was checked out with those settings. The setting should be accessible from declarative pipelines without using the "script" block.

            Unassigned Unassigned
            caffeineaddiction James Lord
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: