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

convert fullstack jobs to be prow compatible #887

Merged
merged 1 commit into from
Jan 15, 2025
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
54 changes: 52 additions & 2 deletions jenkins/jobs/dynamic_fullstack_building.pipeline
Original file line number Diff line number Diff line change
@@ -1,17 +1,48 @@
import java.text.SimpleDateFormat

// Token for retrieving the GitHub credentials from the Jenkis key storage
ci_git_credential_id = 'metal3-jenkins-github-username-token'

// 3 hours
def TIMEOUT = 10800

script {

UPDATED_REPO = "https://github.com/${env.REPO_OWNER}/${env.REPO_NAME}.git"
echo "Test triggered from ${UPDATED_REPO}"
ci_git_url = "https://github.com/metal3-io/project-infra.git"

if ("${env.REPO_OWNER}" == 'metal3-io' && "${env.REPO_NAME}" == 'project-infra') {
ci_git_branch = (env.PULL_PULL_SHA) ?: 'main'
ci_git_base = (env.PULL_BASE_REF) ?: 'main'
// Fetch the base branch and the ci_git_branch when running on project-infra PR
refspec = '+refs/heads/' + ci_git_base + ':refs/remotes/origin/' + ci_git_base + ' ' + ci_git_branch
} else {
ci_git_branch = 'main'
refspec = '+refs/heads/*:refs/remotes/origin/*'
}
echo "Checkout ${ci_git_url} branch ${ci_git_branch}"
}

pipeline {
agent { label 'metal3ci-8c32gb-ubuntu' }
environment {
// supplied by prow
REPO_ORG = "${env.REPO_OWNER}"
REPO_NAME = "${env.REPO_NAME}"
REPO_BRANCH = "${env.PULL_BASE_REF}"
UPDATED_BRANCH = "${env.PULL_PULL_SHA}"
PR_ID = "${env.PULL_NUMBER}"
// pipeline script local
UPDATED_REPO = "${UPDATED_REPO}"
METAL3_CI_USER="metal3ci"
RT_URL="https://artifactory.nordix.org/artifactory"
CURRENT_DIR = sh (
script: 'readlink -f "."',
returnStdout: true
).trim()
// jenkins job auto generates
BUILD_TAG = "${env.BUILD_TAG}"
}
stages {
stage('Building and testing full Metal3 stack'){
Expand All @@ -22,13 +53,32 @@ pipeline {
script {
CURRENT_START_TIME = System.currentTimeMillis()
}
/* Checkout CI Repo */
checkout([
$class: 'GitSCM',
branches: [
[name: ci_git_branch]
],
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'WipeWorkspace'],
[$class: 'CleanCheckout'],
[$class: 'CleanBeforeCheckout']
],
submoduleCfg: [],
userRemoteConfigs: [
[credentialsId: ci_git_credential_id,url: ci_git_url, refspec: refspec]
]
])
/* Pass all the credentials */
withCredentials([usernamePassword(credentialsId: 'infra-nordix-artifactory-api-key', usernameVariable: 'RT_USER', passwordVariable: 'RT_TOKEN')]) {
withCredentials([usernamePassword(credentialsId: 'metal3ci_harbor', usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASSWORD')]) {
withCredentials([string(credentialsId: 'metal3-clusterctl-github-token', variable: 'GITHUB_TOKEN')]) {
/* Fullstack building script */
timestamps {
sh './jenkins/scripts/dynamic_worker_workflow/fullstack.sh'
ansiColor('xterm') {
timestamps {
sh './jenkins/scripts/dynamic_worker_workflow/fullstack.sh'
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion jenkins/scripts/dynamic_worker_workflow/fullstack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ echo "Running Ironic image building script"

IPA_REPO="${IPA_REPO:-https://opendev.org/openstack/ironic-python-agent.git}"
IPA_BRANCH="${IPA_BRANCH:-master}"
IPA_REF="${IPA_REF:-HEAD}"
IPA_BUILDER_REPO="${IPA_BUILDER_REPO:-https://opendev.org/openstack/ironic-python-agent-builder.git}"
IPA_BUILDER_BRANCH="${IPA_BUILDER_BRANCH:-master}"
IPA_BUILDER_COMMIT="${IPA_BUILDER_COMMIT:-HEAD}"
Expand Down
6 changes: 6 additions & 0 deletions prow/config/jobs/metal3-io/project-infra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,9 @@ presubmits:
agent: jenkins
always_run: false
optional: true
- name: metal3-fullstack-build
branches:
- main
agent: jenkins
always_run: false
optional: true
Loading