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

Actions Artifacts v4 backend #2224

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft

Actions Artifacts v4 backend #2224

wants to merge 11 commits into from

Conversation

ChristopherHX
Copy link
Contributor

@ChristopherHX ChristopherHX commented Feb 19, 2024

A pretty insecure backport with stubs and removed checks

I'm the original author of most code in artifacts_v4.go and the dumped proto code

jwt code is from the gitea project

Use at your own risk

If you want tests, someone else need to take this over.

Tests for the full Gitea Implementation can be found here: go-gitea/gitea#28965

Fixes #2135

dumped proto file has been deleted, because I'm not going to make changes to that file to satisfy the linter

Copy link
Contributor

github-actions bot commented Feb 19, 2024

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ EDITORCONFIG editorconfig-checker 9 0 0.05s
✅ REPOSITORY gitleaks yes no 2.33s
✅ REPOSITORY git_diff yes no 0.01s
✅ REPOSITORY grype yes no 7.61s
✅ REPOSITORY secretlint yes no 1.07s
✅ REPOSITORY trivy-sbom yes no 0.63s
✅ REPOSITORY trufflehog yes no 6.52s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

@ChristopherHX
Copy link
Contributor Author

ChristopherHX commented Feb 19, 2024

@TWiStErRob @zdenardi it's now your turn to test this if this satisfies your needs.

The following works (* christopherhx/gitea- works on GHES (currently only gitea), for GitHub.com you can use the official actions)

on:
  push:
jobs:
  _5:
    runs-on: ubuntu-latest
    steps: 
    - run: env
    - run: |
        github:
        ${{ tojson(github) }}
        inputs:
        ${{ tojson(inputs) }}
        matrix:
        ${{ tojson(matrix) }}
        needs:
        ${{ tojson(needs) }}
        strategy:
        ${{ tojson(strategy) }}            
      shell: cp {0} context.txt
    - uses: christopherhx/gitea-upload-artifact@v4
      with:
        name: test
        path: context.txt

    - uses: christopherhx/gitea-download-artifact@v4
      with:
        name: test
        path: out
    - run: cat out/context.txt

For anything else someone need to take this over. I'm more satisfied by full client + server reimplementations of actions with authentication, instead of a pseudo server like for act cli.

Copy link

codecov bot commented Feb 19, 2024

Codecov Report

Attention: Patch coverage is 41.61162% with 442 lines in your changes are missing coverage. Please review.

Project coverage is 73.29%. Comparing base (5a80a04) to head (76ee2d1).
Report is 43 commits behind head on master.

Files Patch % Lines
pkg/artifacts/artifact.pb.go 24.43% 358 Missing and 7 partials ⚠️
pkg/artifacts/arifacts_v4.go 72.56% 38 Missing and 24 partials ⚠️
pkg/common/auth.go 69.04% 7 Missing and 6 partials ⚠️
pkg/runner/run_context.go 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2224       +/-   ##
===========================================
+ Coverage   61.56%   73.29%   +11.73%     
===========================================
  Files          53       62        +9     
  Lines        9002     8262      -740     
===========================================
+ Hits         5542     6056      +514     
+ Misses       3020     1645     -1375     
- Partials      440      561      +121     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TWiStErRob
Copy link

Awesome! I can confirm this works (I grabbed the executable artifact from https://github.com/nektos/act/actions/runs/7959602137).
Will need to adjust some scripts because of the way artifact upload works, but looks as expected:

Before After
image image image

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

Successfully merging this pull request may close these issues.

Research about actions/upload-artifact@v4 and actions/download-artifact@v4
2 participants