From d756f7a60cb8a6ea3c464e4e14f1c76b33570ecd Mon Sep 17 00:00:00 2001 From: Stephen Lang Date: Tue, 3 Mar 2026 17:29:42 +0000 Subject: [PATCH] ci: avoid docker hub rate limits --- .github/workflows/pull_request_integration_tests.yml | 6 ++++++ .../workflows/pull_request_integration_tests_arm.yml | 6 ++++++ .../workflows/pull_request_k8s_integration_tests.yml | 6 ++++++ .github/workflows/pull_request_oats_test.yml | 6 ++++++ .github/workflows/workflow_integration_tests_vm.yml | 6 ++++++ internal/test/integration/dockerutil_test.go | 11 +++++++++++ internal/test/integration/http_go_otel_test.go | 1 + 7 files changed, 42 insertions(+) diff --git a/.github/workflows/pull_request_integration_tests.yml b/.github/workflows/pull_request_integration_tests.yml index 5df9dffd52..cc22b9c271 100644 --- a/.github/workflows/pull_request_integration_tests.yml +++ b/.github/workflows/pull_request_integration_tests.yml @@ -113,6 +113,12 @@ jobs: ref: ${{ inputs.ref || github.sha }} persist-credentials: false + - name: Log in to Docker Hub + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 + with: + username: ${{ vars.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN_EBPF_INSTRUMENTATION }} + - name: Set up Go uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 # zizmor: ignore[cache-poisoning] go.sum verifies module integrity with: diff --git a/.github/workflows/pull_request_integration_tests_arm.yml b/.github/workflows/pull_request_integration_tests_arm.yml index 69a85d4411..531daa0ee0 100644 --- a/.github/workflows/pull_request_integration_tests_arm.yml +++ b/.github/workflows/pull_request_integration_tests_arm.yml @@ -119,6 +119,12 @@ jobs: ref: ${{ inputs.ref || github.sha }} persist-credentials: false + - name: Log in to Docker Hub + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 + with: + username: ${{ vars.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN_EBPF_INSTRUMENTATION }} + - name: Set up Go uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 # zizmor: ignore[cache-poisoning] go.sum verifies module integrity with: diff --git a/.github/workflows/pull_request_k8s_integration_tests.yml b/.github/workflows/pull_request_k8s_integration_tests.yml index 405296ab12..bc91e19001 100644 --- a/.github/workflows/pull_request_k8s_integration_tests.yml +++ b/.github/workflows/pull_request_k8s_integration_tests.yml @@ -111,6 +111,12 @@ jobs: ref: ${{ inputs.ref || github.sha }} persist-credentials: false + - name: Log in to Docker Hub + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 + with: + username: ${{ vars.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN_EBPF_INSTRUMENTATION }} + - name: Set up Go uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 # zizmor: ignore[cache-poisoning] go.sum verifies module integrity with: diff --git a/.github/workflows/pull_request_oats_test.yml b/.github/workflows/pull_request_oats_test.yml index 18430babe8..7a77d9a788 100644 --- a/.github/workflows/pull_request_oats_test.yml +++ b/.github/workflows/pull_request_oats_test.yml @@ -111,6 +111,12 @@ jobs: ref: ${{ inputs.ref || github.sha }} persist-credentials: false + - name: Log in to Docker Hub + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 + with: + username: ${{ vars.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN_EBPF_INSTRUMENTATION }} + - name: Set up Go uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 # zizmor: ignore[cache-poisoning] go.sum verifies module integrity with: diff --git a/.github/workflows/workflow_integration_tests_vm.yml b/.github/workflows/workflow_integration_tests_vm.yml index 3e3c674fe5..d08489cd57 100644 --- a/.github/workflows/workflow_integration_tests_vm.yml +++ b/.github/workflows/workflow_integration_tests_vm.yml @@ -121,6 +121,12 @@ jobs: ref: ${{ inputs.ref || github.sha }} persist-credentials: false + - name: Log in to Docker Hub + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 + with: + username: ${{ vars.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN_EBPF_INSTRUMENTATION }} + - name: Set up Go uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 # zizmor: ignore[cache-poisoning] go.sum verifies module integrity with: diff --git a/internal/test/integration/dockerutil_test.go b/internal/test/integration/dockerutil_test.go index f91d332c68..bbb3c85a69 100644 --- a/internal/test/integration/dockerutil_test.go +++ b/internal/test/integration/dockerutil_test.go @@ -134,6 +134,16 @@ func setupContainerCollector(t *testing.T, network *dockertest.Network, configFi t.Log("OpenTelemetry Collector container started") } +// dockerAuthConfigs loads Docker registry credentials from ~/.docker/config.json +// if available. In CI, docker/login-action populates this file. Returns an empty +// AuthConfigurations (no-op) when the config file is absent or unreadable. +func dockerAuthConfigs() docker.AuthConfigurations { + if cfgs, err := docker.NewAuthConfigurationsFromDockerCfg(); err == nil { + return *cfgs + } + return docker.AuthConfigurations{} +} + // buildOBIImage builds the OBI image. When SKIP_DOCKER_BUILD is set, the image // has been pre-built for the VM workflow prior to QEMU startup. func buildOBIImage() error { @@ -151,6 +161,7 @@ func buildOBIImage() error { Dockerfile: "internal/test/integration/components/obi/Dockerfile", OutputStream: os.Stdout, ErrorStream: os.Stderr, + AuthConfigs: dockerAuthConfigs(), }) } diff --git a/internal/test/integration/http_go_otel_test.go b/internal/test/integration/http_go_otel_test.go index d1e1b89af0..43dd37f7c6 100644 --- a/internal/test/integration/http_go_otel_test.go +++ b/internal/test/integration/http_go_otel_test.go @@ -39,6 +39,7 @@ func setupGoOTelTestServer(t *testing.T, network *dockertest.Network, env []stri Dockerfile: "internal/test/integration/components/go_otel/Dockerfile", OutputStream: t.Output(), ErrorStream: t.Output(), + AuthConfigs: dockerAuthConfigs(), }) if buildGoOTelTestServerErr != nil { return