diff --git a/.github/workflows/test-container.yml b/.github/workflows/test-container.yml index e7ae258..2ea1498 100644 --- a/.github/workflows/test-container.yml +++ b/.github/workflows/test-container.yml @@ -21,7 +21,7 @@ jobs: container: ${{ matrix.container }} steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - uses: ./ with: show_env: 'true' @@ -43,7 +43,7 @@ jobs: FILENAME: random-file BLOCKS: 128 # 128MB steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: ./ with: show_env: 'true' diff --git a/.github/workflows/test-default.yml b/.github/workflows/test-default.yml index 895e7d1..46fdfaa 100644 --- a/.github/workflows/test-default.yml +++ b/.github/workflows/test-default.yml @@ -18,7 +18,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 # expectation: this is just a noop on managed runners - uses: ./ - run: sleep 30 @@ -32,6 +32,6 @@ jobs: runs-on: runs-on=${{ github.run_id }}/cpu=2/family=m7/image=${{ matrix.image }} steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - uses: ./ - run: sleep 30 \ No newline at end of file diff --git a/.github/workflows/test-magic-cache.yml b/.github/workflows/test-magic-cache.yml index 0ab9e03..394a19c 100644 --- a/.github/workflows/test-magic-cache.yml +++ b/.github/workflows/test-magic-cache.yml @@ -21,7 +21,7 @@ jobs: FILENAME: random-file BLOCKS: 128 # 128MB steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: ./ - name: Generate file @@ -56,7 +56,7 @@ jobs: # END ARTEFACT # DOCKER GHA CACHE - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: repository: dockersamples/example-voting-app path: apps diff --git a/.github/workflows/test-metrics.yml b/.github/workflows/test-metrics.yml index 4052b5f..e3b0a8b 100644 --- a/.github/workflows/test-metrics.yml +++ b/.github/workflows/test-metrics.yml @@ -20,7 +20,7 @@ jobs: configuration: ["existing-aws-creds", "no-aws-creds", "cw-agent-stopped"] runs-on: runs-on=${{ github.run_id }}/cpu=2/family=m7/image=${{ matrix.image }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: configure aws credentials if: matrix.configuration == 'existing-aws-creds' uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 diff --git a/.github/workflows/test-sccache.yml b/.github/workflows/test-sccache.yml index 575250b..c15bfca 100644 --- a/.github/workflows/test-sccache.yml +++ b/.github/workflows/test-sccache.yml @@ -14,7 +14,7 @@ jobs: runs-on: runs-on=${{ github.run_id }}/runner=2cpu-linux-x64/extras=s3-cache steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@stable diff --git a/internal/cache/cache.go b/internal/cache/cache.go index 8e6c809..a8310b4 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -8,8 +8,9 @@ import ( "github.com/sethvargo/go-githubactions" ) -// UpdateZctionsConfig sends a PUT request if ZCTIONS_RESULTS_URL is set. -func UpdateZctionsConfig(action *githubactions.Action, actionsResultsURL string, zctionsResultsURL string) { +// UpdateZctionsConfig sends the original GitHub backend URLs and runtime token +// to the local RunsOn cache service. The token is intentionally never logged. +func UpdateZctionsConfig(action *githubactions.Action, actionsResultsURL string, zctionsResultsURL string, zctionsCacheURL string, actionsRuntimeToken string) { if zctionsResultsURL == "" { return } @@ -19,6 +20,12 @@ func UpdateZctionsConfig(action *githubactions.Action, actionsResultsURL string, // Send the ZCTIONS_RESULTS_URL value under the key 'ACTIONS_RESULTS_URL'. // This value is only known by the GitHub Actions runner, and is needed by the RunsOn agent cache proxy to handle artefacts caching. data.Set("ACTIONS_RESULTS_URL", zctionsResultsURL) + if zctionsCacheURL != "" { + data.Set("ACTIONS_CACHE_URL", zctionsCacheURL) + } + if actionsRuntimeToken != "" { + data.Set("ACTIONS_RUNTIME_TOKEN", actionsRuntimeToken) + } req, err := http.NewRequest(http.MethodPut, configURL, strings.NewReader(data.Encode())) if err != nil { diff --git a/internal/config/config.go b/internal/config/config.go index b7447dc..267b008 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -11,14 +11,16 @@ import ( // Config holds the action's configuration values derived from inputs and environment. type Config struct { - ShowEnv bool - ShowCosts string - Metrics []string - NetworkInterface string - DiskDevice string - Sccache string - ZctionsResultsURL string - ActionsResultsURL string + ShowEnv bool + ShowCosts string + Metrics []string + NetworkInterface string + DiskDevice string + Sccache string + ZctionsResultsURL string + ZctionsCacheURL string + ActionsResultsURL string + ActionsRuntimeToken string } type Tag struct { @@ -62,7 +64,9 @@ func NewConfigFromInputs(action *githubactions.Action) (*Config, error) { cfg.Sccache = action.GetInput("sccache") cfg.ZctionsResultsURL = os.Getenv("ZCTIONS_RESULTS_URL") + cfg.ZctionsCacheURL = os.Getenv("ZCTIONS_CACHE_URL") cfg.ActionsResultsURL = os.Getenv("ACTIONS_RESULTS_URL") + cfg.ActionsRuntimeToken = os.Getenv("ACTIONS_RUNTIME_TOKEN") action.Infof("Input 'show_env': %t", cfg.ShowEnv) action.Infof("Input 'show_costs': %s", cfg.ShowCosts) @@ -76,6 +80,16 @@ func NewConfigFromInputs(action *githubactions.Action) (*Config, error) { } else { action.Infof("ZCTIONS_RESULTS_URL is not set.") } + if cfg.ZctionsCacheURL != "" { + action.Infof("ZCTIONS_CACHE_URL is set: %s", cfg.ZctionsCacheURL) + } else { + action.Infof("ZCTIONS_CACHE_URL is not set.") + } + if cfg.ActionsRuntimeToken != "" { + action.Infof("ACTIONS_RUNTIME_TOKEN is set.") + } else { + action.Infof("ACTIONS_RUNTIME_TOKEN is not set.") + } return cfg, nil } diff --git a/main-linux-amd64 b/main-linux-amd64 index b93741b..b25b2b5 100755 Binary files a/main-linux-amd64 and b/main-linux-amd64 differ diff --git a/main-linux-arm64 b/main-linux-arm64 index d435081..45c0ba7 100755 Binary files a/main-linux-arm64 and b/main-linux-arm64 differ diff --git a/main-windows-amd64.exe b/main-windows-amd64.exe index d343be1..73cc65e 100755 Binary files a/main-windows-amd64.exe and b/main-windows-amd64.exe differ diff --git a/main.go b/main.go index 2241496..9807287 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,7 @@ func handleMainExecution(action *githubactions.Action, ctx context.Context) { env.DisplayEnvVars() } - cache.UpdateZctionsConfig(action, cfg.ActionsResultsURL, cfg.ZctionsResultsURL) + cache.UpdateZctionsConfig(action, cfg.ActionsResultsURL, cfg.ZctionsResultsURL, cfg.ZctionsCacheURL, cfg.ActionsRuntimeToken) if cfg.HasShowCosts() { action.Infof("show_costs is enabled. You will find cost details in the post-execution step of this action.")