if (config.command === 'required') {
qodirovshohijahon opened this issue · 4 comments
qodirovshohijahon commented
I am trying to use this plugin in order to build image using Packer and faced some problems as I have shared tried to solve with many ways or are there any solutions?
org.jenkinsci.plugins.workflow.cps.CpsCompilationErrorsException: startup failed:
/var/lib/jenkins/jobs/packer-build/builds/2/libs/e31cbfcec9e1ae81ce169020532f1ea1ad6df7e02e35a95e2dba307f32061dec/vars/packer.groovy: 203: Unsupported operation in this context @ line 203, column 7.
if (config.command === 'required') {
^
/var/lib/jenkins/jobs/packer-build/builds/2/libs/e31cbfcec9e1ae81ce169020532f1ea1ad6df7e02e35a95e2dba307f32061dec/vars/packer.groovy: 210: Unsupported operation in this context @ line 210, column 9.
if (config.command === 'required') {
^
2 errors
My Jenkinsfile
@Library('devops-libs') _
pipeline {
agent any
parameters {
string(
name: 'SCM_URL',
description: 'The URL (HTTPS or SSH URI) to the source repository',
defaultValue: 'https://github.com/qodirovshohijahon/devops-tasks'
)
}
stages {
stage('Soo ---- Initialize Packer Templates and Configs') {
steps {
script {
packer.fmt(
check: false,
diff: false,
template: './packer-build-image'
)
}
}
}
stage('Build Image Artifacts') {
steps {
script {
packer.build(
template: 'packer-build-image'
)
}
}
}
}
}
mschuchard commented
This passed the last test execution. I will need to check back on current test status.
qodirovshohijahon commented
Please share any jenkinsfile to be more confident?
mschuchard commented
Root cause discovered: Jenkins system Groovy is still using obsolete 2.4.x. ===
and !==
were introduced years ago in 3.x. Patching.
mschuchard commented
Fixed in 44288c5.