Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/test-magic-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
FILENAME: random-file
BLOCKS: 128 # 128MB
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: ./

- name: Generate file
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-sccache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 9 additions & 2 deletions internal/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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 {
Expand Down
30 changes: 22 additions & 8 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand All @@ -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
}
Expand Down
Binary file modified main-linux-amd64
Binary file not shown.
Binary file modified main-linux-arm64
Binary file not shown.
Binary file modified main-windows-amd64.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
Loading