Jenkins setup:
Jenkins: 2.361.4
OS: Linux - 5.4.241-150.347.amzn2.x86_64
Java: 11.0.16.1 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
ace-editor:1.1
antisamy-markup-formatter:155.v795fb_8702324
apache-httpcomponents-client-4-api:4.5.14-150.v7a_b_9d17134a_5
authentication-tokens:1.4
aws-credentials:191.vcb_f183ce58b_9
aws-java-sdk-ec2:1.12.287-357.vf82d85a_6eefd
aws-java-sdk-minimal:1.12.287-357.vf82d85a_6eefd
blueocean:1.25.8
blueocean-autofavorite:1.2.5
blueocean-bitbucket-pipeline:1.27.3
blueocean-commons:1.27.3
blueocean-config:1.27.3
blueocean-core-js:1.27.3
blueocean-dashboard:1.27.3
blueocean-display-url:2.4.1
blueocean-events:1.27.3
blueocean-git-pipeline:1.27.3
blueocean-github-pipeline:1.27.3
blueocean-i18n:1.27.3
blueocean-jwt:1.27.3
blueocean-personalization:1.27.3
blueocean-pipeline-api-impl:1.27.3
blueocean-pipeline-editor:1.27.3
blueocean-pipeline-scm-api:1.27.3
blueocean-rest:1.27.3
blueocean-rest-impl:1.27.3
blueocean-web:1.27.3
bootstrap5-api:5.2.1-3
bouncycastle-api:2.27
branch-api:2.1071.v1a_188a_562481
build-user-vars-plugin:1.9
caffeine-api:2.9.3-65.v6a_47d0f4d1fe
checks-api:1.8.1
cloudbees-bitbucket-branch-source:800.va_b_b_9a_a_5035c1
cloudbees-folder:6.758.vfd75d09eea_a_1
command-launcher:1.2
commons-httpclient3-api:3.1-3
commons-lang3-api:3.12.0-36.vd97de6465d5b_
commons-text-api:1.10.0-36.vc008c8fcda_7b_
configuration-as-code:1569.vb_72405b_80249
credentials:1189.vf61b_a_5e2f62e
credentials-binding:523.vd859a_4b_122e6
cucumber-slack-notifier:0.10.0
data-tables-api:1.12.1-4
display-url-api:2.3.7
durable-task:504.vb10d1ae5ba2f
echarts-api:5.4.0-1
extended-choice-parameter:359.v35dcfdd0c20d
favorite:2.4.1
font-awesome-api:6.2.1-1
git:5.0.0
git-client:4.2.0
git-server:99.va_0826a_b_cdfa_d
github:1.37.0
github-api:1.303-417.ve35d9dd78549
github-branch-source:1703.vd5a_2b_29c6cdc
gitlab-plugin:1.7.8
global-slack-notifier:1.5
groovy:453.vcdb_a_c5c99890
handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953
htmlpublisher:1.31
instance-identity:142.v04572ca_5b_265
ionicons-api:45.vf54fca_5d2154
jackson2-api:2.15.2-350.v0c2f3f8fc595
jakarta-activation-api:2.0.1-3
jakarta-mail-api:2.0.1-3
javax-activation-api:1.2.0-6
javax-mail-api:1.6.2-5
jaxb:2.3.8-1
jdk-tool:1.0
jenkins-design-language:1.27.3
jersey2-api:2.39.1-2
jjwt-api:0.11.5-77.v646c772fddb_0
job-dsl:1.81
jobConfigHistory:1176.v1b_4290db_41a_5
jquery3-api:3.6.1-2
jsch:0.1.55.61.va_e9ee26616e7
junit:1189.v1b_e593637fa_e
kubernetes:3900.va_dce992317b_4
kubernetes-client-api:6.4.1-215.v2ed17097a_8e9
kubernetes-credentials:0.10.0
ldap:659.v8ca_b_a_fe79fa_d
lockable-resources:1106.vc9153f1a_ff25
mailer:448.v5b_97805e3767
matrix-auth:3.1.6
matrix-project:785.v06b_7f47b_c631
metrics:4.2.13-420.vea_2f17932dd6
mina-sshd-api-common:2.9.2-62.v199162f0a_2f8
mina-sshd-api-core:2.9.2-62.v199162f0a_2f8
momentjs:1.1.1
okhttp-api:4.10.0-132.v7a_7b_91cef39c
parameterized-scheduler:1.1
pipeline-build-step:488.v8993df156e8d
pipeline-graph-analysis:202.va_d268e64deb_3
pipeline-groovy-lib:629.vb_5627b_ee2104
pipeline-input-step:466.v6d0a_5df34f81
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2125.vddb_a_44a_d605e
pipeline-model-definition:2.2125.vddb_a_44a_d605e
pipeline-model-extensions:2.2125.vddb_a_44a_d605e
pipeline-rest-api:2.32
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2125.vddb_a_44a_d605e
pipeline-stage-view:2.28
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:2.20.0
popper2-api:2.11.6-2
prometheus:2.0.11
pubsub-light:1.17
rebuild:1.34
remote-file:1.23
scm-api:631.v9143df5b_e4a_a
script-security:1229.v4880b_b_e905a_6
slack:631.v40deea_40323b
snakeyaml-api:1.33-95.va_b_a_e3e47b_fa_4
sse-gateway:1.26
ssh-credentials:305.v8f4381501156
sshd:3.275.v9e17c10f2571
structs:324.va_f5d6774f3a_d
token-macro:321.vd7cc1f2a_52c8
trilead-api:2.84.v72119de229b_7
uno-choice:2.6.4
validating-string-parameter:2.8
variant:59.vf075fe829ccb
workflow-aggregator:590.v6a_d052e5a_a_b_5
workflow-api:1208.v0cc7c6e0da_9e
workflow-basic-steps:1010.vf7a_b_98e847c1
workflow-cps:3653.v07ea_433c90b_4
workflow-cps-global-lib:609.vd95673f149b_b
workflow-durable-task-step:1241.v1a_63e465f943
workflow-job:1289.vd1c337fd5354
workflow-multibranch:733.v109046189126
workflow-scm-step:408.v7d5b_135a_b_d49
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:839.v35e2736cfd5c
ISSUE
I am not able to disable restart from stage using the option disableRestartFromStage
Jenkinsfile
pipeline {
agent {
kubernetes {
yaml '''
apiVersion: v1
kind: Pod
spec:
serviceAccountName: jenkins-prod
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: nodetype
operator: In
values:
- jenkins
containers:
- name: jnlp
resources:
requests:
cpu: "512m"
memory: "512Mi"
ephemeral-storage: "120Mi"
limits:
cpu: "512m"
memory: "512Mi"
ephemeral-storage: "240Mi"
- name: node
image: XXXXXXXXXX.dkr.ecr.ap-southeast-1.amazonaws.com/jenkins_base:single_image_v7
command:
- cat
tty: true
resources:
requests:
cpu: "3"
memory: "8Gi"
ephemeral-storage: "4Gi"
limits:
cpu: "3"
memory: "12Gi"
ephemeral-storage: "6Gi"
volumeMounts:
- name: shared-data
mountPath: /home/jenkins/urbanclap/workspace
- name: "kaniko"
image: "gcr.io/kaniko-project/executor:v1.7.0-debug"
command:
- /busybox/cat
tty: true
resources:
requests:
ephemeral-storage: "6Gi"
limits:
ephemeral-storage: "8Gi"
volumeMounts:
- name: shared-data
mountPath: /workspace
restartPolicy: Never
volumes:
- name: shared-data
emptyDir: {}
'''
}
}
options {
disableRestartFromStage()
}
stages {
stage('Build') {
steps {
container('node'){
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: "JenkinsAgent",
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]) {
sh " \
sh $POS_BASE_PATH/scripts/deployment/cicd.sh ${env.JOB_NAME} \
sleep infinity \
"
}
}
}
}
stage('Build and Push Image') {
steps {
container('kaniko') {
script {
def image_tag = "master"
def dockerfileName = "${env.JOB_NAME}.dockerFile"
withCredentials([
[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: "JenkinsAgent",
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]
]) {
sh " \
/kaniko/executor --dockerfile=/workspace/${env.JOB_NAME}/${dockerfileName} \
--context=/workspace/${env.JOB_NAME}/ \
--destination=XXXXXXXXXX.dkr.ecr.ap-southeast-1.amazonaws.com/$DEV_ECR_REPO:${image_tag}-development-${env.BUILD_NUMBER} \
--destination=XXXXXXXXXX.dkr.ecr.ap-southeast-1.amazonaws.com/$STAGE_ECR_REPO:${image_tag}-staging-${env.BUILD_NUMBER} \
--destination=XXXXXXXXXX.dkr.ecr.ap-southeast-1.amazonaws.com/$PROD_ECR_REPO:${image_tag}-production-${env.BUILD_NUMBER} \
--cleanup \
"
}
}
}
}
}
stage('Stage Environments') {
parallel {
stage('Development') {
steps {
script {
def image_tag = "master-development-${env.BUILD_NUMBER}"
container('node') {
withCredentials([
[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: "JenkinsAgent",
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]
]) {
sh " \
sh $POS_BASE_PATH/scripts/deployment/deploy-cicd.sh ${env.JOB_NAME} development ${image_tag} ${env.BUILD_URL} \
"
}
}
}
}
}
stage('Staging') {
steps {
script {
def image_tag = "master-staging-${env.BUILD_NUMBER}"
container('node') {
withCredentials([
[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: "JenkinsAgent",
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]
]) {
sh " \
sh $POS_BASE_PATH/scripts/deployment/deploy-cicd.sh ${env.JOB_NAME} staging ${image_tag} ${env.BUILD_URL} \
"
}
}
}
}
}
}
}
stage('Canary') {
steps {
container('node') {
script {
def image_tag = "master-production-${env.BUILD_NUMBER}"
withCredentials([
[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: "JenkinsAgent",
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]
]) {
sh " \
sh $POS_BASE_PATH/scripts/deployment/deploy-cicd.sh ${env.JOB_NAME} production ${image_tag} ${env.BUILD_URL} \
"
}
}
}
}
}
}
environment {
POS_BASE_PATH = '/home/jenkins/urbanclap/platform-orchestration-service'
DEV_ECR_REPO = 'mandalore-service'
STAGE_ECR_REPO = 'mandalore-service-staging'
PROD_ECR_REPO = 'mandalore-service-production'
}
}