Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Library functions for use in GOV.UK Pay's Jenkinsfiles

License

Notifications You must be signed in to change notification settings

alphagov/pay-jenkins-library

Repository files navigation

What

As of March 2022 this repository is no longer maintained by the GOV.UK Pay team. We no longer use Jenkins.

pay-jenkins-library is a Jenkins library helper, intended to be used with GOV.UK Pay Jenkins.

This library gets automatically loaded and made available via Jenkins global libraries.

If you want to have Jenkinsfile pull in a branch of this repo, add the below to your Jenkinsfile.

libraries {
  lib("pay-jenkins-library@master")
}

Functions this Jenkins global library

Git tag

  • Tags the current git repo with the provided tag
  • Pushes the tag to the remote repository
  • Optional second argument for an annotation
    gitTag(tag, annotation)

Build app

  • Builds a docker container, tags and pushes to a registry Only 'app' is required, the rest default to the below
buildAppWithMetrics {
  app = 'foo'
  registry = 'docker.io'
  docker_repo = 'govukpay'
  push = true
}

NOTE: If app is frontend or selfservice, it also builds the test docker container, runs the tests and compiles static assets, prior to the standard behaviour

Run end to end test

  • Runs specified e2e tests, pulling docker tag of specific app
runAppE2E('app-name', 'card,products')

Get current HEAD of branch i.e. GIT_COMMIT

gitCommit()

Deploy a microservice to an environment

  • Deploys a microservice to an environment by triggering the deploy job passing in params. tag is optional, defaults to 'latest-master' tagAfterDeployment is optional, defaults to false run_tests, is optional, defaults to true smoke_tags, is optional, defaults to empty string promoted_env, is optional, defaults to true
deployEcs('microservice', 'aws_account', tag, 'tagAfterDeployment', 'run_tests', 'smoke_tags', 'promoted_env')

Example microservice build pipeline

microservice build pipeline

Licence

MIT License

Vulnerability Disclosure

GOV.UK Pay aims to stay secure for everyone. If you are a security researcher and have discovered a security vulnerability in this code, we appreciate your help in disclosing it to us in a responsible manner. Please refer to our vulnerability disclosure policy and our security.txt file for details.

About

Library functions for use in GOV.UK Pay's Jenkinsfiles

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages