Skip to content

Instantly share code, notes, and snippets.

@klolivei
Created May 26, 2020 17:54
Show Gist options
  • Save klolivei/8a6db9c9d9af6b6ed74fab4a23aa08c4 to your computer and use it in GitHub Desktop.
Save klolivei/8a6db9c9d9af6b6ed74fab4a23aa08c4 to your computer and use it in GitHub Desktop.
JenkinsFile
def label = 'ci-runner'
def npmToken = <PROJECT_NPM_TOKEN>
podTemplate(
label: label,
containers: [
containerTemplate(
name: 'jnlp',
image: <YOUR_IMAGE>,
workingDir: '/home/jenkins',
resourceRequestCpu: '500m',
resourceLimitCpu: '4000m',
resourceRequestMemory: '4Gi',
resourceLimitMemory: '8Gi',
envVars: [
envVar(key: 'NPM_TOKEN', value: npmToken)
]
)
],
volumes: [
hostPathVolume(hostPath: '/usr/bin/docker', mountPath: '/usr/bin/docker'),
hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock')
]
) {
node(label) {
def myRepo = checkout scm
sh('git config user.name <YOUR_USERNAME>)
sh('git config user.email <YOUR_EMAIL>)
stage('merge with develop) {
sh('git merge origin/master --no-commit')
}
stage('install') {
sh('yarn install --non-interactive --pure-lockfile')
}
stage('test') {
sh('yarn test')
sh('yarn build')
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment