-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes docker.io normal case rate-limiting (#171)
Each pull request implies many docker.io requests, this has led to builds failing on account of rate limiting. This avoids that by using the GitHub Container Registry (ghcr.io) instead of Docker Hub (docker.io). ghcr.io is not rate-limited. Specifically, we use internal copies of images used as parents or in testing. Since these aren't what end users use anyway, this doesn't impact them. At the end of the day, ghcr.io/tetratelabs/getenvoy-internal has tags corresponding to our needs: ```yaml - source: busybox:1.32.1 # test image: ci/e2e/darwin/install_docker.sh target_tag: busybox - source: registry:2 # test image: docker-compose.yml target_tag: registry - source: rust:1.51.0 # parent image: images/extension-builders/rust/Dockerfile target_tag: rust - source: tinygo/tinygo:0.17.0 # parent image: images/extension-builders/tinygo/Dockerfile target_tag: tinygo ``` Updating our base layers or otherwise implies a change to `.github/workflows/internal-images.yml` and re-triggering the workflow or waiting until the next day for automatic publishing to occur. Another change in this PR is removing the docker dependency from unit tests via a mock. Even if we have safe images, we still shouldn't subject unit tests to flakiness, extra time, or network dependencies unless there is no other way.
- Loading branch information
1 parent
1f59689
commit 32b27df
Showing
8 changed files
with
126 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# yamllint --format github .github/workflows/internal-images.yml | ||
--- | ||
name: internal-images | ||
|
||
# Refresh the tags once a day | ||
on: | ||
schedule: | ||
- cron: "23 3 * * *" | ||
workflow_dispatch: # Allows manual refresh | ||
|
||
# This copies images from docker.io to ghcr.io/tetratelabs/getenvoy-internal:$tag | ||
# Using these in tests and as a parent (FROM) avoids docker.io rate-limits particularly on pull requests. | ||
jobs: | ||
copy-images: | ||
strategy: | ||
matrix: | ||
# Be precise in tag versions to improve reproducibility | ||
include: | ||
- source: busybox:1.32.1 # test image: ci/e2e/darwin/install_docker.sh | ||
target_tag: busybox | ||
- source: registry:2 # test image: docker-compose.yml | ||
target_tag: registry | ||
- source: rust:1.51.0 # parent image: images/extension-builders/rust/Dockerfile | ||
target_tag: rust | ||
- source: tinygo/tinygo:0.17.0 # parent image: images/extension-builders/tinygo/Dockerfile | ||
target_tag: tinygo | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Same as doing this locally: echo "${GHCR_TOKEN}" | docker login ghcr.io -u "${GHCR_TOKEN}" --password-stdin | ||
- name: Login into GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
# GHCR_TOKEN=<hex token value> | ||
# - pushes Docker images to ghcr.io | ||
# - create via https://github.com/settings/tokens | ||
# - assign via https://github.com/organizations/tetratelabs/settings/secrets/actions | ||
# - needs repo:status, public_repo, write:packages, delete:packages | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
|
||
- name: Pull and push | ||
run: | # This will only push a single architecture, which is fine as we currently only support amd64 | ||
docker pull ${{ matrix.source }} | ||
docker tag ${{ matrix.source }} ghcr.io/tetratelabs/getenvoy-internal:${{ matrix.target_tag }} | ||
docker push ghcr.io/tetratelabs/getenvoy-internal:${{ matrix.target_tag }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters