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

feat: add logic to overwrite defaultsJson's build_branch and pipeline_branch and add helper_ref #423

Merged
merged 16 commits into from
Nov 14, 2022

Conversation

zdtsw
Copy link
Contributor

@zdtsw zdtsw commented Sep 30, 2022

Fix #417
Fix #419

In order to use this overwrite feature, must set USE_ADOPT_SHELL_SCRIPTS to false for the downstream job,
or trigger from pipeline to uncheck useAdoptBashScripts

test: https://ci.adoptopenjdk.net/job/build-scripts-pr-tester/job/build-test/job/jobs/job/jdk17u/job/jdk17u-linux-x64-temurin/
Screenshot from 2022-10-05 13-26-38

Update:

This can be achieved by two ways:

  • trigger build from openjdkX-pipeline ( main case, when official release)
    set
    buildReference  
    ciReference 
    helperReference
   untick `useAdoptBashScripts`
  • trigger build from downstream job e.g jdk11u-alpine-linux-x64-temurin (minor case, but we need to support it)
    modify BUILD_CONFIGURATION 's default values:
    "BUILD_REF": "",
    "CI_REF": "",
    "HELPER_REF": "",
    "USE_ADOPT_SHELL_SCRIPTS": true,

this PR has below main changes:

  1. in order to keep most of the logic of reading config from job (e.g jdk11u-alpine-linux-x64-temurin's paramter) the biggest change is to override variable DEFAULTS_JSON within in the build steps in openjdk_build_pipeline.groovy buildScripts()
DEFAULTS_JSON['repository']['build_branch'] = buildConfig.BUILD_REF ?: DEFAULTS_JSON['repository']['build_branch']
DEFAULTS_JSON['repository']['pipeline_branch'] = buildConfig.CI_REF ?: DEFAULTS_JSON['repository']['pipeline_branch']
DEFAULTS_JSON['repository']['helper_ref'] = buildConfig.HELPER_REF ?: DEFAULTS_JSON['repository']['helper_ref']

after this, everywhere uses DEFAULTS_JSON to get build_branch, pipeline_branch and helper_ref has been modified if they are set to a real value in the BUILD_CONFIGURATION
So, do a context.println JsonOutput.toJson(DEFAULTS_JSON) to see the real values we are using in the build.

  1. replace openjdk-jenkins-helper@master which is used to do checkout of jenkins-helper repo to openjdk-jenkins-helper@${helperRef} which can use a variable (read out from DEFAULTS_JSON['repository']['helper_ref']) to point to either a branch or a tag if it has been updated from (1), or by buildConfig.HELPER_REF ?: DEFAULTS_JSON['repository']['helper_ref']

  2. similar to (2), {DEFAULTS_JSON['repository']['build_branch']} is replaced to configuration.buildRef ?: DEFAULTS_JSON['repository']['build_branch']

  3. TODO in src/test/groovy: need to enable test once the code is in master, or the GH action will fail·

  4. fix lint: space, quotes ,minus(), length of line etc

P.S
for part in the pr-test's kick_off_tester, only set helperRef = DEFAULTS_JSON['repository']['helper_ref'] (i.e read from defaults.json because no intervention from parameter is used when pr-test triggered by GH action)
same reason for build_job_generator and build_pipeline_generator

@github-actions
Copy link

Thank you for creating a pull request!

Please check out the information below if you have not made a pull request here before (or if you need a reminder how things work).

Code Quality and Contributing Guidelines

If you have not done so already, please familiarise yourself with our Contributing Guidelines and Code Of Conduct, even if you have contributed before.

Tests

Github actions will run a set of jobs against your PR that will lint and unit test your changes. Keep an eye out for the results from these on the latest commit you submitted. For more information, please see our testing documentation.

In order to run the advanced pipeline tests (executing a set of mock pipelines), it requires an admin to post run tests on this PR.
If you are not an admin, please ask for one's attention in #infrastructure on Slack or ping one here.
To run full set of tests, use "run tests"; a subset of tests on specific jdk version, use "run tests quick 11,18"

@github-actions github-actions bot added generation Issues that provide enhancements or fixes to the job generators jenkins-pipeline labels Sep 30, 2022
@zdtsw zdtsw force-pushed the issue/3103_2 branch 3 times, most recently from a03f4f5 to 34e847a Compare October 3, 2022 11:21
@zdtsw
Copy link
Contributor Author

zdtsw commented Oct 4, 2022

run tests quick 19

@eclipse-temurin-bot
Copy link
Collaborator

 PR TESTER RESULT 

❎ Some pipelines failed or the job was aborted! ❎
See the pipeline-build-check below for more information...

@zdtsw
Copy link
Contributor Author

zdtsw commented Oct 4, 2022

run tests quick 19

re-run https://ci.adoptopenjdk.net/job/build-scripts-pr-tester/job/build-test/job/jobs/job/jdk19/job/jdk19-alpine-linux-x64-temurin/60/console, due to previous docker build container failure

Passed

@eclipse-temurin-bot
Copy link
Collaborator

 PR TESTER RESULT 

❎ Some pipelines failed or the job was aborted! ❎
See the pipeline-build-check below for more information...

@github-actions github-actions bot added code-tools Issues that are miscellaneous enhancements or bugs with our utilities that assist our build scripts documentation testing ghActions and removed ghActions labels Oct 4, 2022
@zdtsw zdtsw changed the title feat: add logic to overwrite defaultsJson's build_branch and pipeline_branch feat: add logic to overwrite defaultsJson's build_branch and pipeline_branch and add helper_ref Oct 5, 2022
@zdtsw
Copy link
Contributor Author

zdtsw commented Oct 5, 2022

run tests quick 17

@eclipse-temurin-bot
Copy link
Collaborator

 PR TESTER RESULT 

✅ All pipelines passed! ✅

@github-actions github-actions bot added code-tools Issues that are miscellaneous enhancements or bugs with our utilities that assist our build scripts ghActions and removed ghActions code-tools Issues that are miscellaneous enhancements or bugs with our utilities that assist our build scripts labels Nov 14, 2022
@zdtsw
Copy link
Contributor Author

zdtsw commented Nov 14, 2022

add more into description as "Updates" for what this PR does

pipelines/build/common/create_job_from_template.groovy Outdated Show resolved Hide resolved
docs/UsingOurScripts.md Outdated Show resolved Hide resolved
@github-actions github-actions bot added code-tools Issues that are miscellaneous enhancements or bugs with our utilities that assist our build scripts ghActions and removed ghActions code-tools Issues that are miscellaneous enhancements or bugs with our utilities that assist our build scripts labels Nov 14, 2022
@zdtsw zdtsw merged commit eb6797c into adoptium:master Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpine-linux code-tools Issues that are miscellaneous enhancements or bugs with our utilities that assist our build scripts documentation generation Issues that provide enhancements or fixes to the job generators ghActions jenkins-pipeline linux testing x64 Issues that affect or relate to the x64/x32 LINUX OS
Projects
None yet
4 participants