Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ptankov committed Jan 30, 2025
1 parent 95bd2a4 commit 5240cff
Showing 1 changed file with 14 additions and 38 deletions.
52 changes: 14 additions & 38 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void createCluster(String CLUSTER_SUFFIX) {
gcloud auth activate-service-account --key-file $CLIENT_SECRET_FILE
gcloud config set project $GCP_PROJECT
gcloud container clusters list --filter $CLUSTER_NAME-${CLUSTER_SUFFIX} --zone $region --format='csv[no-heading](name)' | xargs gcloud container clusters delete --zone $region --quiet || true
gcloud container clusters create --zone $region $CLUSTER_NAME-${CLUSTER_SUFFIX} --cluster-version=1.28 --machine-type=n1-standard-4 --preemptible --disk-size 30 --num-nodes=\$NODES_NUM --network=jenkins-vpc --subnetwork=jenkins-${CLUSTER_SUFFIX} --no-enable-autoupgrade --cluster-ipv4-cidr=/21 --labels delete-cluster-after-hours=6 --enable-ip-alias && \
gcloud container clusters create --zone $region $CLUSTER_NAME-${CLUSTER_SUFFIX} --cluster-version=1.28 --machine-type=n1-standard-4 --preemptible --disk-size 30 --num-nodes=\$NODES_NUM --network=jenkins-ps-vpc --subnetwork=jenkins-ps-${CLUSTER_SUFFIX} --no-enable-autoupgrade --cluster-ipv4-cidr=/21 --labels delete-cluster-after-hours=6 --enable-ip-alias && \
kubectl create clusterrolebinding cluster-admin-binding --clusterrole cluster-admin --user jenkins@"$GCP_PROJECT".iam.gserviceaccount.com || ret_val=\$?
if [ \${ret_val} -eq 0 ]; then break; fi
ret_num=\$((ret_num + 1))
Expand Down Expand Up @@ -98,6 +98,17 @@ void pushArtifactFile(String FILE_NAME) {
}
}

void popArtifactFile(String FILE_NAME) {
echo "Try to get $FILE_NAME file from S3!"

withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AMI/OVF', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) {
sh """
S3_PATH=s3://percona-jenkins-artifactory/\$JOB_NAME/\$(git rev-parse --short HEAD)
aws s3 cp --quiet \$S3_PATH/${FILE_NAME} ${FILE_NAME} || :
"""
}
}

void initTests() {
echo "Populating tests into the tests array!"

Expand Down Expand Up @@ -229,6 +240,7 @@ void runTest(Integer TEST_ID) {
catch (exc) {
printKubernetesStatus("AFTER","$clusterSuffix")
echo "Test $testName has failed!"
echo "$exc"
if (retryCount >= 1 || currentBuild.nextBuild != null) {
currentBuild.result = 'FAILURE'
return true
Expand Down Expand Up @@ -372,7 +384,6 @@ pipeline {
VERSION = "${env.GIT_BRANCH}-${env.GIT_SHORT_COMMIT}"
CLUSTER_NAME = sh(script: "echo jen-ps-${env.CHANGE_ID}-${GIT_SHORT_COMMIT}-${env.BUILD_NUMBER} | tr '[:upper:]' '[:lower:]'", , returnStdout: true).trim()
AUTHOR_NAME = sh(script: "echo ${CHANGE_AUTHOR_EMAIL} | awk -F'@' '{print \$1}'", , returnStdout: true).trim()
ENABLE_LOGGING = "true"
}
agent {
label 'docker'
Expand Down Expand Up @@ -419,7 +430,6 @@ pipeline {
chmod 600 e2e-tests/conf/cloud-secret.yml
'''
}
stash includes: "**", name: "sourceFILES"
deleteOldClusters("jen-ps-$CHANGE_ID")
}
}
Expand All @@ -440,6 +450,7 @@ pipeline {
docker login -u '${USER}' -p '${PASS}'
export RELEASE=0
export IMAGE=\$DOCKER_TAG
docker buildx create --use
./e2e-tests/build
docker logout
"
Expand Down Expand Up @@ -529,12 +540,7 @@ pipeline {
isPRJob && needToRunTests
}
}
agent {
label 'docker'
}
steps {
prepareNode()
unstash "sourceFILES"
clusterRunner('cluster1')
}
}
Expand All @@ -544,12 +550,7 @@ pipeline {
isPRJob && needToRunTests
}
}
agent {
label 'docker'
}
steps {
prepareNode()
unstash "sourceFILES"
clusterRunner('cluster2')
}
}
Expand All @@ -559,12 +560,7 @@ pipeline {
isPRJob && needToRunTests
}
}
agent {
label 'docker'
}
steps {
prepareNode()
unstash "sourceFILES"
clusterRunner('cluster3')
}
}
Expand All @@ -574,12 +570,7 @@ pipeline {
isPRJob && needToRunTests
}
}
agent {
label 'docker'
}
steps {
prepareNode()
unstash "sourceFILES"
clusterRunner('cluster4')
}
}
Expand All @@ -589,12 +580,7 @@ pipeline {
isPRJob && needToRunTests
}
}
agent {
label 'docker'
}
steps {
prepareNode()
unstash "sourceFILES"
clusterRunner('cluster5')
}
}
Expand All @@ -604,12 +590,7 @@ pipeline {
isPRJob && needToRunTests
}
}
agent {
label 'docker'
}
steps {
prepareNode()
unstash "sourceFILES"
clusterRunner('cluster6')
}
}
Expand All @@ -619,12 +600,7 @@ pipeline {
isPRJob && needToRunTests
}
}
agent {
label 'docker'
}
steps {
prepareNode()
unstash "sourceFILES"
clusterRunner('cluster7')
}
}
Expand Down

0 comments on commit 5240cff

Please sign in to comment.