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

setup maven cd workflow #1

Merged
merged 7 commits into from
Jun 13, 2022
Merged

setup maven cd workflow #1

merged 7 commits into from
Jun 13, 2022

Conversation

jetersen
Copy link
Collaborator

@jetersen jetersen commented May 13, 2022

@jetersen
Copy link
Collaborator Author

@lemeurherve who had you intended to review this, with write access 😅

@@ -0,0 +1,65 @@
# Note: additional setup is required, see https://www.jenkins.io/redirect/continuous-delivery-of-plugins
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.github/workflows/maven-cd.yml not sure if maven-cd is the best filename for this workflow

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think is fine

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

although gradle could likely be supported in the same workflow, the actions would just need a flag, it just doesn't support it atm

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gradle CD would need to use a different versioning scheme and it could follow a different flow. I would stick to maven-cd. If and when some Gradle user wishes to introduce their own reusable CD flow, they can figure out how to refactor things to share parts of this one, or not.

@jetersen
Copy link
Collaborator Author

jetersen commented May 13, 2022

@jetersen
Copy link
Collaborator Author

@jglick the question becomes do we want versioning on our reusable workflows?

My suggestion has been to point to main and never look back. Because it allows infra team to fix the workflow if something broke and distribute fixes to workflows faster.

@@ -1,2 +1,3 @@
# github-reusable-workflows

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add an example of calling it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timja
Copy link
Member

timja commented May 13, 2022

@jglick the question becomes do we want versioning on our reusable workflows?

My suggestion has been to point to main and never look back. Because it allows infra team to fix the workflow if something broke and distribute fixes to workflows faster.

pinning to main should be fine for this, you can always pin to a commit if something breaks.

@timja
Copy link
Member

timja commented May 13, 2022

cc @NotMyFault and @olamy who were looking at similar for release drafter and maybe crowdin

@daniel-beck
Copy link

pinning to main should be fine for this, you can always pin to a commit if something breaks.

Better hope you never have to evolve a workflow in a backward incompatible way. Took me just 11 days for jenkins-security-scan 😅

@timja
Copy link
Member

timja commented May 13, 2022

pinning to main should be fine for this, you can always pin to a commit if something breaks.

Better hope you never have to evolve a workflow in a backward incompatible way. Took me just 11 days for jenkins-security-scan 😅

we do the same with buildPlugin.
Generally send PRs to consumers.

Not ideal but a lot less maintenance for maintainers.

Far less dependabot spam

@timja
Copy link
Member

timja commented May 13, 2022

@daniel-beck reminded me that you can move tags around etc.

What he did with security scan was have a v1 tag and then when he did a breaking change he added a v2 tag.

which may be a better option?

@daniel-beck
Copy link

daniel-beck commented May 13, 2022

What he did with security scan was have a v1 tag and then when he did a breaking change he added a v2 tag.

And I kept updating each tag to point to the newest commit that made sense. So some management overhead is involved.

Only makes sense when you have one repo per workflow though.

@jglick
Copy link
Collaborator

jglick commented May 13, 2022

I (probably) would recommend pinning versions for buildPlugin. I do not recommend it here, for the same reason discussed recently w.r.t. foreign GHA in the CD workflow like actions/checkout: the effectiveness of the CD process is only tested if and when you release, so pinning a version would just mean that DB offers updates in PRs which would always pass (assuming no flaky tests or infra) even if they are actually broken.

@jglick
Copy link
Collaborator

jglick commented May 13, 2022

Pinning client repos to @v1 would be fine I guess—we would not expect that to ever be edited, nor would we expect DB to offer a bump to v2.

@jglick
Copy link
Collaborator

jglick commented May 13, 2022

Only makes sense when you have one repo per workflow though.

Either that, or use a orphaned branch per workflow, or include the workflow name in tags.

I tend to agree that using a repo dedicated to this workflow would make more sense from a versioning perspective. Maybe we can just archive this repo and use jenkins-maven-cd-action, as the home of the most salient action in the workflow? In which case the workflow and this third action would share tags?

@daniel-beck
Copy link

daniel-beck commented May 13, 2022

use a orphaned branch per workflow

I expect that may be a barrier to successfully contributing for some people unfamiliar with those; GitHub seems to be pushing "just dump everyone on the default branch" hard. (I may well be wrong though, maintainers seem to handle the weird default orphan branch of private CERT "fork" repos well.)

as the home of the most salient action in the workflow? In which case the workflow and this third action would share tags?

FWIW I considered something like that for jenkins-security-scan and ended up with separate repos for actions and workflows to limit weirdness of version combinations -- which version of each action would be checked out by the workflow? How would I do evolution of the action that requires a corresponding change in the workflow? Having a separate upstream/producer (actions) and downstream/consumer (workflow) seemed more straightforward.

@jetersen
Copy link
Collaborator Author

I would keep this repository and have multiple workflows hosted behind main or v1. No need to make it more complicated. Again I would compare shared pipeline library to reusable workflows.

Keeps maintenance simple and separates consumer and producer as noted by @daniel-beck

@jglick
Copy link
Collaborator

jglick commented May 13, 2022

Keeps maintenance simple

Unless and until we find the need to make some incompatible change to the workflow that would affect so many repos we cannot feasibly update them all promptly enough.

Yes we have avoided any such change to buildPlugin()—we have managed to deprecate some things (javaLevel for example) and roll out changes incrementally. So maybe only a theoretical problem.

@jetersen
Copy link
Collaborator Author

jetersen commented May 13, 2022

Theoretical problem, I am pretty sure we can make something that can also solve that.

Use workflow inputs, create another reusable workflow, ask users to stay on v1 while we move on in v2 or they could self host their special workflow.

This solves a immediate problem. I don't want to speculate too much future problems or never problems.

This is simply hosting a group of actions in a workflow and handling updates dependabot noise, if anything the actions are more likely to run into this issue.

@jglick
Copy link
Collaborator

jglick commented May 13, 2022

create another reusable workflow

Indeed that would be the most straightforward approach.

@jglick
Copy link
Collaborator

jglick commented May 23, 2022

Filed jenkinsci/jenkins-infra-test-plugin#20 as a sanity check. I think we can move ahead with this?

.github/workflows/maven-cd.yml Outdated Show resolved Hide resolved
output_result: true

- name: Release Drafter
uses: release-drafter/release-drafter@v5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could actually pin this to a specific version in the shared workflow: we would get DB bumps, which PRs would not test, but after merging we would be sure to run jenkins-infra-test-plugin again to make sure everything still works.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we talking v5.x.x level of pinning or commit sha pinning? 😅

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant v5.x.x, I am not that paranoid!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I did see a tool recently that let you pin actions to hashes and still get them updated.)

Comment on lines +50 to +55
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up JDK 8
uses: actions/setup-java@v3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@@ -1,2 +1,3 @@
# github-reusable-workflows

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Co-authored-by: Jesse Glick <[email protected]>
@daniel-beck
Copy link

daniel-beck commented May 24, 2022

IIRC both the workflow template as well as the reusable workflow need to declare permissions, otherwise commits from Dependabot will fail the run because the token lacks permissions. See https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#changing-github_token-permissions and jenkins-infra/jenkins-security-scan#7 / jenkinsci/.github#75 for when I did this on Jenkins Security Scan workflows.

Mostly cosmetic here because these are unlikely to create releases, but still FYI.

@jglick
Copy link
Collaborator

jglick commented May 24, 2022

jenkinsci/jenkins-infra-test-plugin#20 (comment) and then https://github.com/jenkinsci/workflow-aggregator-plugin/runs/6573189329?check_suite_focus=true#step:4:14 again failed to create a release, due to what I suspect is a race condition. Can we try introducing a delay between Release Drafter and the interesting categories action?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define reusable workflow
4 participants