Table of Contents | ||
---|---|---|
|
NOTE: Many CI jobs have moved to use GitHub Actions, and all new jobs should be added in Actions. For more info on GitHub Actions in Beam, see https://github.com/apache/beam/blob/master/.github/workflows/README.md
Highlights
The location ./test-infra/jenkins
contains the defined Jenkins jobs are defined in These jobs are written using the Job DSL using Apache Groovy. Job definitions should be a simple as possible and ideally identify a single Gradle target to execute.
...
- apache-maven:3.5.4
- Docker:1820.0910.423
- Go:1.16
- kubectl
- open-jdk-11
- open-jdk-1.8
- Pip:8.1.1
- Python:2.7.12
- Python:3.5.2
- Python:3.6.13
- Python:3.7.10
- Python:3.8.9
- Python:3.9.4
- Python:3.11.2
Virtualenv:16.4.3
How to install and upgrade software on Jenkins workers
...
- Go to the page for the Jenkins agent you want to update (for example) and click "Mark this node temporarily offline", leaving a reason such as "Updating X dependency."
- Wait until there are no more tests running in that agent (under "Build Executor Status" on the left of the page). You can also prioritize the update on agents currently not running any builds.
- Restart the VM with a new disk:
Code Block language bash OLD_IMAGE_DATE=2020072920231110 NEW_IMAGE_DATE=20211011YYYYMMDD PROJECT=apache-beam-testing ZONE=us-central1-b # Select the workers currently offline and not processing any builds, # that you want to upgrade. # For example: for CI_INSTANCE_NUMBER {1..4} {10..12} 16; do for CI_INSTANCE_NUMBER in {1..4}; do CI_INSTANCE=apache-ci-beam-jenkins-${CI_INSTANCE_NUMBER} gcloud compute instances stop $CI_INSTANCE --project $PROJECT --zone $ZONE gcloud compute instances detach-disk $CI_INSTANCE --project $PROJECT --zone $ZONE --disk ${CI_INSTANCE}-${OLD_IMAGE_DATE} gcloud compute disks create ${CI_INSTANCE}-${NEW_IMAGE_DATE} --project $PROJECT --zone $ZONE --image=jenkins-worker-boot-image-${NEW_IMAGE_DATE} gcloud compute instances attach-disk $CI_INSTANCE --project $PROJECT --zone $ZONE --disk ${CI_INSTANCE}-${NEW_IMAGE_DATE} --device-name=${CI_INSTANCE}-${NEW_IMAGE_DATE} --boot gcloud compute instances start ${CI_INSTANCE} --project $PROJECT --zone $ZONE done
You could also do these steps via Cloud Console instead of CLI:Stop the VM, then click edit.
Delete the existing boot disk by clicking the 'X'.
Create a new boot disk by using the newly generated image.
Name disk as
'apache-ci-beam-jenkins-[1,16]-YYYYMMDD'
.Make sure the boot disk 'Model' is 'Boot, read/write'.
Start the VM.
- Mark the node in Jenkins as online again and click "Launch agent" button if there is one.
- Verify that inventory job for this node did not start while the worker was offline, sample build for node #10: https://ci-beam.apache.org/job/beam_Inventory_apache-beam-jenkins-10. If there is a stuck execution of the inventory job, cancel it manually. TODO (BEAM-13666): we should cancel inventory stuck jobs automatically.
- (Optional) If this is the first agent being updated and you would like to test your changes by running a particular Jenkins job, do the following:
- Go to the page for the job you want to run (example).
- Click "Configure" on the left menu.
- Find the checkmark "Restrict where this project can be run" and change the restriction from "beam" to the specific name of the agent (ex. "apache-beam-jenkins-1").
- Save and apply that change.
- Back on the page for the job, click "Build with Parameters" on the left menu.
- Run the build on "master".
- Once you're done checking the results, change the restriction for the job back to "beam".
- Repeat for each worker. You can also do it in batches of workers, but avoid bringing all of the workers offline at once.
After confirming that update was successful, we can go to Cloud Console Disks and clean up deprecated Jenkins worker disks, or do this via cli:
Code Block language bash OLD_IMAGE_DATE=2020072920231110 PROJECT=apache-beam-testing ZONE=us-central1-b for CI_INSTANCE_NUMBER in {1..16}; do CI_INSTANCE=apache-ci-beam-jenkins-${CI_INSTANCE_NUMBER} gcloud compute disks delete ${CI_INSTANCE}-${OLD_IMAGE_DATE} --project $PROJECT --zone $ZONE --quiet done