[PR #677] [MERGED] Asset server implementation #1554

Closed
opened 2026-03-01 21:51:40 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/677
Author: @KnisterPeter
Created: 5/7/2021
Status: Merged
Merged: 11/10/2021
Merged by: @cplee

Base: masterHead: asset-server


📝 Commits (10+)

  • 54af35e Add asset server and upload handling of binary files
  • d4c3765 Add asset download parts to the asset server
  • 7f91c09 Add artifact-server-path flag
  • 77a658b Move ACTIONS_RUNTIME_* vars into the withGithubEnv setup
  • 7286ebb feat: add artifact server port as flag
  • 6ccf702 test: add artifact server tests
  • 0d37f5a refactor: use fs.FS
  • 33a34c0 feat: add support for gzip encoded uploads
  • 29a2504 test: add artifact integration test
  • 161909a chore: run act tests with asset server path

📊 Changes

12 files changed (+775 additions, -2 deletions)

View changed files

📝 README.md (+3 -0)
📝 cmd/input.go (+2 -0)
📝 cmd/root.go (+12 -1)
📝 go.mod (+1 -0)
📝 go.sum (+2 -0)
pkg/artifacts/server.go (+278 -0)
pkg/artifacts/server_test.go (+296 -0)
pkg/artifacts/testdata/upload-and-download/artifacts.yml (+140 -0)
pkg/common/outbound_ip.go (+21 -0)
📝 pkg/runner/run_context.go (+18 -0)
📝 pkg/runner/runner.go (+2 -0)
pkg/runner/testdata/actions/node12/.gitignore (+0 -1)

📄 Description

Description

This PR contains a naive github-actions (partially-)compatible asset server.

We only reverse engineered the success case.
The implementation is based on the awesome work of @anthonykawa: https://github.com/anthonykawa/artifact-server

This implementation should be seen as a draft and requires an architecture/design review.

Missing things

  • CLI flags for configuration (port, asset path)
  • Server start need to be integrated properly into the runner (we do start it for all commands currently)
  • Tests
  • Add docs

Prerequisites

  • --env ACTIONS_RUNTIME_URL=http://localhost:8080/ must be set because it's internally used by the @action/toolkit
  • --env ACTIONS_RUNTIME_TOKEN=foo must be set (we do not have authentication implemented)

This should ideally be implemented (either as port of this PR or #329), so users don't need to set it on their own.

These variables are set if act is started with --artifact-server-path and configured for the internal server.
It is also possible to define them as environment variables using --env for an external artifact-server.

Relates to #329

--

Closes #169


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nektos/act/pull/677 **Author:** [@KnisterPeter](https://github.com/KnisterPeter) **Created:** 5/7/2021 **Status:** ✅ Merged **Merged:** 11/10/2021 **Merged by:** [@cplee](https://github.com/cplee) **Base:** `master` ← **Head:** `asset-server` --- ### 📝 Commits (10+) - [`54af35e`](https://github.com/nektos/act/commit/54af35e8f8cc38e22ef346d8e673cd8d9804eac2) Add asset server and upload handling of binary files - [`d4c3765`](https://github.com/nektos/act/commit/d4c37655ad3b7fa25cb6989ddecc2828847c1030) Add asset download parts to the asset server - [`7f91c09`](https://github.com/nektos/act/commit/7f91c0999b96fc1c3ff906c3dd38bdda2351f6be) Add artifact-server-path flag - [`77a658b`](https://github.com/nektos/act/commit/77a658b5648702065e324c52b7daf12708b4c417) Move ACTIONS_RUNTIME_* vars into the withGithubEnv setup - [`7286ebb`](https://github.com/nektos/act/commit/7286ebb21628af6edd494c4010446cbb47b69451) feat: add artifact server port as flag - [`6ccf702`](https://github.com/nektos/act/commit/6ccf7029f92b419c7630b7fc57219349f9d50b52) test: add artifact server tests - [`0d37f5a`](https://github.com/nektos/act/commit/0d37f5a143076315e470e078e1b14220bbdfb15e) refactor: use fs.FS - [`33a34c0`](https://github.com/nektos/act/commit/33a34c0deaa2fa6fcc122a3472b3c4905ce2a9c6) feat: add support for gzip encoded uploads - [`29a2504`](https://github.com/nektos/act/commit/29a2504c2118e0c7b6fd1a454e75f57ea01df18c) test: add artifact integration test - [`161909a`](https://github.com/nektos/act/commit/161909ab88780e289d97ba0b69687e2206e73b27) chore: run act tests with asset server path ### 📊 Changes **12 files changed** (+775 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+3 -0) 📝 `cmd/input.go` (+2 -0) 📝 `cmd/root.go` (+12 -1) 📝 `go.mod` (+1 -0) 📝 `go.sum` (+2 -0) ➕ `pkg/artifacts/server.go` (+278 -0) ➕ `pkg/artifacts/server_test.go` (+296 -0) ➕ `pkg/artifacts/testdata/upload-and-download/artifacts.yml` (+140 -0) ➕ `pkg/common/outbound_ip.go` (+21 -0) 📝 `pkg/runner/run_context.go` (+18 -0) 📝 `pkg/runner/runner.go` (+2 -0) ➖ `pkg/runner/testdata/actions/node12/.gitignore` (+0 -1) </details> ### 📄 Description # Description This PR contains a naive github-actions (partially-)compatible asset server. We only reverse engineered the success case. The implementation is based on the awesome work of @anthonykawa: https://github.com/anthonykawa/artifact-server This implementation should be seen as a draft and requires an architecture/design review. ## Missing things - [x] CLI flags for configuration (port, asset path) - [x] Server start need to be integrated properly into the runner (we do start it for all commands currently) - [x] Tests - [x] Add docs ## Prerequisites - [x] `--env ACTIONS_RUNTIME_URL=http://localhost:8080/` must be set because it's internally used by the `@action/toolkit` - [x] `--env ACTIONS_RUNTIME_TOKEN=foo` must be set (we do not have authentication implemented) ~This should ideally be implemented (either as port of this PR or #329), so users don't need to set it on their own.~ These variables are set if act is started with `--artifact-server-path` and configured for the internal server. It is also possible to define them as environment variables using `--env` for an external artifact-server. Relates to #329 -- Closes #169 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 21:51:40 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#1554
No description provided.