-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: refactor CI/CD flows for images (#123)
Signed-off-by: wuhuizuo <wuhuizuo@126.com>
- Loading branch information
Showing
7 changed files
with
190 additions
and
252 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
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,74 @@ | ||
name: Publish CD builder images | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "dockerfiles/cd/**/Dockerfile" | ||
- "dockerfiles/cd/**/*.Dockerfile" | ||
- "dockerfiles/cd/skaffold.yaml" | ||
|
||
jobs: | ||
skaffold: | ||
name: publish images with skaffold | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
strategy: | ||
max-parallel: 1 | ||
matrix: | ||
module: [builder-go, builder-others] | ||
go-profile: [go-1.21, go-1.20, go-1.19] | ||
builder-profile: [local-docker] | ||
exclude: | ||
- module: builder-others | ||
go-profile: go-1.20 | ||
- module: builder-others | ||
go-profile: go-1.19 | ||
|
||
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/cd/${{ matrix.module }}/${{ matrix.go-profile }}-${{ github.sha }} | ||
restore-keys: | | ||
skaffold/cd/${{ matrix.module }}/${{ matrix.go-profile }}- | ||
skaffold/cd/${{ matrix.module }}/ | ||
- name: Publish images | ||
working-directory: dockerfiles/cd | ||
run: | | ||
skaffold build \ | ||
--build-concurrency 1 \ | ||
--cache-artifacts \ | ||
--default-repo ghcr.io/pingcap-qe/cd/builders \ | ||
--module ${{ matrix.module }} \ | ||
--profile ${{ matrix.go-profile }},${{ matrix.builder-profile }} |
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,65 @@ | ||
name: Release product base images | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "dockerfiles/bases/**/Dockerfile" | ||
- "dockerfiles/bases/**/*.Dockerfile" | ||
- "dockerfiles/bases/skaffold.yaml" | ||
|
||
jobs: | ||
skaffold: | ||
name: publish images with skaffold | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
strategy: | ||
max-parallel: 1 | ||
matrix: | ||
builder-profile: [local-docker] | ||
|
||
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/prod-bases-${{ github.sha }} | ||
restore-keys: | | ||
skaffold/prod-bases- | ||
- name: Publish images | ||
working-directory: dockerfiles/bases | ||
run: | | ||
skaffold build \ | ||
--build-concurrency 1 \ | ||
--cache-artifacts \ | ||
--default-repo ghcr.io/pingcap-qe/bases \ | ||
--profile ${{ matrix.builder-profile }} |
Oops, something went wrong.