build_image_spdk_core_amd #893
This file contains hidden or 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
| name: build_image_spdk_core_amd | |
| on: | |
| workflow_run: | |
| workflows: ["build_image_spdk_core_arm"] | |
| types: | |
| - completed | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| steps: | |
| - name: Checkout the triggered branch | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ github.event.workflow_run.head_branch }} | |
| - name: Set branch name from triggered workflow | |
| run: echo "BRANCH_NAME=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_ENV | |
| - name: Build the docker image | |
| run: docker build --file docker/Dockerfile_spdk --tag simplyblock/spdk-core:$BRANCH_NAME-amd64 . | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v1 | |
| with: | |
| username: hamdysimplyblock | |
| password: ${{ secrets.DOCKER_PASS }} | |
| - name: Push Images | |
| run: docker push simplyblock/spdk-core:$BRANCH_NAME-amd64 | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v1 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_HAMDI }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_HAMDI }} | |
| aws-region: us-east-1 | |
| - name: Login to ECR | |
| id: login-ecr | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| - name: Tag docker image | |
| run: docker tag simplyblock/spdk-core:$BRANCH_NAME-amd64 565979732541.dkr.ecr.us-east-1.amazonaws.com/spdk-core:$BRANCH_NAME-amd64 | |
| - name: Push the docker image | |
| run: docker image push 565979732541.dkr.ecr.us-east-1.amazonaws.com/spdk-core:$BRANCH_NAME-amd64 | |
| - name: Install jq | |
| run: sudo apt-get update && sudo apt-get install -y jq | |
| - name: Create the manifest | |
| run: | | |
| set -euo pipefail | |
| need_ref() { j="$(docker manifest inspect "$1" 2>/dev/null || true)"; echo "$j" | jq -e '.manifests' >/dev/null 2>&1 && d="$(echo "$j" | jq -r --arg a "$2" '.manifests[]|select(.platform.architecture==$a)|.digest' | head -n1)" && [ -n "$d" ] && echo "${1%:*}@$d" || echo "$1"; } | |
| DH_ARM="$(need_ref simplyblock/spdk-core:$BRANCH_NAME-arm64 arm64)" | |
| DH_AMD="$(need_ref simplyblock/spdk-core:$BRANCH_NAME-amd64 amd64)" | |
| ECR_ARM="$(need_ref 565979732541.dkr.ecr.us-east-1.amazonaws.com/spdk-core:$BRANCH_NAME-arm64 arm64)" | |
| ECR_AMD="$(need_ref 565979732541.dkr.ecr.us-east-1.amazonaws.com/spdk-core:$BRANCH_NAME-amd64 amd64)" | |
| docker manifest create simplyblock/spdk-core:$BRANCH_NAME-latest "$DH_ARM" "$DH_AMD" | |
| docker manifest create 565979732541.dkr.ecr.us-east-1.amazonaws.com/spdk-core:$BRANCH_NAME-latest "$ECR_ARM" "$ECR_AMD" | |
| docker manifest annotate simplyblock/spdk-core:$BRANCH_NAME-latest "$DH_ARM" --arch arm64 | |
| docker manifest annotate simplyblock/spdk-core:$BRANCH_NAME-latest "$DH_AMD" --arch amd64 | |
| docker manifest annotate 565979732541.dkr.ecr.us-east-1.amazonaws.com/spdk-core:$BRANCH_NAME-latest "$ECR_ARM" --arch arm64 | |
| docker manifest annotate 565979732541.dkr.ecr.us-east-1.amazonaws.com/spdk-core:$BRANCH_NAME-latest "$ECR_AMD" --arch amd64 | |
| docker manifest push simplyblock/spdk-core:$BRANCH_NAME-latest | |
| docker manifest push 565979732541.dkr.ecr.us-east-1.amazonaws.com/spdk-core:$BRANCH_NAME-latest |