Skip to content

Commit

Permalink
ci: separate ubuntu versions out in ci (actions#969)
Browse files Browse the repository at this point in the history
* ci: separate ubuntu versions out in ci
  • Loading branch information
toast-gear authored Nov 30, 2021
1 parent 47a1775 commit 031b184
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 126 deletions.
38 changes: 38 additions & 0 deletions .github/actions/setup-docker-environment/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "Setup Docker"

inputs:
username:
description: "Username"
required: true
password:
description: "Password"
required: true

outputs:
sha_short:
description: "The short SHA used for image builds"
value: ${{ steps.vars.outputs.sha_short }}

runs:
using: "composite"
steps:
- name: Get Short SHA
id: vars
run: |
echo ::set-output name=sha_short::${GITHUB_SHA::7}
shell: bash

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest

- name: Login to DockerHub
if: ${{ github.ref == 'master' && github.event.pull_request.merged == true }}
uses: docker/login-action@v1
with:
username: ${{ inputs.username }}
password: ${{ inputs.password }}
5 changes: 4 additions & 1 deletion .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
"regexManagers": [
{
// use https://github.com/actions/runner/releases
"fileMatch": [".github/workflows/build-and-release-runners.yml"],
"fileMatch": [
".github/workflows/ubuntu-18-04-runners.yml",
".github/workflows/ubuntu-20-04-runners.yml"
],
"matchStrings": ["RUNNER_VERSION: +(?<currentValue>.*?)\\n"],
"depNameTemplate": "actions/runner",
"datasourceTemplate": "github-releases"
Expand Down
123 changes: 0 additions & 123 deletions .github/workflows/build-and-release-runners.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ on:
branches:
- master
paths-ignore:
- .github/workflows/build-and-release-runners.yml
- .github/workflows/ubuntu-18-04-runners.yml
- .github/workflows/ubuntu-20-04-runners.yml
- .github/workflows/on-push-lint-charts.yml
- .github/workflows/on-push-master-publish-chart.yml
- .github/workflows/release.yml
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/ubuntu-18-04-runners.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Ubuntu 18.04 Runners

on:
pull_request:
types:
- opened
- synchronize
- reopened
- closed
branches:
- 'master'
paths:
- 'runner/**'
- .github/workflows/ubuntu-18-04-runners.yml
- '!**.md'
- '!runner/Dockerfile'
- '!runner/Dockerfile.dindrunner'

env:
RUNNER_VERSION: 2.284.0
DOCKER_VERSION: 20.10.8
DOCKERHUB_USERNAME: summerwind

jobs:
build:
runs-on: ubuntu-latest
name: Build ${{ matrix.name }}-ubuntu-${{ matrix.os-version }}
strategy:
fail-fast: false
matrix:
include:
- name: actions-runner
os-version: 18.04
dockerfile: Dockerfile.ubuntu.1804

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Docker Environment
id: vars
uses: ./.github/actions/setup-docker-environment
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Build and Push Versioned Tags
uses: docker/build-push-action@v2
with:
context: ./runner
file: ./runner/${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
push: ${{ github.ref == 'master' && github.event.pull_request.merged == true }}
build-args: |
RUNNER_VERSION=${{ env.RUNNER_VERSION }}
DOCKER_VERSION=${{ env.DOCKER_VERSION }}
tags: |
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-ubuntu-${{ matrix.os-version }}
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-ubuntu-${{ matrix.os-version }}-${{ steps.vars.outputs.sha_short }}
cache-from: type=gha
cache-to: type=gha,mode=max
64 changes: 64 additions & 0 deletions .github/workflows/ubuntu-20-04-runners.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Ubuntu 20.04 Runners

on:
pull_request:
types:
- opened
- synchronize
- reopened
- closed
branches:
- 'master'
paths:
- 'runner/**'
- .github/workflows/ubuntu-20-04-runners.yml
- '!**.md'
- '!runner/Dockerfile.ubuntu.1804'

env:
RUNNER_VERSION: 2.284.0
DOCKER_VERSION: 20.10.8
DOCKERHUB_USERNAME: summerwind

jobs:
build:
runs-on: ubuntu-latest
name: Build ${{ matrix.name }}-ubuntu-${{ matrix.os-version }}
strategy:
fail-fast: false
matrix:
include:
- name: actions-runner
os-version: 20.04
dockerfile: Dockerfile
- name: actions-runner-dind
os-version: 20.04
dockerfile: Dockerfile.dindrunner

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Docker Environment
id: vars
uses: ./.github/actions/setup-docker-environment
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Build and Push Versioned Tags
uses: docker/build-push-action@v2
with:
context: ./runner
file: ./runner/${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
push: ${{ github.ref == 'master' && github.event.pull_request.merged == true }}
build-args: |
RUNNER_VERSION=${{ env.RUNNER_VERSION }}
DOCKER_VERSION=${{ env.DOCKER_VERSION }}
tags: |
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-ubuntu-${{ matrix.os-version }}
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-ubuntu-${{ matrix.os-version }}-${{ steps.vars.outputs.sha_short }}
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion runner/Dockerfile.dindrunner
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ubuntu:20.04
ARG TARGETPLATFORM
ARG RUNNER_VERSION=2.280.3
ARG DOCKER_CHANNEL=stable
ARG DOCKER_VERSION=19.03.13
ARG DOCKER_VERSION=20.10.8
ARG DUMB_INIT_VERSION=1.2.5

RUN test -n "$TARGETPLATFORM" || (echo "TARGETPLATFORM must be set" && false)
Expand Down

0 comments on commit 031b184

Please sign in to comment.