Asset server implementation (#677)

* Add asset server and upload handling of binary files

Co-authored-by: Björn Brauer <[email protected]>

* Add asset download parts to the asset server

Co-authored-by: Björn Brauer <[email protected]>

* Add artifact-server-path flag

If the flag is not defined, the artifact server isn't started.
This includes the configuration of ACTIONS_RUNTIME_URL and
ACTIONS_RUNTIME_TOKEN which are set if the server is started.

Co-authored-by: Björn Brauer <[email protected]>

* Move ACTIONS_RUNTIME_* vars into the withGithubEnv setup

Co-authored-by: Björn Brauer <[email protected]>

* feat: add artifact server port as flag

This commits adds a flag to define the artifact server port.
If not given, the port defaults to 34567.

Co-authored-by: Björn Brauer <[email protected]>

* test: add artifact server tests

Co-authored-by: Björn Brauer <[email protected]>

* refactor: use fs.FS

This allows to add tests with in-memory file system

* feat: add support for gzip encoded uploads

Co-authored-by: Björn Brauer <[email protected]>

* test: add artifact integration test

* chore: run act tests with asset server path

Co-authored-by: Björn Brauer <[email protected]>

* docs: add new cli flags

Co-authored-by: Björn Brauer <[email protected]>

* test: add test workflow to testdata

* feat: add log output

* refactor: log shutdown error instead of panic

* feat: use outbound ip for the asset server

This change should allow to use the host ip in macos and windows.
Since docker is running in an intermediate vm, localhost is not
sufficient to have the artifacts in the host system.

* fix: do not use canceled context

To shutdown artifact server, we should not use the already canceled
context but the parent context instead.

Co-authored-by: Björn Brauer <[email protected]>

* feat: shutdown artifact server at end of pipeline

When the pipeline is done the asset server should be shut down
gracefully.

Co-authored-by: Björn Brauer <[email protected]>

* fix: close server if graceful shutdown failed

Co-authored-by: Björn Brauer <[email protected]>

* fix: ignore server closed error from listen call

Co-authored-by: Björn Brauer <[email protected]>

Co-authored-by: Björn Brauer <[email protected]>
Co-authored-by: Björn Brauer <[email protected]>
This commit is contained in:
Markus Wolf
2021-11-10 09:57:22 -08:00
committed by GitHub
co-authored by Björn Brauer Björn Brauer
parent f8b3563102
commit 11f6ee37a6
12 changed files with 775 additions and 2 deletions
+1
View File
@@ -18,6 +18,7 @@ require (
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/joho/godotenv v1.4.0
github.com/julienschmidt/httprouter v1.3.0
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/kevinburke/ssh_config v1.1.0 // indirect
github.com/mattn/go-colorable v0.1.9 // indirect