Skip to content

Latest commit

 

History

History
64 lines (49 loc) · 1.25 KB

box-deploy.md

File metadata and controls

64 lines (49 loc) · 1.25 KB

BoxDeploy

All properties and methods from BoxCommon are valid in addition to the properties and methods documented here.

Methods

writeImageTags(Map)

Writes image tags from build-versions to specified file

Parameters:

  • format: either env or yaml. If not specified, will attempt to detect from outFile extension
  • outFile: file path to write
  • yamlPath: list of parent keys to prepend to generated yaml

withCredentials()

Adds the deployTarget credentials

Example

jenkins.yaml:

common:
  images:
    - test/a
    - test/b
deploy:
  imageOverrides:
    - path: test/b
      event: commit/develop
      eventFallback: commit/master

Jenkinsfile:

@Library('jenkins-shared-library@master')
import com.boxboat.jenkins.pipeline.deploy.*

def deployments = ["", "dev", "stage", "prod"]
properties([
  parameters([
    choice(name: 'deploymentKey', choices: deployments, description: 'Deployment', defaultValue: '')
  ])
])

def deploy = new BoxDeploy()

node() {
  deploy.wrap {
    stage('Deploy'){
      deploy.writeImageTags(
        outFile: "image-tags.yaml",
        yamlPath: ["global"],
      )
      deploy.withCredentials() {
        sh "helm upgrade --install test ."
      }
    }
  }
}