Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor agent definition per build #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 24 additions & 76 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pipeline {
agent any

options {
skipDefaultCheckout()
buildDiscarder(logRotator(numToKeepStr: '5'))
timeout(time: 90, unit: 'MINUTES')
}
Expand All @@ -19,55 +20,33 @@ pipeline {
}

stages {
stage('Checkout Workspace') {
steps {
checkout scm
stash(name: 'workspace', includes: '**')
}
}
stage('Run Builds') {
parallel {
stage('nginx') {
agent {
kubernetes {
yaml loadOverridableResource(
libraryResource: 'org/eclipsefdn/container/agent.yml'
)
}
}
steps {
buildImage('nginx', 'stable-alpine', 'nginx/stable-alpine', [:], true)
buildImage('nginx', 'stable-alpine-for-staging', 'nginx/stable-alpine-for-staging')
}
}

stage('planet-venus') {
agent {
kubernetes {
yaml loadOverridableResource(
libraryResource: 'org/eclipsefdn/container/agent.yml'
)
}
}
steps {
buildImage('planet-venus', 'debian-10-slim', 'planet-venus', [:], true)
}
}
stage('kubectl') {
agent {
kubernetes {
yaml loadOverridableResource(
libraryResource: 'org/eclipsefdn/container/agent.yml'
)
}
}
steps {
buildImage('kubectl', 'okd-c1', 'kubectl/okd-c1', [:], true)
}
}

stage('hugo-node') {
agent {
kubernetes {
yaml loadOverridableResource(
libraryResource: 'org/eclipsefdn/container/agent.yml'
)
}
}
steps {
buildImage('hugo-node', 'h0.76.5-n12.22.1', 'hugo-node', ['HUGO_VERSION':'0.76.5', 'HUGO_FILENAME':'hugo_0.76.5_Linux-64bit.deb','NODE_VERSION': 'v12.22.1'], true)
buildImage('hugo-node', 'h0.99.1-n16.15.0', 'hugo-node', ['HUGO_VERSION':'0.99.1', 'HUGO_FILENAME':'hugo_0.99.1_Linux-64bit.deb','NODE_VERSION': 'v16.15.0'])
Expand All @@ -77,27 +56,13 @@ pipeline {
}

stage('drupal-node') {
agent {
kubernetes {
yaml loadOverridableResource(
libraryResource: 'org/eclipsefdn/container/agent.yml'
)
}
}
steps {
buildImage('drupal-node', 'd9.5.10-n18.18.2', 'drupal-node', ['DRUPAL_VERSION':'9.5.10', 'NODE_VERSION': 'v18.18.2'], true)
buildImage('drupal-node', 'd10.2.2-n18.19.1', 'drupal-node', ['DRUPAL_VERSION':'10.2.2', 'NODE_VERSION': 'v18.19.1'])
}
}

stage('stack-build-agent') {
agent {
kubernetes {
yaml loadOverridableResource(
libraryResource: 'org/eclipsefdn/container/agent.yml'
)
}
}
steps {
buildImage('stack-build-agent', 'h79.1-n12.22.1-jdk11', 'stack-build-agent/h79.1-n12.22.1-jdk11', [:], true)
buildImage('stack-build-agent', 'h111.3-n18.19-jdk17', 'stack-build-agent', ['JDK_VERSION':'17'])
Expand All @@ -107,40 +72,19 @@ pipeline {
}

stage('java-api-base') {
agent {
kubernetes {
yaml loadOverridableResource(
libraryResource: 'org/eclipsefdn/container/agent.yml'
)
}
}
steps {
buildImage('java-api-base', 'j11-openjdk', 'java-api-base', ['JDK_VERSION':'11:1.17'], true)
buildImage('java-api-base', 'j17-openjdk', 'java-api-base', ['JDK_VERSION':'17:1.17'])
}
}

stage('native-build-agent') {
agent {
kubernetes {
yaml loadOverridableResource(
libraryResource: 'org/eclipsefdn/container/agent.yml'
)
}
}
steps {
buildImage('native-build-agent', 'm23-n18.20.2', 'native-build-agent', [:], true)
}
}

stage('containertools') {
agent {
kubernetes {
yaml loadOverridableResource(
libraryResource: 'org/eclipsefdn/container/agent.yml'
)
}
}
steps {
buildImage('containertools', 'alpine-latest', 'containertools', [:], true)
}
Expand Down Expand Up @@ -169,18 +113,22 @@ def buildImage(String name, String version, String context, Map<String, String>
* Dockerfile ${context}/Dockerfile
* Latest ${latest}
"""

container('containertools') {
containerBuild(
credentialsId: env.CREDENTIALS_ID,
name: env.NAMESPACE + '/' + name,
version: version,
dockerfile: context + '/Dockerfile',
context: context,
buildArgs: containerBuildArgs,
push: env.GIT_BRANCH == 'master',
latest: latest,
debug: false
)
podTemplate(yaml: loadOverridableResource(libraryResource: 'org/eclipsefdn/container/agent.yml')) {
node(POD_LABEL) {
container('containertools') {
unstash('workspace')
containerBuild(
credentialsId: env.CREDENTIALS_ID,
name: env.NAMESPACE + '/' + name,
version: version,
dockerfile: context + '/Dockerfile',
context: context,
buildArgs: containerBuildArgs,
push: env.GIT_BRANCH == 'master',
latest: latest,
debug: false
)
}
}
}
}