How to set the BuildNumber of a jenkins descriptive pipeline from a service?How to restart Jenkins manually?Jenkins multibranch pipeline with multiple starting pointsJenkins Pipeline sh bad substitutionJenkins Pipeline conditional stage succeeds but Jenkins shows build as failedJenkins Multibranch Pipeline: clean workspace / delete directory when build endsGit LFS pull after checkout results in no step in jenkins pipelineJenkins pipeline library calls inside closures cause security exceptionsJenkins Multibranch Pipeline Scan infinite re-buildJenkins Declarative sequential pipelinesJenkins Multibranch Pipeline: How to checkout only once?
Is this cheap "air conditioner" able to cool a room?
How do we avoid CI-driven development...?
Finish the Mastermind
Can I call myself an assistant professor without a PhD
Secure my password from unsafe servers
In a topological space if there exists a loop that cannot be contracted to a point does there exist a simple loop that cannot be contracted also?
How to realistically deal with a shield user?
How do I calculate the difference in lens reach between a superzoom compact and a DSLR zoom lens?
Shabbat clothing on shabbat chazon
Why should public servants be apolitical?
Why was CPU32 core created, and how is it different from 680x0 CPU cores?
Colleagues speaking another language and it impacts work
Did WWII Japanese soldiers engage in cannibalism of their enemies?
Plausibility of Ice Eaters in the Arctic
Can you use the Fly spell to move underwater at a speed of 60 feet?
Why does Intel's Haswell chip allow multiplication to be twice as fast as addition?
Traveling from Germany to other countries by train?
Should I self-publish my novella on Amazon or try my luck getting publishers?
Will a paper be retracted if a flaw in released software code invalidates its central idea?
Are there any financial disadvantages to living significantly "below your means"?
Why is it 'in the saddle' rather than 'on the saddle'?
Acceptable to cut steak before searing?
What is a "Genuine Geraldo interviewee"?
Decode a variable-length quantity
How to set the BuildNumber of a jenkins descriptive pipeline from a service?
How to restart Jenkins manually?Jenkins multibranch pipeline with multiple starting pointsJenkins Pipeline sh bad substitutionJenkins Pipeline conditional stage succeeds but Jenkins shows build as failedJenkins Multibranch Pipeline: clean workspace / delete directory when build endsGit LFS pull after checkout results in no step in jenkins pipelineJenkins pipeline library calls inside closures cause security exceptionsJenkins Multibranch Pipeline Scan infinite re-buildJenkins Declarative sequential pipelinesJenkins Multibranch Pipeline: How to checkout only once?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I've tried to accomplish this: https://www.quernus.co.uk/2016/08/12/global-build-numbers-in-jenkins-multibranch-pipeline-builds/ in order to have a unique build number accross all the branches.
//...
stages
stage('Initialization started')
steps
env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
currentBuild.displayName = "#" + env.BUILD_ID
echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"
//...
//...
But I think it's not done for Jenkins Descriptive pipeline files, because when I try to run it, I get this:
[Bitbucket] Build result notified
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 17: Expected a step @ line 17, column 5.
env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
^
WorkflowScript: 18: Expected a step @ line 18, column 5.
currentBuild.displayName = "#" + env.BUILD_ID
What is the equivalent with Jenkins descriptive pipeline files?
jenkins jenkins-pipeline pipeline multibranch-pipeline
add a comment |
I've tried to accomplish this: https://www.quernus.co.uk/2016/08/12/global-build-numbers-in-jenkins-multibranch-pipeline-builds/ in order to have a unique build number accross all the branches.
//...
stages
stage('Initialization started')
steps
env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
currentBuild.displayName = "#" + env.BUILD_ID
echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"
//...
//...
But I think it's not done for Jenkins Descriptive pipeline files, because when I try to run it, I get this:
[Bitbucket] Build result notified
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 17: Expected a step @ line 17, column 5.
env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
^
WorkflowScript: 18: Expected a step @ line 18, column 5.
currentBuild.displayName = "#" + env.BUILD_ID
What is the equivalent with Jenkins descriptive pipeline files?
jenkins jenkins-pipeline pipeline multibranch-pipeline
add a comment |
I've tried to accomplish this: https://www.quernus.co.uk/2016/08/12/global-build-numbers-in-jenkins-multibranch-pipeline-builds/ in order to have a unique build number accross all the branches.
//...
stages
stage('Initialization started')
steps
env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
currentBuild.displayName = "#" + env.BUILD_ID
echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"
//...
//...
But I think it's not done for Jenkins Descriptive pipeline files, because when I try to run it, I get this:
[Bitbucket] Build result notified
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 17: Expected a step @ line 17, column 5.
env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
^
WorkflowScript: 18: Expected a step @ line 18, column 5.
currentBuild.displayName = "#" + env.BUILD_ID
What is the equivalent with Jenkins descriptive pipeline files?
jenkins jenkins-pipeline pipeline multibranch-pipeline
I've tried to accomplish this: https://www.quernus.co.uk/2016/08/12/global-build-numbers-in-jenkins-multibranch-pipeline-builds/ in order to have a unique build number accross all the branches.
//...
stages
stage('Initialization started')
steps
env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
currentBuild.displayName = "#" + env.BUILD_ID
echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"
//...
//...
But I think it's not done for Jenkins Descriptive pipeline files, because when I try to run it, I get this:
[Bitbucket] Build result notified
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 17: Expected a step @ line 17, column 5.
env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
^
WorkflowScript: 18: Expected a step @ line 18, column 5.
currentBuild.displayName = "#" + env.BUILD_ID
What is the equivalent with Jenkins descriptive pipeline files?
jenkins jenkins-pipeline pipeline multibranch-pipeline
jenkins jenkins-pipeline pipeline multibranch-pipeline
edited Mar 27 at 7:55
daspilker
6,45819 silver badges40 bronze badges
6,45819 silver badges40 bronze badges
asked Mar 27 at 6:56
J4NJ4N
6,46225 gold badges117 silver badges221 bronze badges
6,46225 gold badges117 silver badges221 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You have to encapsulate your commands with script :
//...
stages
stage('Initialization started')
steps
script
env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
currentBuild.displayName = "#" + env.BUILD_ID
echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"
//...
//...
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55371413%2fhow-to-set-the-buildnumber-of-a-jenkins-descriptive-pipeline-from-a-service%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have to encapsulate your commands with script :
//...
stages
stage('Initialization started')
steps
script
env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
currentBuild.displayName = "#" + env.BUILD_ID
echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"
//...
//...
add a comment |
You have to encapsulate your commands with script :
//...
stages
stage('Initialization started')
steps
script
env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
currentBuild.displayName = "#" + env.BUILD_ID
echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"
//...
//...
add a comment |
You have to encapsulate your commands with script :
//...
stages
stage('Initialization started')
steps
script
env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
currentBuild.displayName = "#" + env.BUILD_ID
echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"
//...
//...
You have to encapsulate your commands with script :
//...
stages
stage('Initialization started')
steps
script
env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
currentBuild.displayName = "#" + env.BUILD_ID
echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"
//...
//...
answered Mar 27 at 9:41
SmartTomSmartTom
2497 bronze badges
2497 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55371413%2fhow-to-set-the-buildnumber-of-a-jenkins-descriptive-pipeline-from-a-service%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown