Pass Git SHA1 commit id for next build in Jenkins

Consider the flow of tasks: A - B - C

I can parameterize for assembly B with the same git commit SHA1 as A by adding the parameter “Pass-through git commit that was built” in A. However, this only works for subsequent tasks.

Now let's say that

A uses the project http://www.github.com/myuser/project_A

B uses the project http://www.github.com/myuser/project_B

C uses the project http://www.github.com/myuser/project_A

So what I want to do is build C with the same SHA1 as in A.

The only way I found is to pass SHA1 from A to B as a parameter with a different name

GIT_MY_PARAMETER=$GIT_COMMIT

Then pass the tis parameter from B to C

GIT_MY_PARAMETER =$GIT_MY_PARAMETER

Then in C, I configured git as follows:

Branches to build    Branch Specifier (blank for 'any')   ${GIT_MY_PARAMETER}

, , .

git?

+4

Source: https://habr.com/ru/post/1533219/


All Articles