/
Jenkins Shared Library

Jenkins Shared Library

What is jenkins shared library?

Shared library location

Updating shared libraries

  • When updating shared libraries, its not recommended to directly update the changes in the branch

  • This has a large blast radius and can cause all the jenkins jobs to stop working, including adopter jenkins machines

  • As a good practice, a new branch should be created and changes should be tested from this new branch

  • The new branch can be configured on jenkins for a few days to ensure that the changes are working as expected and do not break any flows

  • Once verified, the changes should be merged back to the shared-lib branch so that the community can also get the benefit of these changes

Shared Library Code Reference

List of Shared Library Code

  • All the shared library codes are located here - https://github.com/project-sunbird/sunbird-devops/tree/shared-lib/vars

  • ansible_playbook_run.groovy

    • Clone private repo, copies the inventory to appropriate locations, runs the ansible playbook

  • artifact_download.groovy

    • Downloads provided artifact from cloud storage

  • auto_build_deploy.groovy

    • Used in staging automated deployments to automatically trigger the artifact upload and deploy jobs

  • auto_build_deploy_player.groovy

    • Used in staging automated deployment of Player job to automatically trigger the artifact upload and deploy jobs

  • copy_file_to_wksp.groovy

    • Allows a user to upload a file from Jenkinsjob and copy to workspace

  • deployed_versions.groovy

    • Gives the list of jobs deployed in a release along with the tags (This job needs some enhancement. Currently the data returned is partially correct)

  • docker_params.groovy

    • Used in container workload jenkins job to return information about few parameters to the caller

  • email_notify.groovy

    • Used to send email notifications on the job status

  • lp_dp_params.groovy

    • Used in non-container workload jenkins job to return information about few parameters to the caller

  • pre_checks.groovy

    • Used in automated deployment jenkinsfiles to ensure the tag is an allowed tag for staging environment and the deployment is triggered in the allowed window / slots (start and end time)

  • slack_notify.groovy

    • Used to send slack notifications on the job status

  • stagingRC.groovy

    • Used in staging tag creation jenkinsfile to ensure the tag is an allowed tag for staging environment and the deployment is triggered in the allowed window / slots (start and end time)

  • summary.groovy

    • Used to write the deployed jobs information in a file so that its easy to retrieve the list of deployed jobs in a particular release (this job can be enhanced to provide the data in an enhanced way so that it can be consumed without additional parsing)

Related content

Storage Account life cycle policy enablement
Storage Account life cycle policy enablement
Read with this
Jenkins scripts, Jenkins variable and Jenkins parameters details
Jenkins scripts, Jenkins variable and Jenkins parameters details
More like this
Understanding Jenkins scripts, jobs, jobs parameters and variables
Understanding Jenkins scripts, jobs, jobs parameters and variables
More like this
Jenkins Configuration as code
Jenkins Configuration as code
More like this
ArtifactUpload Jobs
ArtifactUpload Jobs
More like this
Sunbird - Ansible variables
Sunbird - Ansible variables
More like this