-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: muhammad adil ghaffar <muhammad.adil.ghaffar@est.tech>
- Loading branch information
1 parent
25e7815
commit cfae8cb
Showing
2 changed files
with
115 additions
and
0 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,4 @@ | ||
# Common editor / temporary files | ||
*~ | ||
*.tmp | ||
.DS_Store |
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,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' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |