CasC not working with local build
See original GitHub issueI built the master of jenkinsfile-runner with:
mvn clean package
Then i changed into jenkinsfile-runner/demo/pipeline-library There i did in a bash shell:
CASC_JENKINS_CONFIG=$(pwd)/jenkins.yaml
java -jar ../../app/target/jenkinsfile-runner-standalone.jar -p ../../vanilla-package/target/plugins/ -f .
i got the following exception:
Started
Running in Durability level: PERFORMANCE_OPTIMIZED
[Pipeline] Start of Pipeline
[Pipeline] End of Pipeline
java.lang.NoSuchMethodError: No such DSL method 'buildPlugin'
Which is not what i expected. So i changed into jenkinsfile-runner/demo/casc and did there:
CASC_JENKINS_CONFIG=$(pwd)/config/jenkins.yaml
java -jar ../../app/target/jenkinsfile-runner-standalone.jar -p ../../vanilla-package/target/plugins/ -f .
And got as output:
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/folders/m7/jql3p30h8xl46m001s7q50mh0000gp/T/jenkinsfileRunner.tmp/jfr5797116649782649554.run/workspace/job
GOT CONTEXT FOR Build
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] echo
Hello world!
[Pipeline] echo
An environment variable configured via JCasC: null
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
With the null value for ${env.SOME_CASC_ENV_VAR} it seems to me obvious that the CasC mechanism at least in my environment is not working
My environment:
bash-3.2$ java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.232-b09, mixed mode)
bash-3.2$ java -jar ../../app/target/jenkinsfile-runner-standalone.jar -p ../../vanilla-package/target/plugins/ -f .
No explicit version has been selected, using latest LTS
Running pipeline on jenkins 2.222.1
git log 628ms Do 2 Apr 18:18:59 2020
commit b8429941bbc8898876dcc3b975070f2d5707a822 (HEAD -> master, origin/master, origin/HEAD)
Merge: 1a25d1c 337b27d
Author: Oleg Nenashev <o.v.nenashev@gmail.com>
Date: Thu Mar 26 12:07:12 2020 +0100
Merge pull request #253 from LinuxSuRen/latest-plugin
Use latest as the default version of plugin
commit 337b27de0b0c3ab231d1a8d5ace22df78ba0a4fe
Author: rick <rick@jenkins-zh.cn>
Date: Sun Mar 8 22:41:48 2020 +0800
Use latest as the default version of plugin
Any suggestions?
Best thanks for the great work, a working CasC would be neat though
Issue Analytics
- State:
- Created 3 years ago
- Comments:21 (6 by maintainers)
Top Results From Across the Web
Troubleshooting CasC for the operations center
An ERROR indicates a critical problem with the CasC bundle that must be resolved before the bundle can be applied to the instance....
Read more >Getting started with Jenkins Config as Code - Verifa
Let's test that this basic setup works. # build the docker image docker build -t jenkins-casc:0.1 . # run the docker image and ......
Read more >Configuration as Code - Jenkins
The Jenkins Configuration as Code (JCasC) feature defines Jenkins configuration parameters in a human-readable YAML file that can be stored as source code....
Read more >jenkinsci/configuration-as-code-plugin - Gitter
I tried running it on docker with a RUN /usr/local/bin/install-plugins.sh ... it was not my installation but my jenkins.yaml file that contained the...
Read more >Getting started with Jenkins Configuration as Code - Eficode
build : #TODO: Once plugin installation is handled through c-as-c this can ... This section focuses on introducing JCasC to a running Jenkins ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Vanilla is also packaged to Docker so they are quite orthogonal. But yes, I hope to evolve the vanilla packaging a bit more so that one can actually use Jenkinsfile Runner without repackaging everything in simple use-cases. Custom WAAR Packager will be still needed for more advanced cases
NWS, I also had not noticed it until I tried. There are too many shells out there, and all of them handle env vars differently. I will add a note to the demo