-
Notifications
You must be signed in to change notification settings - Fork 321
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
Unify Jenkins pipelines, inline scripts and add full-build launch-config #2620
base: main
Are you sure you want to change the base?
Conversation
Jenkinsfile
Outdated
-PuseJenkinsSnapshots \ | ||
-Dtarget-platform-classifier=xtext-${selectedTargetPlatform()} \ | ||
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ | ||
-DaltDeploymentRepository=local::file:./build/maven-repository |
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.
In the script the value was -DaltDeploymentRepository=local::default::file:./build/maven-repository
, but Maven emitted a deprecation warning, therefore I changed that to the recommended value.
Jenkinsfile
Outdated
${javaVersion() == 17 ? '' : '--toolchains releng/toolchains.xml -Pstrict-release-jdk'} | ||
mvn -f org.eclipse.xtext.full.releng --batch-mode clean deploy \ | ||
${javaVersion() == 17 ? '' : '--toolchains releng/toolchains.xml -Pstrict-release-jdk'} \ | ||
-PuseJenkinsSnapshots \ |
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.
The full-build script also defined -Dit-archetype-tests-skip=true
, but that is actually not necessary because that variable is initialized with true.
The same applies for the full-deploy script inlined below.
jenkins/deploy/Jenkinsfile
Outdated
triggers { // https://jenkins.io/doc/book/pipeline/syntax/#triggers | ||
cron('50 21 * * *') // nightly at 21:50 | ||
} | ||
|
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.
I tested this in my local Jenkins instance and it worked as desired. The job run automatically at the specified time with DEPLOYMENT_TYPE=nightly
, and if one trigger an execution manually one has to choose one of the available parameter values.
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.
Rather than doing nightly builds at a fixed schedule, should we do continuous deployment whenever something's merged into main, @cdietrich ?
Not necessarily in the scope of this ticket, though @HannesWell
@HannesWell sorry for the delay. I think this PR can be used to clean up a few things you have already detected. BUT:
The two Jenkinsfiles and the script I'm also against inlining the script files as I had already said. Of course, we have to head from @cdietrich and @szarnekow , but just to stress that again (with smile, of course), I'll be strongly against merging the Jenkinsfiles. |
i prefer separate Jenkinsfiles. |
60d6c23
to
c52e28f
Compare
Personally I would still say that even the merged pipeline has a single responsibility: It deploys the xtext artifacts. I would consider the type of deployment a parameter, as it already is for the milestone-deploy workflow. I it is right that the merged pipeline has to be tested, but I don't expect it to be too complicated since the commands within the pipeline are not changed but only the triggers are changed. I can offer to test and demonstrate you that the changed parts work in the M2E Jenkins instance. The entire pipeline does not have to be tested since it did not change.
Yes, that's why this stage is guarded with a corresponding
I understand that the pipeline before the repo merge was too complex and that you don't want to go back there. But personally I would say that the suggested change is far from that. Having two different pipelines increases the maintains costs on the long run because every change you do to one pipeline you probably also have to apply to the other one. And if you really want to test all changes before (which is good) you have to test two pipelines instead of one.
The downside of just documenting the commands is that it can easily become outdated. The good thing about a launch-config is that it is executable. If regularly used one will notice discrepancies quite quickly and one will remember to change it more likely.
I hope I made my points clear, if you nevertheless prefer to keep most of it as it is, I'm fine with stop discussing if you want to save your time. |
@HannesWell, sorry for the delay. Releasing nightly, a milestone, or an official release are different tasks; for this reason, I really prefer to have separate Jenkinsfiles, which are much easier to test. Having conditionals makes everything harder to maintain and test. As I said, also the launch configuration does not look good to me, and for the moment I'd do without it. I'd keep
|
Can you please elaborate what exactly does not look good in the launch config? At the moment it reflects the full-build script.
OK, I'll update this PR accordingly (but probably not before next week). Which scripts can then be removed exactly? |
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.
Submitting a bunch of older comments
jenkins/deploy/Jenkinsfile
Outdated
steps { | ||
sh './scripts/prepare-for-milestone.sh ${RELEASE_TYPE}' | ||
sh './scripts/prepare-for-milestone.sh ${DEPLOYMENT_TYPE}' |
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.
To be honest, I find the terminology milestone
here a bit confusing since it's for every release
being it milestone, rc, or ga. Not actionable though.
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.
@szarnekow see also #2657
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.
To be honest, I find the terminology
milestone
here a bit confusing since it's for everyrelease
being it milestone, rc, or ga. Not actionable though.
In fact, I want to keep releasing of milestones and actual releases separate.
jenkins/deploy/Jenkinsfile
Outdated
triggers { // https://jenkins.io/doc/book/pipeline/syntax/#triggers | ||
cron('50 21 * * *') // nightly at 21:50 | ||
} | ||
|
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.
Rather than doing nightly builds at a fixed schedule, should we do continuous deployment whenever something's merged into main, @cdietrich ?
Not necessarily in the scope of this ticket, though @HannesWell
@@ -14,7 +14,12 @@ pipeline { | |||
stages { | |||
stage('Maven Tycho Build and Sign') { | |||
steps { | |||
sh './tycho-sign.sh' | |||
sh ''' |
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.
@LorenzoBettini what is the idea behind the other-experiements
folder? Is it supposed to stay or become obsolete prospectively?
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.
They are to be considered obsolete! I forgot to remove them
@HannesWell We (as in: committers on this project) came to the conclusion that we prefer the separate Jenkinsfiles for the builds rather than the single merged Jenkinsfile. We know that others might have chosen differently, but we are more confident with the current split. The same holds true for the existing shell scripts. Rather than inlining them into the Jenkinsfile, we prefer them to be available as shell scripts that can be called from the command line. Here, we accept the limitations that you mentioned: These might not work on Windows / for all users, and some environment variables might be missing in the average case. But generally, this is the setup we'd like to move forward with. For sure, we are grateful for your input, and proposed changes might be considered in some other future that we don't know yet, but as of now, we'd like to keep the individual Jenkinsfiles and their accompanying scripts. |
Yes, that's fine. It would not have been my choice (surprise), but I accept your decision.
For me this is a good proposal. We do that in m2e and it works quite well and is actually not too complicated: But at least in m2e we have the deployment script in the Jenkinsfile in contrast to Xtext where the deployment is specified pom.xml of the repos (if I have not misunderstood it). So depending on how that should be done it might require some rework. Performing the deployment on each push would probably make the question about merging the nightly- and release-deploy pipeline obsolete, since it probably has to be done as part of the 'main' pipeline then. |
Please note the deployment of milestone and release to maven central needs manual closing of staged repo |
c52e28f
to
5453bc2
Compare
I now reduced the PR to the changes you requested.
If you use the |
5453bc2
to
cdef55a
Compare
yes. nightly builds are deployed automatically anyway |
According to the logs for the failing project the maven-deploy-plugin version 2.7 is used. The reason is that for that bom project the deploy-plugin has its version not explicitly configured and for maven 3.8.6 2.7 is the default binding's version. In the latest Maven 3.9.2 release the default version of the maven-deploy-plugin is set to 3.1.0, which would be used in this case and work with the new format. Therefore I suggest to update to the latest Maven version. When searching the Xtext repo for usages of the deploy-plugin I stumbled upon (the xtext/org.eclipse.xtend.maven.parent/pom.xml Lines 58 to 73 in 18216f4
I wonder what the purpose of that part is? Is it to test that the deploy-plugin is really pinned to version If that's correct, I suggest to just remove the enforcer-plugin call here and would inherit the m-deploy/install-plugin version from the xtext-parent and do the same for The root pom.xml defines the version of maven-deploy-plugin as 3.0.0 and for the maven-install-plugin as 3.1.0. |
Unfortunately, the BOM has no relation with the parent POM, so, for now, we should replicate a few plugin versions/configurations in the BOM, or things like the ones you described happen. This is required until a relationship is established between the BOM and the parent, but I still have to work on that. Updating to Maven 3.9.2 is to be postponed due to the problems we'd have in GitHub Actions for macOS. In general, anyway, it's best to pin versions of standard plugins (IIRC, Maven 4 will enforce that or the build will fail), and not rely on the ones provided by the current version of Maven. Maybe the enforcer part could be removed now. I don't know why it's there, but it looks like it's due to old issues. Currently, "deploy at end" is not used. I'll try to address these issues in another PR. |
To be able to test releases and milestones, we removed the use of nexus staging plugin. When you deploy snapshots there's no additional staging going on: snapshots will be deployed immediately. |
I really want to keep the deployment logic in POM only and avoid additional scripts for the deployment. If we want to deploy (p2 and Maven snapshots) when something is pushed to |
Or even better: in the additional stage that should run only on |
@HannesWell please cherry pick this commit 0698ae1 on this PR; it should fix the problem. |
@HannesWell that commit is now on master. I'm retriggering the job for your PR, which now should work. |
cdef55a
to
87014c5
Compare
Thanks @LorenzoBettini and sorry for the late action, I didn't have access to the right computer over the day. Just rebased the branch on top of main, since your re-trigger seems to not have been merged with the main in Jenkins. |
Yes that's right, pinning is even better. Btw. there are new versions available. |
What do you think about moving the gpg keyring setup into a script and reference it from the xtext/jenkins/nightly-deploy/Jenkinsfile Lines 39 to 40 in d84f253
xtext/jenkins/milestone-deploy/Jenkinsfile Lines 51 to 52 in d84f253
|
87014c5
to
8381ac8
Compare
@LorenzoBettini is that or this PR in general of interest or should it be abandoned? |
@HannesWell maybe moving the gpg stuff into a separate script could be useful. |
This PR is a suggestion to merge the deployment Jenkins pipelines of Xtext as already mentioned in #2224 and to inline the scripts called in them.
The initial reaction was a bit reluctant, nevertheless I think the suggested changes would have the following advantages:
To ease local execution of Xtext's maven build I added a M2E Maven launch config for the full-build.
If you want to have configs for other scenarios (maven only, p2 only) I can of course add them.
Of course the (probably) two Jenkins jobs that use the merged Pipelines have to be merged too.
The two commits should not be squashed. Otherwise git will not record the renaming
jenkins/milestone-deploy/Jenkinsfile → jenkins/deploy/Jenkinsfile
.