-
-
Save doytsujin/ff2ac13ee5181591327c9f388841bd6b to your computer and use it in GitHub Desktop.
Escape character & quotes in Jenkins Pipeline
This file contains hidden or 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
docker.image('cloudbees/java-build-tools:0.0.6').inside { | |
sshagent(['github-ssh-credentials']) { | |
sh """ | |
git version | |
git config --local user.email \\"[email protected]\\" | |
git config --local user.name \\"Cyrille Le Clerc\\" | |
git clone [email protected]:cyrille-leclerc/a-test-repo.git | |
date &> now.txt | |
git commit --all -m \\"another commit\\" | |
git push origin/master | |
""" | |
} | |
} |
This file contains hidden or 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
Started by user admin | |
[Pipeline] Allocate node : Start | |
Running on docker-agent.beesshop.org in /home/ubuntu/jenkins-aws-home/workspace/tests/test-git | |
[Pipeline] node { | |
[Pipeline] sh | |
[test-git] Running shell script | |
+ docker inspect -f . cloudbees/java-build-tools:0.0.6 | |
. | |
[Pipeline] Run build steps inside a Docker container : Start | |
$ docker run -t -d -u 1000:1000 -w /home/ubuntu/jenkins-aws-home/workspace/tests/test-git -v /home/ubuntu/jenkins-aws-home/workspace/tests/test-git:/home/ubuntu/jenkins-aws-home/workspace/tests/test-git:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** cloudbees/java-build-tools:0.0.6 cat | |
[Pipeline] withDockerContainer { | |
[Pipeline] SSH Agent : Start | |
[ssh-agent] Using credentials cyrille-leclerc (GitHub cyrille-leclerc ssh) | |
[ssh-agent] Looking for ssh-agent implementation... | |
[ssh-agent] Java/JNR ssh-agent | |
[ssh-agent] Started. | |
[Pipeline] sshagent { | |
[Pipeline] sh | |
[test-git] Running shell script | |
+ git version | |
git version 2.1.4 | |
+ git config --local user.email "[email protected]" | |
+ git config --local user.name "Cyrille Le Clerc" | |
usage: git config [options] | |
Config file location | |
--global use global config file | |
--system use system config file | |
--local use repository config file | |
-f, --file <file> use given config file | |
--blob <blob-id> read config from given blob object | |
Action | |
--get get value: name [value-regex] | |
--get-all get all values: key [value-regex] | |
--get-regexp get values for regexp: name-regex [value-regex] | |
--get-urlmatch get value specific for the URL: section[.var] URL | |
--replace-all replace all matching variables: name value [value_regex] | |
--add add a new variable: name value | |
--unset remove a variable: name [value-regex] | |
--unset-all remove all matches: name [value-regex] | |
--rename-section rename section: old-name new-name | |
--remove-section remove a section: name | |
-l, --list list all | |
-e, --edit open an editor | |
--get-color <slot> find the color configured: [default] | |
--get-colorbool <slot> | |
find the color setting: [stdout-is-tty] | |
Type | |
--bool value is "true" or "false" | |
--int value is decimal number | |
--bool-or-int value is --bool or --int | |
--path value is a path (file or directory name) | |
Other | |
-z, --null terminate values with NUL byte | |
--includes respect include directives on lookup | |
[Pipeline] } //sshagent | |
[Pipeline] SSH Agent : End | |
[Pipeline] } //withDockerContainer | |
$ docker stop 6a8ba100abb54669d24cfc7d4b6cae0dfaad727b8f3c7a3ad186690d9ee12d4a | |
$ docker rm -f 6a8ba100abb54669d24cfc7d4b6cae0dfaad727b8f3c7a3ad186690d9ee12d4a | |
[Pipeline] Run build steps inside a Docker container : End | |
[Pipeline] } //node | |
[Pipeline] Allocate node : End | |
[Pipeline] End of Pipeline | |
ERROR: script returned exit code 129 | |
Finished: FAILURE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment