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
Adding milestone, lock, and block-stage steps to the demo #3
Conversation
@@ -29,7 +29,7 @@ USER jenkins | |||
RUN echo '<settings><mirrors><mirror><id>central</id><url>http://repo.jenkins-ci.org/simple/repo1-cache/</url><mirrorOf>central</mirrorOf></mirror></mirrors><localRepository>/usr/share/jenkins/ref/.m2/repository</localRepository></settings>' > settings.xml | |||
RUN /usr/local/maven/bin/mvn -s settings.xml -f repo-wc install && /usr/local/maven/bin/mvn -s settings.xml -f repo-wc/sometests -Dmaven.test.failure.ignore clean install | |||
|
|||
COPY plugins.txt . | |||
COPY plugins.txt ./ |
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.
Not sure how it worked before. Without the slash I get this.
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.
What version of Docker are you using? I've seen a couple quirks around this where behaviors changed between docker versions.
This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation. |
@@ -9,7 +9,10 @@ git-server:1.6 | |||
handlebars:1.1.1 | |||
icon-shim:2.0.3 | |||
jquery-detached:1.2.1 | |||
lockable-resources:1.8 | |||
mailer:1.5 |
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.
Why?
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.
Transitive dependencies of lockable-resources
. All dependencies must be explicitly set as there is no dependencies resolution here, no?
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.
there is no dependencies resolution here
Correct.
servers.deploy 'production' | ||
echo "Deployed to ${jettyUrl}production/" | ||
milestone() | ||
lock('production-server') { |
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.
🐜 Similar to previous comment: one consistent style is helpful, alternately an explaining comment like "this is the same as specifying resource: 'production-server' "
@jglick updated. |
Needs to be updated to include jenkinsci/pipeline-stage-step-plugin#4. |
@jglick I found some cases where the blocked stage 'QA'
echo 'Hi!'
lock(resource: 'staging-server') {
stage name: 'Staging'
echo 'In staging'
} The action to acquire staging-server is in QA stage, but I see no way to do that with blocked |
@amuniz what is wrong with (roughly) stage('Staging') {
lock('staging-server') {
node {
servers.deploy 'staging'
}
input "Does ${jettyUrl}staging/ look good?"
}
}
checkpoint 'Before production' ? |
Nothing wrong, but not equivalent. The build is in |
Well then we have fixed a buglet: logically it makes no sense for the build to be considered in QA when we have finished QA and are now just waiting to stage it. |
I mean, depending on how the stage view visualizes things, this would also be valid: lock('staging-server') {
stage('Staging') {
node {
servers.deploy 'staging'
}
input "Does ${jettyUrl}staging/ look good?"
}
}
checkpoint 'Before production' which would mean that if we have to wait for the server, there will be a |
echo "Deployed to ${jettyUrl}production/" | ||
milestone 2 | ||
stage ('Production') { | ||
lock('production-server') { |
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.
Is there a reason inversePrecedence
is not being specified here too?
So. One obvious problem is that @svanoort has not yet patched More to the point, the demo as written does not solve the problem originally stated in JENKINS-27039. If you decline to approve the first build of
and then trigger a second build, it hangs:
I thought the idea was that once the second build passed milestone 1, if the first build was still between 1 and 2 it would be canceled. But this does not seem to happen. |
Yeah, I see this in the logs, maybe unrelated:
Yes, that's what Fixed in last commit. |
I think unrelated.
Build 1 is past milestone 1 and holding the lock and paused in input. Build 2 is also past milestone 1. OK, rereading the description of the But now there may be a problem in that the lock is not held while we prompt for input, so someone could come to this prompt while the server is being updated to some newer build, which would be misleading. What we would really want (I think) is that only one build at a time can be in staging, and if build 1 is waiting in this stage and build 2 arrives, build 1 is aborted then. At any rate, I should play with the behavior as of the revised demo. |
Right, that way the never deploy syndrome (newer builds always canceling the previous one in a loaded pipeline) is avoided. And this feature is what fixes JENKINS-27039.
Yes, I think I misread your previous comment about the hanging build. The previous version of the Jenkinsfile was ok and works as expected (locking the I'm going back to that version. |
No? I thought this was the designed behavior when the |
No. Maybe we are talking about different things. Correct me if I'm wrong, the use case you exposed in this comment was:
That's not reproducible for me, and if it were, it would be a bug.
Yes, this is right.
Not exactly. In that situation build 2 and 3 will keep queued until build 1 releases the lock (allowed to proceed or not), at that point the newer build waiting for lock will be allowed to go in (as |
No, my use case was
Which I suppose is OK.
Note that in the meantime build 2 would probably have acquired the staging lock and started staging, so it will get canceled in the middle of that somewhere. |
Then yes, that's ok, build 2 has to wait for the lock.
Right. I think it doesn't matter (in this example), otherwise the script needs to be modified as: milestone 1
stage('Staging') {
lock(resource: 'staging-server', inversePrecedence: true) {
node {
servers.deploy 'staging'
}
input message: "Does ${jettyUrl}staging/ look good?"
milestone 2
}
...
} So any older build waiting in |
Yeah, worth exploring. Did you check behavior with checkpoints by the way? |
Yes, basic tests though, it seems to work. Running a checkpoint inside a lock is not reliable (as it was before with |
Downstream of
@reviewbybees