Getting a dependency build parameter without triggering a new build?
Example:
I have job1 and job2.
Job1 computes a value and saves it to a build parameter. e.g. build_param=value
Job2 uses that param as part of it's build.
My workflow requires that job2 does not have to immediately follow job1
But I would like to be able to access the most recent value of build_param from job1 whenever I trigger job2.
At the moment, the only way I found to get the build_param value is to make job1 a dependency. But then this results in job1 getting triggered whenever I run job2.
I don't want job2 to trigger job1 at all, but I do want it to be able to use the latest build_param value created from the last successful job1 build
I've tried various configurations of the ‘dont run if suitable build’ toggles but job1 still gets executed whenever I run job2
Are there some setup steps I'm missing?
on TeamCity Enterprise 2022.10.3 (build 117072)
Please sign in to leave a comment.
Have you also checked the "Only use successful builds from suitable ones"?
A new triggered build will only use successfully finished suitable builds (https://www.jetbrains.com/help/teamcity/snapshot-dependencies.html#Suitable+Builds) as dependencies. If the latest finished suitable build fails, it will be rerun.
Dependent builds can access predefined and custom parameters of the previous chain builds as `dep.<bcID>.<parameter_name>`, where `bcID` is the ID of a source build configuration whose parameter value you need to access.
Another workaround, you also can save the value to the shared place, and gain it from job with your customized way.
If it is not a password type value, you also can get it with TeamCity Rest API - https://www.jetbrains.com/help/teamcity/rest/manage-build-configuration-details.html#Get+Specific+Build+Configurations.
Best Regards,
Tom