-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ART-10563 Create build-microshift-bootc job (#4270)
- Loading branch information
Showing
2 changed files
with
137 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
node() { | ||
wrap([$class: "BuildUser"]) { | ||
// gomod created files have filemode 444. It will lead to a permission denied error in the next build. | ||
sh "chmod u+w -R ." | ||
checkout scm | ||
def buildlib = load("pipeline-scripts/buildlib.groovy") | ||
def commonlib = buildlib.commonlib | ||
|
||
commonlib.describeJob("build-microshift-bootc", """ | ||
<h2>Build and release microshift-bootc image for an assembly.</h2> | ||
""") | ||
|
||
properties( | ||
[ | ||
disableResume(), | ||
buildDiscarder( | ||
logRotator( | ||
artifactDaysToKeepStr: "30", | ||
artifactNumToKeepStr: "", | ||
daysToKeepStr: "30", | ||
numToKeepStr: "")), | ||
[ | ||
$class: "ParametersDefinitionProperty", | ||
parameterDefinitions: [ | ||
commonlib.ocpVersionParam('BUILD_VERSION', '4'), | ||
commonlib.artToolsParam(), | ||
string( | ||
name: "ASSEMBLY", | ||
description: "The name of an assembly to rebase & build for. e.g. 4.9.1", | ||
defaultValue: "test", | ||
trim: true | ||
), | ||
booleanParam( | ||
name: "FORCE_REBUILD", | ||
description: "Rebuild even if a build already exists", | ||
defaultValue: false | ||
), | ||
booleanParam( | ||
name: "FORCE_PLASHET_SYNC", | ||
description: "Force plashet sync needed for the build", | ||
defaultValue: false | ||
), | ||
string( | ||
name: 'DOOZER_DATA_PATH', | ||
description: 'ocp-build-data fork to use (e.g. assembly definition in your own fork)', | ||
defaultValue: "https://github.com/openshift-eng/ocp-build-data", | ||
trim: true, | ||
), | ||
booleanParam( | ||
name: 'IGNORE_LOCKS', | ||
description: 'Do not wait for other builds in this version to complete (use only if you know they will not conflict)', | ||
defaultValue: false | ||
), | ||
booleanParam( | ||
name: "DRY_RUN", | ||
description: "Take no action, just echo what the job would have done.", | ||
defaultValue: false | ||
), | ||
commonlib.mockParam(), | ||
] | ||
], | ||
] | ||
) | ||
|
||
commonlib.checkMock() | ||
stage("initialize") { | ||
currentBuild.displayName += " $params.BUILD_VERSION - $params.ASSEMBLY" | ||
if (params.DRY_RUN) { | ||
currentBuild.displayName = "[DRY RUN] " + currentBuild.displayName | ||
} | ||
} | ||
try { | ||
stage("build") { | ||
buildlib.cleanWorkdir("./artcd_working") | ||
sh "mkdir -p ./artcd_working" | ||
def cmd = [ | ||
"artcd", | ||
"-vv", | ||
"--working-dir=./artcd_working", | ||
"--config", "./config/artcd.toml", | ||
] | ||
|
||
if (params.DRY_RUN) { | ||
cmd << "--dry-run" | ||
} | ||
cmd += [ | ||
"build-microshift-bootc", | ||
"--data-path", params.DOOZER_DATA_PATH, | ||
"-g", "openshift-$params.BUILD_VERSION", | ||
"--assembly", params.ASSEMBLY, | ||
] | ||
if (params.FORCE_REBUILD) { | ||
cmd << "--force" | ||
} | ||
if (params.FORCE_PLASHET_SYNC) { | ||
cmd << "--force-plashet-sync" | ||
} | ||
withCredentials([ | ||
string(credentialsId: 'art-bot-slack-token', variable: 'SLACK_BOT_TOKEN'), | ||
string(credentialsId: 'openshift-bot-token', variable: 'GITHUB_TOKEN'), | ||
file(credentialsId: 'konflux-gcp-app-creds-prod', variable: 'GOOGLE_APPLICATION_CREDENTIALS'), | ||
file(credentialsId: 'openshift-bot-konflux-service-account', variable: 'KONFLUX_SA_KUBECONFIG'), | ||
file(credentialsId: 'aws-credentials-file', variable: 'AWS_SHARED_CREDENTIALS_FILE'), | ||
string(credentialsId: 's3-art-srv-enterprise-cloudflare-endpoint', variable: 'CLOUDFLARE_ENDPOINT'), | ||
]) { | ||
echo "Will run ${cmd}" | ||
buildlib.withAppCiAsArtPublish() { | ||
if (params.IGNORE_LOCKS) { | ||
commonlib.shell(script: cmd.join(' ')) | ||
} else { | ||
lock("build-microshift-bootc-lock-${params.BUILD_VERSION}") { | ||
commonlib.shell(script: cmd.join(' ')) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} finally { | ||
stage("save artifacts") { | ||
commonlib.safeArchiveArtifacts([ | ||
"artcd_working/email/**", | ||
"artcd_working/**/*.json", | ||
"artcd_working/**/*.log", | ||
]) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters