Skip to content

Commit

Permalink
ci: refine the process of releasing dev-builder images (GreptimeTeam#…
Browse files Browse the repository at this point in the history
…2580)

* fix: fix error of releasing android builder image

* fix: run skopeo error

* ci: add 'release-dev-builder-images-cn' job

* ci: add 'disable_building_images'

* fix: add vars

* ci: use skopeo container

* ci: update opts defaule values
  • Loading branch information
zyy17 authored and paomian committed Oct 19, 2023
1 parent ffacc7c commit ba39590
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 44 deletions.
48 changes: 10 additions & 38 deletions .github/actions/build-dev-builder-images/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,25 @@ inputs:
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
description: Build dev-builder-ubuntu image
required: false
default: 'true'
build-dev-builder-centos:
describtion: Build dev-builder-centos image
description: Build dev-builder-centos image
required: false
default: 'true'
build-dev-builder-android:
describtion: Build dev-builder-android image
description: 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:
Expand All @@ -62,43 +44,33 @@ runs:
- name: Build and push dev-builder-ubuntu image
shell: bash
if: ${{ inputs.build-dev-builder-ubuntu == 'true' }}
run:
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 }}
IMAGE_TAG=${{ inputs.version }}
- name: Build and push dev-builder-centos image
shell: bash
if: ${{ inputs.build-dev-builder-centos == 'true' }}
run:
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 }}
IMAGE_TAG=${{ inputs.version }}
- name: Build and push dev-builder-android image # Only build amd64 platform.
- name: Build and push dev-builder-android image # Only build image for amd64 platform.
shell: bash
if: ${{ inputs.build-dev-builder-android == 'true' }}
run:
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 }}
docker push ${{ inputs.dockerhub-image-registry }}/${{ inputs.dockerhub-image-namespace }}/dev-builder-android:${{ inputs.version }}
54 changes: 48 additions & 6 deletions .github/workflows/release-dev-builder-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@ name: Release dev-builder images
on:
workflow_dispatch: # Allows you to run this workflow manually.
inputs:
version:
description: Version of the dev-builder
required: false
default: latest
release_dev_builder_ubuntu_image:
type: boolean
description: Release dev-builder-ubuntu images
description: Release dev-builder-ubuntu image
required: false
default: false
release_dev_builder_centos_image:
type: boolean
description: Release dev-builder-centos images
description: Release dev-builder-centos image
required: false
default: false
release_dev_builder_android_image:
type: boolean
description: Release dev-builder-android images
description: Release dev-builder-android image
required: false
default: false

Expand All @@ -33,11 +37,49 @@ jobs:
- name: Build and push dev builder images
uses: ./.github/actions/build-dev-builder-images
with:
version: ${{ inputs.version }}
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 }}

release-dev-builder-images-cn: # Note: Be careful issue: https://github.com/containers/skopeo/issues/1874 and we decide to use the latest stable skopeo container.
name: Release dev builder images to CN region
runs-on: ubuntu-latest
needs: [
release-dev-builder-images
]
steps:
- name: Push dev-builder-ubuntu image
shell: bash
if: ${{ inputs.release_dev_builder_ubuntu_image }}
env:
DST_REGISTRY_USERNAME: ${{ secrets.ALICLOUD_USERNAME }}
DST_REGISTRY_PASSWORD: ${{ secrets.ALICLOUD_PASSWORD }}
run: |
docker run quay.io/skopeo/stable:latest copy -a docker://docker.io/${{ vars.IMAGE_NAMESPACE }}/dev-builder-ubuntu:${{ inputs.version }} \
--dest-creds "$DST_REGISTRY_USERNAME":"$DST_REGISTRY_PASSWORD" \
docker://${{ vars.ACR_IMAGE_REGISTRY }}/${{ vars.IMAGE_NAMESPACE }}/dev-builder-ubuntu:${{ inputs.version }}
- name: Push dev-builder-centos image
shell: bash
if: ${{ inputs.release_dev_builder_centos_image }}
env:
DST_REGISTRY_USERNAME: ${{ secrets.ALICLOUD_USERNAME }}
DST_REGISTRY_PASSWORD: ${{ secrets.ALICLOUD_PASSWORD }}
run: |
docker run quay.io/skopeo/stable:latest copy -a docker://docker.io/${{ vars.IMAGE_NAMESPACE }}/dev-builder-centos:${{ inputs.version }} \
--dest-creds "$DST_REGISTRY_USERNAME":"$DST_REGISTRY_PASSWORD" \
docker://${{ vars.ACR_IMAGE_REGISTRY }}/${{ vars.IMAGE_NAMESPACE }}/dev-builder-centos:${{ inputs.version }}
- name: Push dev-builder-android image
shell: bash
if: ${{ inputs.release_dev_builder_android_image }}
env:
DST_REGISTRY_USERNAME: ${{ secrets.ALICLOUD_USERNAME }}
DST_REGISTRY_PASSWORD: ${{ secrets.ALICLOUD_PASSWORD }}
run: |
docker run quay.io/skopeo/stable:latest copy -a docker://docker.io/${{ vars.IMAGE_NAMESPACE }}/dev-builder-android:${{ inputs.version }} \
--dest-creds "$DST_REGISTRY_USERNAME":"$DST_REGISTRY_PASSWORD" \
docker://${{ vars.ACR_IMAGE_REGISTRY }}/${{ vars.IMAGE_NAMESPACE }}/dev-builder-android:${{ inputs.version }}

0 comments on commit ba39590

Please sign in to comment.