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

chore: improve env var scopes and retrieve VERSION in build.ps1 #424

Merged
Merged
Show file tree
Hide file tree
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
24 changes: 12 additions & 12 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
def agentSelector(String imageType) {
// Image type running on a Linux agent
// Linux agent
if (imageType == 'linux') {
return 'linux'
}
// Image types running on a Windows Server Core 2022 agent
// Windows Server Core 2022 agent
if (imageType.contains('2022')) {
return 'windows-2022'
}
// Remaining image types running on a Windows Server Core 2019 agent: (nanoserver|windowservercore)-(1809|2019)
// Windows Server Core 2019 agent (for nanoserver 1809 & ltsc2019 and for windowservercore ltsc2019)
return 'windows-2019'
}

Expand All @@ -20,6 +20,9 @@ pipeline {

stages {
stage('docker-ssh-agent') {
environment {
DOCKERHUB_ORGANISATION = "${infra.isTrusted() ? 'jenkins' : 'jenkins4eval'}"
}
matrix {
axes {
axis {
Expand All @@ -35,9 +38,6 @@ pipeline {
options {
timeout(time: 60, unit: 'MINUTES')
}
environment {
DOCKERHUB_ORGANISATION = "${infra.isTrusted() ? 'jenkins' : 'jenkins4eval'}"
}
stages {
stage('Prepare Docker') {
when {
Expand Down Expand Up @@ -75,18 +75,18 @@ pipeline {
when {
buildingTag()
}
environment {
ON_TAG = 'true'
VERSION = "${env.TAG_NAME}"
}
steps {
script {
// This function is defined in the jenkins-infra/pipeline-library
infra.withDockerCredentials {
if (isUnix()) {
sh '''
export ON_TAG=true
export VERSION="${TAG_NAME}"
make publish
'''
sh 'make publish'
} else {
powershell '& ./build.ps1 -VersionTag $env:TAG_NAME publish'
powershell '& ./build.ps1 publish'
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ if(![String]::IsNullOrWhiteSpace($env:DOCKERHUB_ORGANISATION)) {
$Organisation = $env:DOCKERHUB_ORGANISATION
}

if(![String]::IsNullOrWhiteSpace($env:VERSION)) {
$VersionTag = $env:VERSION
}

if(![String]::IsNullOrWhiteSpace($env:IMAGE_TYPE)) {
$ImageType = $env:IMAGE_TYPE
}
Expand Down