-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Artifacts download api for artifact actions v4 #33510
Artifacts download api for artifact actions v4 #33510
Conversation
* download endpoint has to use 302 redirect * fake blob download used if direct download not possible * downloading v3 artifacts not possible New apis based on GitHub Rest V3 /runs/{run}/artifacts (Cannot use run index of url due to not beeing unique) /artifacts /artifacts/{artifact_id}/zip
usage in on: push
jobs:
test:
runs-on: mac-docker
steps:
- uses: christopherhx/gitea-download-artifact@v4
with:
name: mygithub-context
github-token: ${{ secrets.GITHUB_TOKEN }} # token with actions:read permissions on target repo
#repository: actions/toolkit
run-id: 4 # To get this id could be a challenge, in github.com it's part of the web ui url, we only have a run_number / index
- run: ls -l
- run: cat file.txt |
IIRC, this is a outstanding bug that the swagger command sometimes introduces platform-specific line-endings. I think we need to normalize the file. |
Could there be some tests to cover the newly added APIs? |
|
||
func DownloadArtifactV4ServeDirectOnly(ctx *context.Base, art *actions_model.ActionArtifact) (bool, error) { | ||
if setting.Actions.ArtifactStorage.ServeDirect() { | ||
u, err := storage.ActionsArtifacts.URL(art.StoragePath, art.ArtifactPath, nil) |
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 think this err
should be returned if it's not nil
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.
You are right, currently the error return value seems to be accidentally not returned.
But I want to make sure we get the expected behavior here, therefore I want some discussion about this before making changes
If we just return the error here (without changing the callers), this error may get returned by the api instead of triggering the fallback ( tunneling blob via gitea ).
What do we want to do with this error?
- Return it from the api and abort the request? (needs changes)
- Try the fallback and fail if the fallback doesn't work? (current behavior)
- Log the error from the caller and continue with the fallback? if the boolean returns false (...and return the error from api if it returns true) (needs changes)
- Otherwise Remove the error return value from the function? (needs changes)
- Most ServeDirect() paths I saw in gitea dropped the error and only used it to detect if the url has been returned without error e.g. search for text
ServeDirect
in this repo
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 think it's fine to keep as other behaviors, no need to introduce too many changes at the moment.
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.
Yes. I think it's OK to keep the current behavior. Maybe we can add some logs for this error later to help us debug cases where SERVE_DIRECT
doesn't work.
* giteaofficial/main: Add API to support link package to repository and unlink it (go-gitea#33481) [skip ci] Updated translations via Crowdin Update JS and PY dependencies (go-gitea#33587) [chore] add git mailmap for proper attribution of authorship (go-gitea#33612) Move commits signature and verify functions to service layers (go-gitea#33605) add spacing between sign in button's icon and text (go-gitea#33609) enable literal string for code search (go-gitea#33590) [skip ci] Updated translations via Crowdin Artifacts download api for artifact actions v4 (go-gitea#33510) Fix bug when get commit (go-gitea#33602) Fix mirror bug (go-gitea#33597) Fix typo in HTML attribute (go-gitea#33599) Use default Git timeout when checking repo health (go-gitea#33593) Improve commits list performance to reduce unnecessary database queries (go-gitea#33528) Performance optimization for pull request files loading comments attachments (go-gitea#33585) Fix PR's target branch dropdown (go-gitea#33589)
New repo apis based on GitHub Rest V3
Closes #33353
Closes #32124