Skip to content
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

Keep the plugin list up to date when building the Docker image #45

Closed
gounthar opened this issue Jun 22, 2023 · 9 comments · Fixed by #165
Closed

Keep the plugin list up to date when building the Docker image #45

gounthar opened this issue Jun 22, 2023 · 9 comments · Fixed by #165
Labels
enhancement New feature or request question Further information is requested
Milestone

Comments

@gounthar
Copy link
Collaborator

gounthar commented Jun 22, 2023

For the time being, we're calling RUN jenkins-plugin-cli --plugin-file /usr/share/jenkins/ref/plugins.txt when building the image.
What about adding options, so we get an updated list of plugins before installing them?

jenkins-plugin-cli --plugin-file /usr/share/jenkins/plugins.txt --no-download --available-updates --output txt

That would give something like:

FROM jenkins/jenkins:2.401.1-lts
USER jenkins
RUN echo "2.0" > /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state

# Copy the plugins.txt file into the Docker image
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt

# Update the plugins.txt file with the latest available versions
RUN jenkins-plugin-cli --plugin-file /usr/share/jenkins/ref/plugins.txt --no-download --available-updates --output txt > /tmp/updated-plugins.txt && mv /tmp/updated-plugins.txt /usr/share/jenkins/ref/plugins.txt

# Install the updated plugins
RUN jenkins-plugin-cli --plugin-file /usr/share/jenkins/ref/plugins.txt


COPY jenkins.yaml /var/jenkins_home/casc_configs/jenkins.yaml
ENV CASC_JENKINS_CONFIG /var/jenkins_home/casc_configs/jenkins.yaml

@ash-sxn @berviantoleo @jmMeessen what do you think about that?

@ash-sxn
Copy link
Owner

ash-sxn commented Jun 22, 2023

So In the future, if anything breaks because of an update in the plugins, We'll be able to track back which plugin was last updated and broke things, right?

@gounthar
Copy link
Collaborator Author

I'm not so sure that's the case unless we commit and push as soon as the plugin list changes...
To me, that's a kind of (nice) band-aid until we get something like updatecli to take care of the updates.

@ash-sxn
Copy link
Owner

ash-sxn commented Jun 22, 2023

Okaay, I understand now

@berviantoleo
Copy link
Collaborator

berviantoleo commented Jun 22, 2023

What about adding options, so we get an updated list of plugins before installing them?

I disagree with this a bit. I think it will introduce some breaking plugins. Except, if updated to a minor version. Am I right?

Or, do you recommend taking the plugins.txt after building the image?

@gounthar
Copy link
Collaborator Author

gounthar commented Jun 22, 2023

You can always introduce breaking changes when updating plugins without thoroughly reviewing the changelogs.
I personally prefer to have up-to-date plugins, even if there's a risk of something breaking, rather than using outdated plugins with potential vulnerabilities.

I understand that this is a matter of preference and open to discussion.

The infra team does it this way:
https://github.com/jenkins-infra/docker-jenkins-lts/actions/runs/5354939180/workflow
https://github.com/jenkins-infra/docker-jenkins-lts/blob/main/bin/update-plugins.sh

@gounthar gounthar added enhancement New feature or request question Further information is requested labels Jun 26, 2023
@gounthar gounthar added this to the Second GSoC term milestone Jun 26, 2023
@gounthar gounthar modified the milestones: Second GSoC term, Week 30 Jul 6, 2023
@gounthar
Copy link
Collaborator Author

gounthar commented Jul 7, 2023

@MarkEWaite proposed an up-to-date plugin list for the second example in #96.
He also proposed two scripts, one in bash and one in python to integrate into our Dockerfile.
I also have a script that does more or less the same. It was inspired by work from the infra team.

@MarkEWaite
Copy link
Contributor

I also have a script that does more or less the same. It was inspired by work from the infra team.

That looks much better suited to the automation needs of the project than my interactive scripts. Nicely done!

@gounthar
Copy link
Collaborator Author

gounthar commented Jul 7, 2023

Thanks a lot, Mark, I do appreciate it. 🤗
It had to be automated because I use it to create automatic pull requests to keep my project up to date. 🤷

@gounthar
Copy link
Collaborator Author

gounthar commented Aug 7, 2023

As per today's meeting, the update could happen within the existing testing GitHub Action, or in a Jenkinsfile, or even thanks to updatecli, but it would be better to create a new GitHub Action with a bash script.
In a GitHub Action, we already have the gh tool, the right variables that will allow us to easily create a PR, and we already have the building blocks to get a Jenkins instance working, ready to be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants