-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add gitea release handling #60
Add gitea release handling #60
Conversation
Please fix lint errors |
Should be fixed now |
040e694
to
29a67df
Compare
Is this still a WIP or finished? (asking because there is quite some TODO left in code) |
It's finished. I left the TODO's mostly there to note things for future additions or to match the rest of the file (in case of MockGiteaConnection). |
I would say draft releases should be skipped and removed from this as in the future it's planned that gitea won't issue webhooks for draft releases (go-gitea/gitea#21594) |
Yeah makes sense; will update the PR in the coming days. |
any news on this when it will merged? this change would help us in handling releases with gitea. |
@lafriks are there blockers why this pr is not merged yet? |
f47ebb4
to
1c48085
Compare
Rebased pr to current master |
@Mai-Lapyst @lafriks As mentioned in #67, my apologies for not responding earlier. I received the "review requested" notification back then and simply missed acting upon it after reading it. Reviewing and testing your changes now. |
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.
@Mai-Lapyst Thank you for this great contribution.
It looks like the current implementation does not fully take the "prerelease" flag into account. Instead, scanning the repository triggers all releases anyway. I've suggested changes to fixes that behavior.
And there is something off with publishGiteaAssets
. I am not sure what exactly. Do you have an idea?
src/main/java/org/jenkinsci/plugin/gitea/client/api/GiteaRelease.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jenkinsci/plugin/gitea/tasks/GiteaAssetPublisher.java
Outdated
Show resolved
Hide resolved
9a277ab
to
980f8d7
Compare
Added a additional patch since the generation of the url for fetching releases was still not correct; but this time bc gitea interprets |
8c1beaf
to
0b205f6
Compare
@justusbunsi not to annoy, but plz pretty plz (i'm looking forward to this feature) |
I'll review until the end of week. My daily schedule did not allow rewiewing earlier. Should've commented earlier. 🙂 |
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.
@Mai-Lapyst, thanks for the deep dive regarding asset uploads from local machine. It is working for me now, too. 👍
I've noticed one last detail that should be added in this PR: Commit status informing about the build state of a release - like it's done for tags. It requires a change in GiteaNotifier.java
which is unchanged and I don't know how to suggest the changes in unchanged files via GitHub UI. So here are my suggestions for this missing part. As soon as release builds send their status to Gitea: This PR is going to LGTM 😃
diff --git a/src/main/java/org/jenkinsci/plugin/gitea/GiteaNotifier.java b/src/main/java/org/jenkinsci/plugin/gitea/GiteaNotifier.java
index 23ee4a3..eb45482 100644
--- a/src/main/java/org/jenkinsci/plugin/gitea/GiteaNotifier.java
+++ b/src/main/java/org/jenkinsci/plugin/gitea/GiteaNotifier.java
@@ -132,6 +132,11 @@ public class GiteaNotifier {
status.getState().name(), status.getDescription());
hash = ((TagSCMRevision) revision).getHash();
statusContext += "tag";
+ } else if (revision instanceof ReleaseSCMRevision) {
+ listener.getLogger().format("[Gitea] Notifying release build status: %s %s%n",
+ status.getState().name(), status.getDescription());
+ hash = ((ReleaseSCMRevision) revision).getHash();
+ statusContext += "release";
} else {
return;
}
@@ -237,6 +242,10 @@ public class GiteaNotifier {
LOGGER.log(Level.INFO, "Notifying tag pending build {0}", job.getFullName());
statusContext += "tag";
hash = ((TagSCMRevision) revision).getHash();
+ } else if (revision instanceof ReleaseSCMRevision) {
+ LOGGER.log(Level.INFO, "Notifying release pending build {0}", job.getFullName());
+ statusContext += "release";
+ hash = ((ReleaseSCMRevision) revision).getHash();
} else {
return;
}
@justusbunsi Have added the requested changes; should work now :) |
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.
🎉
This PR adds the ability to discover releases in gitea as "branches" to be build seperatly.
It also adds an task for pipelines ("publishGiteaAssets") which works a little like copyArtifacts but uploads artifacts as an asset to the current building release.
The PR also contains an (toggleable) feature to "map" artifacts originally created via copyArtifacts to gitea release assets.
Relevant issues: