-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: shaoyue.chen <[email protected]>
- Loading branch information
Showing
3 changed files
with
182 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,97 @@ | ||
name: Build and Push on Tag | ||
|
||
# This workflow is triggered on new tag pushed to the repository. | ||
# ref doc: https://docs.docker.com/build/ci/github-actions/multi-platform/ | ||
on: | ||
push: | ||
tags: | ||
- "*" | ||
env: | ||
REGISTRY_IMAGE: milvusdb/milvus-operator | ||
|
||
jobs: | ||
publish-builder: | ||
name: Publish Builder | ||
build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu18.04] | ||
env: | ||
OS_NAME: ${{ matrix.os }} | ||
REGISTRY_NAME: milvusdb/milvus-operator | ||
platform: | ||
- linux/amd64 | ||
- linux/arm64 | ||
steps: | ||
- name: Prepare | ||
run: | | ||
platform=${{ matrix.platform }} | ||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
- name: Get version from system time after release step | ||
id: extracter | ||
run: | | ||
echo "::set-output name=git_tag::$(echo "${{ github.ref }}" | awk -F '/' '{print $3}')" | ||
# TODO: add go mod cache | ||
# - name: Cache Go Mod Volumes | ||
# uses: actions/cache@v1 | ||
# with: | ||
# path: .docker/go-mod | ||
# key: go-mod-${{ hashFiles('**/go.sum') }} | ||
# restore-keys: go-mod- | ||
- name: Build Docker Image | ||
shell: bash | ||
run: | | ||
IMAGE_TAG=${{ steps.extracter.outputs.git_tag }} | ||
echo "Start Building ${REGISTRY_NAME}:${IMAGE_TAG}" | ||
docker build -t ${REGISTRY_NAME}:${IMAGE_TAG} . | ||
docker tag ${REGISTRY_NAME}:${IMAGE_TAG} ${REGISTRY_NAME}:latest | ||
- name: Push Docker Image | ||
shell: bash | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY_IMAGE }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.MILVUSDB_DOCKER_USER }} | ||
password: ${{ secrets.MILVUSDB_DOCKER_PWD }} | ||
- name: Build and push by digest | ||
id: build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: ${{ matrix.platform }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true | ||
- name: Export digest | ||
run: | | ||
IMAGE_TAG=${{ steps.extracter.outputs.git_tag }} | ||
docker login -u ${{ secrets.MILVUSDB_DOCKER_USER }} \ | ||
-p ${{ secrets.MILVUSDB_DOCKER_PWD }} | ||
docker push ${REGISTRY_NAME}:${IMAGE_TAG} | ||
docker push ${REGISTRY_NAME}:latest | ||
tool-publish: | ||
name: Tool Publish Builder | ||
mkdir -p /tmp/digests | ||
digest="${{ steps.build.outputs.digest }}" | ||
touch "/tmp/digests/${digest#sha256:}" | ||
- name: Upload digest | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: digests-${{ env.PLATFORM_PAIR }} | ||
path: /tmp/digests/* | ||
if-no-files-found: error | ||
retention-days: 1 | ||
merge: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu18.04] | ||
env: | ||
OS_NAME: ${{ matrix.os }} | ||
REGISTRY_NAME: milvusdb/milvus-config-tool | ||
needs: | ||
- build | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Get version from system time after release step | ||
id: extracter | ||
run: | | ||
echo "::set-output name=git_tag::$(echo "${{ github.ref }}" | awk -F '/' '{print $3}')" | ||
- name: Build Docker Image | ||
shell: bash | ||
- name: Download digests | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: /tmp/digests | ||
pattern: digests-* | ||
merge-multiple: true | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY_IMAGE }} | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.MILVUSDB_DOCKER_USER }} | ||
password: ${{ secrets.MILVUSDB_DOCKER_PWD }} | ||
- name: Create manifest list and push | ||
working-directory: /tmp/digests | ||
run: | | ||
make docker-tool-build | ||
- name: Push Docker Image | ||
shell: bash | ||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | ||
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) | ||
- name: Inspect image | ||
run: | | ||
IMAGE_TAG=${{ steps.extracter.outputs.git_tag }} | ||
docker login -u ${{ secrets.MILVUSDB_DOCKER_USER }} \ | ||
-p ${{ secrets.MILVUSDB_DOCKER_PWD }} | ||
make docker-tool-push | ||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} | ||
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,101 @@ | ||
name: Release Config Tool | ||
|
||
# This workflow is triggered on new tag pushed to the repository. | ||
# ref doc: https://docs.docker.com/build/ci/github-actions/multi-platform/ | ||
on: | ||
push: | ||
branches: | ||
- "release_tool" | ||
env: | ||
REGISTRY_IMAGE: milvusdb/milvus-config-tool | ||
TAG: v0.2.0 | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: | ||
- linux/amd64 | ||
- linux/arm64 | ||
steps: | ||
- name: Prepare | ||
run: | | ||
platform=${{ matrix.platform }} | ||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Get version from system time after release step | ||
id: extracter | ||
run: | | ||
echo "::set-output name=git_tag::$(echo "${{ github.ref }}" | awk -F '/' '{print $3}')" | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY_IMAGE }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.MILVUSDB_DOCKER_USER }} | ||
password: ${{ secrets.MILVUSDB_DOCKER_PWD }} | ||
- name: Build and push by digest | ||
id: build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./tool.Dockerfile | ||
platforms: ${{ matrix.platform }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true | ||
- name: Export digest | ||
run: | | ||
mkdir -p /tmp/digests | ||
digest="${{ steps.build.outputs.digest }}" | ||
touch "/tmp/digests/${digest#sha256:}" | ||
- name: Upload digest | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: digests-${{ env.PLATFORM_PAIR }} | ||
path: /tmp/digests/* | ||
if-no-files-found: error | ||
retention-days: 1 | ||
merge: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
steps: | ||
- name: Download digests | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: /tmp/digests | ||
pattern: digests-* | ||
merge-multiple: true | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY_IMAGE }} | ||
tags: | | ||
${{ env.TAG }} | ||
latest | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.MILVUSDB_DOCKER_USER }} | ||
password: ${{ secrets.MILVUSDB_DOCKER_PWD }} | ||
- name: Create manifest list and push | ||
working-directory: /tmp/digests | ||
run: | | ||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | ||
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) | ||
- name: Inspect image | ||
run: | | ||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} | ||
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