Skip to content

refactor(dockerfiles,dockerfiles-multi-stages): simple builder image for pd #57

refactor(dockerfiles,dockerfiles-multi-stages): simple builder image for pd

refactor(dockerfiles,dockerfiles-multi-stages): simple builder image for pd #57

Workflow file for this run

name: Skaffold - test
on:
pull_request:
branches:
- main
paths:
- dockerfiles/**/Dockerfile
- .github/workflows/ci.yml
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# JOB to run change detection
dockerfiles-changes:
name: detect changes for Dockerfiles.
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
outputs:
# Expose matched filters as job 'packages' output variable
packages-prod-bases: ${{ steps.filter-product-bases.outputs.changes }}
packages-ci-bases: ${{ steps.filter-ci-bases.outputs.changes }}
packages-ci-utils: ${{ steps.filter-ci-utils.outputs.changes }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v2
id: filter-product-bases
with:
filters: |
bases: dockerfiles/bases/**
- uses: dorny/paths-filter@v2
id: filter-ci-bases
with:
filters: |
base: dockerfiles/ci/base/**
release-build-base: dockerfiles/ci/release-build-base
- uses: dorny/paths-filter@v2
id: filter-ci-utils
with:
filters: |
release-utils: dockerfiles/ci/release-utils/**
build-product-bases:
name: Skaffold Build product base images
needs: dockerfiles-changes
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
no-use: ${{ fromJSON(needs.dockerfiles-changes.outputs.packages-prod-bases) }}
builder-profile: [local-docker]
platform: [linux/amd64, linux/arm64]
steps:
- name: Checkout sources
uses: actions/checkout@v4
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup skaffold
run: |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v2.8.0/skaffold-linux-amd64 && \
sudo install skaffold /usr/local/bin/
- name: Cache layers
uses: actions/cache@v3
with:
path: "~/.skaffold/cache"
key: skaffold-${{ hashFiles('**/cache') }}
restore-keys: |
skaffold-
- name: Build images
working-directory: dockerfiles/bases
run: |
skaffold build \
--push=false \
--platform ${{ matrix.platform }} \
--profile ${{ matrix.builder-profile }} \
--default-repo ghcr.io/pingcap-qe/bases
build-ci-bases:
name: Skaffold build CI base images
needs: dockerfiles-changes
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
module: ${{ fromJSON(needs.dockerfiles-changes.outputs.packages-ci-bases) }}
go-profile: [go-1.21, go-1.20, go-1.19]
builder-profile: [local-docker]
platform: [linux/amd64, linux/arm64]
steps:
- name: Checkout sources
uses: actions/checkout@v4
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup skaffold
run: |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v2.8.0/skaffold-linux-amd64 && \
sudo install skaffold /usr/local/bin/
- name: Cache layers
uses: actions/cache@v3
with:
path: "~/.skaffold/cache"
key: skaffold-${{ hashFiles('**/cache') }}
restore-keys: |
skaffold-
- name: Build images
working-directory: dockerfiles/ci
run: |
skaffold build \
--push=false \
--platform ${{ matrix.platform }} \
--module ${{ matrix.module }} \
--profile ${{ matrix.go-profile }},${{ matrix.builder-profile }} \
--default-repo ghcr.io/pingcap-qe/ci
build-ci-utils:
name: Skaffold Build ci util images
needs: dockerfiles-changes
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
no-use: ${{ fromJSON(needs.dockerfiles-changes.outputs.packages-ci-utils) }}
builder-profile: [local-docker]
platform: [linux/amd64, linux/arm64]
steps:
- name: Checkout sources
uses: actions/checkout@v4
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup skaffold
run: |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v2.8.0/skaffold-linux-amd64 && \
sudo install skaffold /usr/local/bin/
- name: Cache layers
uses: actions/cache@v3
with:
path: "~/.skaffold/cache"
key: skaffold-${{ hashFiles('**/cache') }}
restore-keys: |
skaffold-
- name: Build images
working-directory: dockerfiles/ci
run: |
skaffold build \
--push=false \
--platform ${{ matrix.platform }} \
--module release-utils \
--profile ${{ matrix.builder-profile }} \
--default-repo ghcr.io/pingcap-qe/ci