Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jpdavis-prof committed Oct 24, 2024
1 parent 8938704 commit 2153c6e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
25 changes: 13 additions & 12 deletions Jenkinsfile.github
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ pipeline {
NAME = getRepoName()
GO_VERSION = sh(returnStdout: true, script: 'grep -Eo "^go .*" go.mod | cut -d " " -f2').trim()
VERSION = sh(returnStdout: true, script: "git describe --tags | tr -s '-' '~' | tr -d '^v'").trim()
PRIMARY_NODE = "${env.NODE_NAME}"
}

stages {
Expand All @@ -58,6 +57,8 @@ pipeline {

environment {
DOCKER_ARCH = sh(returnStdout: true, script: "[ ${ARCH} == 'x86_64' ] && echo -n 'amd64' || echo -n 'arm64'")
JENKINS_AGENT = sh(returnStdout: true, script: "[ ${ARCH} == 'x86_64' ] && echo -n 'metal-gcp-builder' || echo -n 'metal-gcp-builder-arm64'")
DOCKER_GO_IMAGE = "${goImage}:${GO_VERSION}-SLES15.5"
BUILD_DIR = "${env.WORKSPACE}/dist/rpmbuild/${ARCH}"
}

Expand All @@ -71,21 +72,21 @@ pipeline {
stages {

stage('Build: setup') {
agent {
label "${env.JENKINS_AGENT}"
}
steps {
lock('docker-image-pull') {
sh "docker pull --platform linux/${DOCKER_ARCH} ${goImage}:${GO_VERSION}-SLES15.5"
sh "docker tag ${goImage}:${GO_VERSION}-SLES15.5 ${goImage}:${DOCKER_ARCH}"
}
sh "docker pull ${goImage}:${GO_VERSION}-SLES15.5"
}
}

stage('Prepare: RPMs') {
agent {
docker {
label "${PRIMARY_NODE}"
label "${JENKINS_AGENT}"
reuseNode true
args "-v /home/jenkins/.ssh:/home/jenkins/.ssh --platform linux/${DOCKER_ARCH}"
image "${goImage}:${DOCKER_ARCH}"
args "-v /home/jenkins/.ssh:/home/jenkins/.ssh"
image "${DOCKER_GO_IMAGE}"
}
}
steps {
Expand All @@ -98,10 +99,10 @@ pipeline {
stage('Build: RPMs') {
agent {
docker {
label "${PRIMARY_NODE}"
label "${JENKINS_AGENT}"
reuseNode true
args "-v /home/jenkins/.ssh:/home/jenkins/.ssh --platform linux/${DOCKER_ARCH}"
image "${goImage}:${DOCKER_ARCH}"
image "${DOCKER_GO_IMAGE}"
}
}
steps {
Expand All @@ -112,10 +113,10 @@ pipeline {
stage('Publish: RPMs') {
agent {
docker {
label "${PRIMARY_NODE}"
label "${JENKINS_AGENT}"
reuseNode true
args "-v /home/jenkins/.ssh:/home/jenkins/.ssh --platform linux/${DOCKER_ARCH}"
image "${goImage}:${DOCKER_ARCH}"
image "${DOCKER_GO_IMAGE}"
}
}
steps {
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ else
exe=
endif

# Use a separate GOCACHE for each OS/ARCH combination.
ifeq ($(GOCACHE),)
GOCACHE=/tmp/$(NAME)-$(GOOS)-$(GOARCH).cache
export GOCACHE
endif

go_path := PATH="$(go_bin_dir):$(PATH)"

goenv = $(shell PATH="$(go_bin_dir):$(PATH)" go env $1)
Expand Down

0 comments on commit 2153c6e

Please sign in to comment.