Skip to content

Commit

Permalink
clusterctl upgrade test
Browse files Browse the repository at this point in the history
Signed-off-by: muhammad adil ghaffar <muhammad.adil.ghaffar@est.tech>
  • Loading branch information
adilGhaffarDev committed Mar 6, 2024
1 parent 25e7815 commit cfae8cb
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Common editor / temporary files
*~
*.tmp
.DS_Store
111 changes: 111 additions & 0 deletions jenkins/jobs/clusterctl_upgrade.pipeline
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import java.text.SimpleDateFormat
import java.security.SecureRandom

ci_git_credential_id = "metal3-jenkins-github-token"

// 3 hours
int TIMEOUT = 10800

KEEP_TEST_ENV = (env.KEEP_TEST_ENV)

script {
if ("${PROJECT_REPO_ORG}" == 'metal3-io' && "${PROJECT_REPO_NAME}" == 'project-infra') {
echo "Checkout ${ghprbAuthorRepoGitUrl} branch ${ghprbActualCommit}"
ci_git_branch = "${ghprbActualCommit}"
ci_git_url = "${ghprbAuthorRepoGitUrl}"
} else {
echo "Checkout ${ghprbAuthorRepoGitUrl} main"
ci_git_branch = 'main'
ci_git_url = 'https://github.com/metal3-io/project-infra.git'
}

int rand = new SecureRandom()
VM_KEY = (1..4).collect {
('a'..
'z').join('')[rand.nextInt(26)]
}.join('')

agent_label="metal3ci-large-${IMAGE_OS}"
}

pipeline {
agent none
environment {
METAL3_CI_USER = 'metal3ci'
REPO_ORG = "${PROJECT_REPO_ORG}"
REPO_NAME = "${PROJECT_REPO_NAME}"
UPDATED_REPO = "${ghprbAuthorRepoGitUrl}"
REPO_BRANCH = "${ghprbTargetBranch}"
UPDATED_BRANCH = "${ghprbActualCommit}"
BUILD_TAG = "${env.BUILD_TAG}"
PR_ID = "${ghprbPullId}"
IMAGE_OS = "${IMAGE_OS}"
CAPM3RELEASEBRANCH = "${capm3_release_branch}"
BMORELEASEBRANCH = "${bmo_release_branch}"
TARGET_NODE_MEMORY = "${TARGET_NODE_MEMORY}"
NUM_NODES = 4
TESTS_FOR = "${TESTS_FOR}"
KEEP_TEST_ENV = false
GINKGO_FOCUS = 'clusterctl-upgrade'
}

stages {
stage('Clusterctl upgrade test') {
agent { label agent_label }
options {
timeout(time: TIMEOUT, unit: 'SECONDS')
}
steps {
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]
]
])
withCredentials([string(credentialsId: 'metal3-clusterctl-github-token', variable: 'GITHUB_TOKEN')]) {
ansiColor('xterm') {
timestamps {
sh './jenkins/scripts/dynamic_worker_workflow/feature_tests.sh'
}
}
}
}
post {
always {
script {
CURRENT_END_TIME = System.currentTimeMillis()
if ((((CURRENT_END_TIME - CURRENT_START_TIME) / 1000) - TIMEOUT) > 0) {
echo 'Failed due to timeout'
currentBuild.result = 'FAILURE'
}
timestamps {
sh './jenkins/scripts/dynamic_worker_workflow/fetch_logs.sh'
archiveArtifacts "logs-${env.BUILD_TAG}.tgz"
}
}
}
cleanup {
script {
timestamps {
sh './jenkins/scripts/dynamic_worker_workflow/run_clean.sh'
}
}
}
}
}
}
}

0 comments on commit cfae8cb

Please sign in to comment.