Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v1.9] .github: add GitHub actions to build images #14936

Merged
merged 2 commits into from
Feb 11, 2021
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
100 changes: 100 additions & 0 deletions .github/workflows/images-legacy-releases.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Image Release Build v1.9

on:
push:
tags:
- v1.9.[0-9]+
- v1.9.[0-9]+-rc[0-9]+

jobs:
build-and-push:
if: ${{ github.repository == 'cilium/cilium' }}
environment: release
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- name: cilium
dockerfile: ./Dockerfile
- name: operator
dockerfile: ./cilium-operator.Dockerfile
- name: operator-aws
dockerfile: ./cilium-operator-aws.Dockerfile
- name: operator-azure
dockerfile: ./cilium-operator-azure.Dockerfile
- name: operator-generic
dockerfile: ./cilium-operator-generic.Dockerfile
- name: hubble-relay
dockerfile: ./hubble-relay.Dockerfile
- name: clustermesh-apiserver
dockerfile: ./clustermesh-apiserver.Dockerfile
- name: docker-plugin
dockerfile: ./cilium-docker-plugin.Dockerfile
steps:
- name: Set output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF##*/}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@154c24e1f33dbb5865a021c99f1318cfebf27b32 # v1.1.1

- name: Checkout Stable Branch Source Code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Login to DockerHub
uses: docker/login-action@f3364599c6aa293cdc2b8391b1b56d0c30e45c8a # v1.8.0
with:
username: ${{ secrets.DOCKER_HUB_RELEASE_USERNAME }}
password: ${{ secrets.DOCKER_HUB_RELEASE_PASSWORD }}
- name: Login to quay.io
uses: docker/login-action@f3364599c6aa293cdc2b8391b1b56d0c30e45c8a # v1.8.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME_RELEASE_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD_RELEASE_PASSWORD }}
- name: Release Build ${{ matrix.name }}
uses: docker/build-push-action@4a531fa5a603bab87dfa56578bd82b28508c9547 # v2.2.2
id: docker_build_release
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: |
${{ github.repository_owner }}/${{ matrix.name }}-dev:${{ steps.vars.outputs.tag }}
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-dev:${{ steps.vars.outputs.tag }}
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ github.sha }}
- name: Image Release Digest
shell: bash
run: |
mkdir -p image-digest/
echo "## ${{ matrix.name }}" > image-digest/${{ matrix.name }}.txt
echo "" >> image-digest/${{ matrix.name }}.txt
echo "\`docker.io/${{ github.repository_owner }}/${{ matrix.name }}-dev:${{ steps.vars.outputs.tag }}@${{ steps.docker_build_release.outputs.digest }}\`" >> image-digest/${{ matrix.name }}.txt
echo "\`quay.io/${{ github.repository_owner }}/${{ matrix.name }}-dev:${{ steps.vars.outputs.tag }}@${{ steps.docker_build_release.outputs.digest }}\`" >> image-digest/${{ matrix.name }}.txt
echo "" >> image-digest/${{ matrix.name }}.txt

# Upload artifact digests
- name: Upload artifact digests
uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2
with:
name: image-digest ${{ matrix.name }}
path: image-digest
retention-days: 1
image-digests:
if: ${{ github.repository == 'cilium/cilium' }}
name: Display Digests
runs-on: ubuntu-20.04
needs: build-and-push
steps:
- name: Downloading Image Digests
shell: bash
run: |
mkdir -p image-digest/
- name: Download digests of all images built
uses: actions/download-artifact@4a7a711286f30c025902c28b541c10e147a9b843 # v2.0.8
with:
path: image-digest/

- name: Image Digests Output
shell: bash
run: |
cd image-digest/
find -type f | sort | xargs -d '\n' cat
123 changes: 123 additions & 0 deletions .github/workflows/images-legacy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Image CI Build v1.9

on:
pull_request_target:
types:
- opened
- synchronize
- reopened
push:
branches:
- v1.9

jobs:
build-and-push-prs:
if: ${{ github.repository == 'cilium/cilium' }}
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- name: cilium
dockerfile: ./Dockerfile
- name: operator
dockerfile: ./cilium-operator.Dockerfile
- name: operator-aws
dockerfile: ./cilium-operator-aws.Dockerfile
- name: operator-azure
dockerfile: ./cilium-operator-azure.Dockerfile
- name: operator-generic
dockerfile: ./cilium-operator-generic.Dockerfile
- name: hubble-relay
dockerfile: ./hubble-relay.Dockerfile
- name: clustermesh-apiserver
dockerfile: ./clustermesh-apiserver.Dockerfile
- name: docker-plugin
dockerfile: ./cilium-docker-plugin.Dockerfile
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@154c24e1f33dbb5865a021c99f1318cfebf27b32 # v1.1.1
- name: Login to DockerHub to avoid rate limit
uses: docker/login-action@f3364599c6aa293cdc2b8391b1b56d0c30e45c8a # v1.8.0
with:
username: ${{ secrets.DOCKER_HUB_USERNAME_CI }}
password: ${{ secrets.DOCKER_HUB_PASSWORD_CI }}
- name: Login to quay.io for CI
uses: docker/login-action@f3364599c6aa293cdc2b8391b1b56d0c30e45c8a # v1.8.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME_CI }}
password: ${{ secrets.QUAY_PASSWORD_CI }}

# v1.9 branch pushes
- name: Checkout v1.9 Branch Source Code
if: ${{ github.event_name != 'pull_request_target' }}
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: CI Build ${{ matrix.name }}
if: ${{ github.event_name != 'pull_request_target' }}
uses: docker/build-push-action@4a531fa5a603bab87dfa56578bd82b28508c9547 # v2.2.2
id: docker_build_ci_v1_9
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:v1.9
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ github.sha }}
- name: CI Image Releases digests
if: ${{ github.event_name != 'pull_request_target' }}
shell: bash
run: |
mkdir -p image-digest/
echo "quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:v1.9@${{ steps.docker_build_ci_v1_9.outputs.digest }}" > image-digest/${{ matrix.name }}.txt
echo "quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ github.sha }}@${{ steps.docker_build_ci_v1_9.outputs.digest }}" >> image-digest/${{ matrix.name }}.txt

# PR updates
- name: Checkout PR Source Code
if: ${{ github.event_name == 'pull_request_target' }}
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: CI Build ${{ matrix.name }}
if: ${{ github.event_name == 'pull_request_target' }}
uses: docker/build-push-action@4a531fa5a603bab87dfa56578bd82b28508c9547 # v2.2.2
id: docker_build_ci_pr
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ github.event.pull_request.head.sha }}
- name: CI Image Releases digests
if: ${{ github.event_name == 'pull_request_target' }}
shell: bash
run: |
mkdir -p image-digest/
echo "quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ github.event.pull_request.head.sha }}@${{ steps.docker_build_ci_pr.outputs.digest }}" > image-digest/${{ matrix.name }}.txt

# Upload artifact digests
- name: Upload artifact digests
uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2
with:
name: image-digest ${{ matrix.name }}
path: image-digest
retention-days: 1
image-digests:
if: ${{ github.repository == 'cilium/cilium' }}
name: Display Digests
runs-on: ubuntu-20.04
needs: build-and-push-prs
steps:
- name: Downloading Image Digests
shell: bash
run: |
mkdir -p image-digest/
- name: Download digests of all images built
uses: actions/download-artifact@4a7a711286f30c025902c28b541c10e147a9b843 # v2.0.8
with:
path: image-digest/

- name: Image Digests Output
shell: bash
run: |
cd image-digest/
find -type f | sort | xargs -d '\n' cat
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
# after the less specific paths, otherwise the ownership for the specific paths
# is not properly picked up in Github.
* @cilium/janitors
/.github/workflows/ @cilium/maintainers
/api/ @cilium/api
/pkg/monitor/payload @cilium/api
/pkg/policy/api/ @cilium/api
Expand Down