Skip to content

Commit

Permalink
ci: add more options for releasing dev-builder images (#2573)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyy17 authored Oct 11, 2023
1 parent fe02366 commit 76d5b71
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 106 deletions.
102 changes: 0 additions & 102 deletions .github/actions/build-dev-builder-image/action.yml

This file was deleted.

104 changes: 104 additions & 0 deletions .github/actions/build-dev-builder-images/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Build and push dev-builder images
description: Build and push dev-builder images to DockerHub and ACR
inputs:
dockerhub-image-registry:
description: The dockerhub image registry to store the images
required: false
default: docker.io
dockerhub-image-registry-username:
description: The dockerhub username to login to the image registry
required: true
dockerhub-image-registry-token:
description: The dockerhub token to login to the image registry
required: true
dockerhub-image-namespace:
description: The dockerhub namespace of the image registry to store the images
required: false
default: greptime
acr-image-registry:
description: The ACR image registry to store the images
required: true
acr-image-registry-username:
description: The ACR username to login to the image registry
required: true
acr-image-registry-password:
description: The ACR password to login to the image registry
required: true
acr-image-namespace:
description: The ACR namespace of the image registry to store the images
required: false
default: greptime
version:
description: Version of the dev-builder
required: false
default: latest
build-dev-builder-ubuntu:
describtion: Build dev-builder-ubuntu image
required: false
default: 'true'
build-dev-builder-centos:
describtion: Build dev-builder-centos image
required: false
default: 'true'
build-dev-builder-android:
describtion: Build dev-builder-android image
required: false
default: 'true'
runs:
using: composite
steps:
- name: Install skopeo
shell: bash
run: |
sudo apt update && sudo apt install -y skopeo
- name: Login to Dockerhub
uses: docker/login-action@v2
with:
registry: ${{ inputs.dockerhub-image-registry }}
username: ${{ inputs.dockerhub-image-registry-username }}
password: ${{ inputs.dockerhub-image-registry-token }}

- name: Build and push dev-builder-ubuntu image
shell: bash
if: ${{ inputs.build-dev-builder-ubuntu == 'true' }}
run:
make dev-builder \
BASE_IMAGE=ubuntu \
BUILDX_MULTI_PLATFORM_BUILD=true \
IMAGE_REGISTRY=${{ inputs.dockerhub-image-registry }} \
IMAGE_NAMESPACE=${{ inputs.dockerhub-image-namespace }} \
IMAGE_TAG=${{ inputs.version }} && \

skopeo copy -a docker://docker.io/${{ inputs.dockerhub-image-namespace }}/dev-builder-ubuntu:${{ inputs.version }} \
--dest-creds "${{ inputs.acr-image-registry-username }}":"${{ inputs.acr-image-registry-password }}" \
docker://${{ inputs.acr-image-registry }}/${{ inputs.acr-image-namespace }}/dev-builder-ubuntu:${{ inputs.version }}

- name: Build and push dev-builder-centos image
shell: bash
if: ${{ inputs.build-dev-builder-centos == 'true' }}
run:
make dev-builder \
BASE_IMAGE=centos \
BUILDX_MULTI_PLATFORM_BUILD=true \
IMAGE_REGISTRY=${{ inputs.dockerhub-image-registry }} \
IMAGE_NAMESPACE=${{ inputs.dockerhub-image-namespace }} \
IMAGE_TAG=${{ inputs.version }} && \

skopeo copy -a docker://docker.io/${{ inputs.dockerhub-image-namespace }}/dev-builder-centos:${{ inputs.version }} \
--dest-creds "${{ inputs.acr-image-registry-username }}":"${{ inputs.acr-image-registry-password }}" \
docker://${{ inputs.acr-image-registry }}/${{ inputs.acr-image-namespace }}/dev-builder-centos:${{ inputs.version }}

- name: Build and push dev-builder-android image # Only build amd64 platform.
shell: bash
if: ${{ inputs.build-dev-builder-android == 'true' }}
run:
make dev-builder \
BASE_IMAGE=android \
IMAGE_REGISTRY=${{ inputs.dockerhub-image-registry }} \
IMAGE_NAMESPACE=${{ inputs.dockerhub-image-namespace }} \
IMAGE_TAG=${{ inputs.version }} && \

skopeo copy -a docker://docker.io/${{ inputs.dockerhub-image-namespace }}/dev-builder-android:${{ inputs.version }} \
--dest-creds "${{ inputs.acr-image-registry-username }}":"${{ inputs.acr-image-registry-password }}" \
docker://${{ inputs.acr-image-registry }}/${{ inputs.acr-image-namespace }}/dev-builder-android:${{ inputs.version }}
21 changes: 17 additions & 4 deletions .github/workflows/release-dev-builder-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,26 @@ name: Release dev-builder images
on:
workflow_dispatch: # Allows you to run this workflow manually.
inputs:
release_dev_builder_images:
release_dev_builder_ubuntu_image:
type: boolean
description: Release dev-builder images
description: Release dev-builder-ubuntu images
required: false
default: false
release_dev_builder_centos_image:
type: boolean
description: Release dev-builder-centos images
required: false
default: false
release_dev_builder_android_image:
type: boolean
description: Release dev-builder-android images
required: false
default: false

jobs:
release-dev-builder-images:
name: Release dev builder images
if: ${{ inputs.release_dev_builder_images }} # Only manually trigger this job.
if: ${{ inputs.release_dev_builder_ubuntu_image || inputs.release_dev_builder_centos_image || inputs.release_dev_builder_android_image }} # Only manually trigger this job.
runs-on: ubuntu-latest-16-cores
steps:
- name: Checkout
Expand All @@ -21,10 +31,13 @@ jobs:
fetch-depth: 0

- name: Build and push dev builder images
uses: ./.github/actions/build-dev-builder-image
uses: ./.github/actions/build-dev-builder-images
with:
dockerhub-image-registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-image-registry-token: ${{ secrets.DOCKERHUB_TOKEN }}
acr-image-registry: ${{ vars.ACR_IMAGE_REGISTRY }}
acr-image-registry-username: ${{ secrets.ALICLOUD_USERNAME }}
acr-image-registry-password: ${{ secrets.ALICLOUD_PASSWORD }}
build-dev-builder-ubuntu: ${{ inputs.release_dev_builder_ubuntu_image }}
build-dev-builder-centos: ${{ inputs.release_dev_builder_centos_image }}
build-dev-builder-android: ${{ inputs.release_dev_builder_android_image }}

0 comments on commit 76d5b71

Please sign in to comment.