diff --git a/.github/actions/build-dev-builder-image/action.yml b/.github/actions/build-dev-builder-image/action.yml deleted file mode 100644 index 3a6b10313cec..000000000000 --- a/.github/actions/build-dev-builder-image/action.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Build and push dev-builder image -description: Build and push dev-builder image 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 -runs: - using: composite - steps: - - 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 ubuntu dev builder image to dockerhub - shell: bash - 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 }} - - - name: Build and push centos dev builder image to dockerhub - shell: bash - 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 }} - - - name: Build and push android dev builder image to dockerhub - shell: bash - run: - make dev-builder \ - BASE_IMAGE=android \ - IMAGE_REGISTRY=${{ inputs.dockerhub-image-registry }} \ - IMAGE_NAMESPACE=${{ inputs.dockerhub-image-namespace }} \ - IMAGE_TAG=${{ inputs.version }} - - - name: Login to ACR - uses: docker/login-action@v2 - continue-on-error: true - with: - registry: ${{ inputs.acr-image-registry }} - username: ${{ inputs.acr-image-registry-username }} - password: ${{ inputs.acr-image-registry-password }} - - - name: Build and push ubuntu dev builder image to ACR - shell: bash - continue-on-error: true - run: # buildx will cache the images that already built, so it will not take long time to build the images again. - make dev-builder \ - BASE_IMAGE=ubuntu \ - BUILDX_MULTI_PLATFORM_BUILD=true \ - IMAGE_REGISTRY=${{ inputs.acr-image-registry }} \ - IMAGE_NAMESPACE=${{ inputs.acr-image-namespace }} \ - IMAGE_TAG=${{ inputs.version }} - - - name: Build and push centos dev builder image to ACR - shell: bash - continue-on-error: true - run: # buildx will cache the images that already built, so it will not take long time to build the images again. - make dev-builder \ - BASE_IMAGE=centos \ - BUILDX_MULTI_PLATFORM_BUILD=true \ - IMAGE_REGISTRY=${{ inputs.acr-image-registry }} \ - IMAGE_NAMESPACE=${{ inputs.acr-image-namespace }} \ - IMAGE_TAG=${{ inputs.version }} diff --git a/.github/actions/build-dev-builder-images/action.yml b/.github/actions/build-dev-builder-images/action.yml new file mode 100644 index 000000000000..9f428cef4a95 --- /dev/null +++ b/.github/actions/build-dev-builder-images/action.yml @@ -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 }} diff --git a/.github/workflows/release-dev-builder-images.yaml b/.github/workflows/release-dev-builder-images.yaml index 20b3d376bcf2..127f50831edc 100644 --- a/.github/workflows/release-dev-builder-images.yaml +++ b/.github/workflows/release-dev-builder-images.yaml @@ -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 @@ -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 }}