-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix variable interpolation on different examples #119
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,14 +15,14 @@ node { | |
echo "Building flavor ${flavor}" | ||
|
||
//build your gradle flavor, passes the current build number as a parameter to gradle | ||
sh "./gradlew clean assemble${flavor}Debug -PBUILD_NUMBER=${env.BUILD_NUMBER}" | ||
sh './gradlew clean assemble${flavor}Debug -PBUILD_NUMBER=${BUILD_NUMBER}' | ||
|
||
stage 'Stage Archive' | ||
//tell Jenkins to archive the apks | ||
archiveArtifacts artifacts: 'app/build/outputs/apk/*.apk', fingerprint: true | ||
|
||
stage 'Stage Upload To Fabric' | ||
sh "./gradlew crashlyticsUploadDistribution${flavor}Debug -PBUILD_NUMBER=${env.BUILD_NUMBER}" | ||
sh './gradlew crashlyticsUploadDistribution${flavor}Debug -PBUILD_NUMBER=${BUILD_NUMBER}' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above. |
||
} | ||
|
||
// Pulls the android flavor out of the branch name the branch is prepended with /QA_ | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4,8 +4,11 @@ node { | |||||||||||||||
|
||||||||||||||||
stage 'Build' | ||||||||||||||||
bat 'nuget restore SolutionName.sln' | ||||||||||||||||
bat "\"${tool 'MSBuild'}\" SolutionName.sln /p:Configuration=Release /p:Platform=\"Any CPU\" /p:ProductVersion=1.0.0.${env.BUILD_NUMBER}" | ||||||||||||||||
|
||||||||||||||||
bat """ | ||||||||||||||||
setlocal enabledelayedexpansion | ||||||||||||||||
\"${tool 'MSBuild'}\" SolutionName.sln /p:Configuration=Release /p:Platform=\"Any CPU\" /p:ProductVersion=1.0.0.!BUILD_NUMBER! | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you test this? Even if it works, I'm unsure whether we should do it like this, as it doesn't provide an example of safe Pipeline authoring. There's still the double quote. |
||||||||||||||||
endlocal | ||||||||||||||||
""" | ||||||||||||||||
Comment on lines
+7
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps something like
Suggested change
Granted, this theoretically still has the problem described in https://plugins.jenkins.io/safe-batch-environment-filter/ but we know that |
||||||||||||||||
stage 'Archive' | ||||||||||||||||
archive 'ProjectName/bin/Release/**' | ||||||||||||||||
|
||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -8,5 +8,7 @@ def notifySlack(text, channel) { | |||||
channel : channel, | ||||||
username : "jenkins", | ||||||
icon_emoji: ":jenkins:"]) | ||||||
sh "curl -X POST --data-urlencode \'payload=${payload}\' ${slackURL}" | ||||||
withEnv(["PAYLOAD=${payload}", "SLACK_URL=${slackURL}"]) { | ||||||
sh 'curl -X POST --data-urlencode "payload=$PAYLOAD" $SLACK_URL' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,9 +27,9 @@ node('second-node') { | |
} | ||
|
||
// Look, no output directory under the root! | ||
// pwd() outputs the current directory Pipeline is running in. | ||
sh "ls -la ${pwd()}" | ||
// PWD outputs the current directory Pipeline is running in. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kind of, but not really? The result is the same, assuming you use a shell that supports it, but this won't demonstrate the (Granted, both the existing Pipeline and this one are really artificial, neither |
||
sh 'ls -la ${PWD}' | ||
|
||
// And look, output directory is there under first-stash! | ||
sh "ls -la ${pwd()}/first-stash" | ||
sh 'ls -la ${PWD}/first-stash' | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${flavor}
isn't an environment variable (BRANCH_NAME
is) so this won't work. UsewithEnv
.