diff --git a/.github/actions/build-dev-builder-images/action.yml b/.github/actions/build-dev-builder-images/action.yml index 9f428cef4a95..0ce97931654f 100644 --- a/.github/actions/build-dev-builder-images/action.yml +++ b/.github/actions/build-dev-builder-images/action.yml @@ -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: @@ -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 }} diff --git a/.github/workflows/release-dev-builder-images.yaml b/.github/workflows/release-dev-builder-images.yaml index 127f50831edc..39eaec216c41 100644 --- a/.github/workflows/release-dev-builder-images.yaml +++ b/.github/workflows/release-dev-builder-images.yaml @@ -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 @@ -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 }}