Skip to content

Conversation

@rosbo
Copy link
Contributor

@rosbo rosbo commented Jan 12, 2024

No description provided.

// Use dev branch names as tags, but replace '/' with '-' using sed since docker images don't support forward slash
PRETEST_TAG = sh(returnStdout: true, script: "if [[ \"${GIT_BRANCH}\" == \"main\" ]]; then echo \"ci-pretest\"; else echo \"${GIT_BRANCH}-pretest\" | sed 's/\//-/g'; fi").trim()
STAGING_TAG = sh(returnStdout: true, script: "if [[ \"${GIT_BRANCH}\" == \"main\" ]]; then echo \"staging\"; else echo \"${GIT_BRANCH}-staging\" | sed 's/\//-/g'; fi").trim()
PRETEST_TAG = sh(returnStdout: true, script: "if [[ \"${GIT_BRANCH}\" == \"main\" ]]; then echo \"ci-pretest\"; else echo \"${GIT_BRANCH}-pretest\" | sed 's/\\//-/g'; fi").trim()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Groovy (the language for the Jenkinsfile), you need to escape the \: https://groovy-lang.org/syntax.html#_escaping_special_characters

@rosbo rosbo merged commit 2f42cbb into main Jan 12, 2024
@rosbo rosbo deleted the escape-backslash-jenkins branch January 12, 2024 20:45
@rosbo rosbo requested a review from KeijiBranshi January 12, 2024 20:45
Copy link
Member

@KeijiBranshi KeijiBranshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like escaping the escape character escaped me (bad pun, I'm sorry 🥲)

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants