Skip to content

Commit

Permalink
Merge pull request #6 from sumo-drosiek/drosiek-kubectl
Browse files Browse the repository at this point in the history
chore: adjust workflows to push kubectl image to ecr
  • Loading branch information
sumo-drosiek authored Apr 13, 2023
2 parents 16d54a8 + 3a4494a commit de727f7
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 19 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/build_and_push_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ on:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
SUFFIX:
required: true


jobs:
Expand All @@ -49,19 +51,19 @@ jobs:
# https://github.com/aws/containers-roadmap/issues/876
- name: Build and push image build cache to Docker Hub
if: ${{ inputs.push_cache }}
run: make push-image-cache
run: make push-image-cache-${{ secrets.SUFFIX }}
- name: Build and push image to Docker Hub
run: make push-image BUILD_TAG=${{ inputs.build_tag }}
run: make push-image-${{ secrets.SUFFIX }} BUILD_TAG=${{ inputs.build_tag }}
- name: Tag latest to point to most recent release in Docker Hub
if: ${{ inputs.tag_latest }}
run: make tag-release-image-with-latest BUILD_TAG=${{ inputs.build_tag }}
run: make tag-release-image-with-latest-${{ secrets.SUFFIX }} BUILD_TAG=${{ inputs.build_tag }}
- name: Login to ECR
run: make login-ecr
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Build and push image to ECR
run: make push-image-ecr BUILD_TAG=${{ inputs.build_tag }}
run: make push-image-ecr-${{ secrets.SUFFIX }} BUILD_TAG=${{ inputs.build_tag }}
- name: Tag latest to point to most recent release in ECR
if: ${{ inputs.tag_latest }}
run: make tag-release-image-with-latest-ecr BUILD_TAG=${{ inputs.build_tag }}
run: make tag-release-image-with-latest-ecr-${{ secrets.SUFFIX }} BUILD_TAG=${{ inputs.build_tag }}
16 changes: 14 additions & 2 deletions .github/workflows/dev_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Print tag
run: echo "Running dev build for ${{ steps.extract_tag.outputs.tag }}"
build-and-push-image:
uses: SumoLogic/sumologic-kubernetes-tools/.github/workflows/build_and_push_image.yml@main
uses: ./.github/workflows/build_and_push_image.yml
needs: extract-image-tag
with:
build_tag: ${{ needs.extract-image-tag.outputs.build_tag }}
Expand All @@ -33,5 +33,17 @@ jobs:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SUFFIX: tools
build-and-push-image-kubectl:
uses: ./.github/workflows/build_and_push_image.yml
needs: extract-image-tag
with:
build_tag: ${{ needs.extract-image-tag.outputs.build_tag }}
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_KUBECTL }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_KUBECTL }}
SUFFIX: kubectl
build-binaries:
uses: SumoLogic/sumologic-kubernetes-tools/.github/workflows/build_binaries.yml@main
uses: ./.github/workflows/build_binaries.yml
14 changes: 13 additions & 1 deletion .github/workflows/pre_release_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Print tag
run: echo "Running pre release build for ${{ steps.extract_tag.outputs.tag }}"
build-and-push-image:
uses: SumoLogic/sumologic-kubernetes-tools/.github/workflows/build_and_push_image.yml@main
uses: ./.github/workflows/build_and_push_image.yml
needs: extract-image-tag
with:
build_tag: ${{ needs.extract-image-tag.outputs.build_tag }}
Expand All @@ -29,3 +29,15 @@ jobs:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SUFFIX: tools
build-and-push-image-kubectl:
uses: ./.github/workflows/build_and_push_image.yml
needs: extract-image-tag
with:
build_tag: ${{ needs.extract-image-tag.outputs.build_tag }}
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_KUBECTL }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_KUBECTL }}
SUFFIX: kubectl
17 changes: 15 additions & 2 deletions .github/workflows/release_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Print tag
run: echo "Running release build for ${{ steps.extract_tag.outputs.tag }}"
build-and-push-image:
uses: SumoLogic/sumologic-kubernetes-tools/.github/workflows/build_and_push_image.yml@main
uses: ./.github/workflows/build_and_push_image.yml
needs: extract-image-tag
with:
build_tag: ${{ needs.extract-image-tag.outputs.build_tag }}
Expand All @@ -28,8 +28,21 @@ jobs:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SUFFIX: tools
build-and-push-image-kubectl:
uses: ./.github/workflows/build_and_push_image.yml
needs: extract-image-tag
with:
build_tag: ${{ needs.extract-image-tag.outputs.build_tag }}
tag_latest: true
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_KUBECTL }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_KUBECTL }}
SUFFIX: kubectl
build-binaries:
uses: SumoLogic/sumologic-kubernetes-tools/.github/workflows/build_binaries.yml@main
uses: ./.github/workflows/build_binaries.yml
create-release:
name: Create Github release
runs-on: ubuntu-20.04
Expand Down
25 changes: 16 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,37 @@ build-image-multiplatform-tools:
build-image-multiplatform-kubectl:
TAG=$(BUILD_TAG) docker buildx bake kubectl-multiplatform

tag-release-image-with-latest:
make push-image BUILD_TAG=latest
tag-release-image-with-latest-tools:
make push-image-tools BUILD_TAG=latest

tag-release-image-with-latest-ecr:
make tag-release-image-with-latest REPO_URL=$(ECR_REPO_URL)
tag-release-image-with-latest-kubectl:
make push-image-kubectl BUILD_TAG=latest

tag-release-image-with-latest-ecr-tools:
make tag-release-image-with-latest-tools REPO_URL=$(ECR_REPO_URL)

tag-release-image-with-latest-ecr-kubectl:
make tag-release-image-with-latest-kubectl REPO_URL=$(ECR_REPO_URL)

test-image:
./scripts/test-image.sh "$(IMAGE_NAME):$(BUILD_TAG)"

push-image-cache:
push-image-cache-tools:
# only push cache to Dockerhub as ECR doesn't support it yet
# https://github.com/aws/containers-roadmap/issues/876
docker buildx bake cache-multiplatform

push-image: push-image-tools push-image-kubectl

push-image-tools:
IMAGE=$(REPO_URL) TAG=$(BUILD_TAG) docker buildx bake tools-multiplatform --push

push-image-kubectl:
IMAGE=$(REPO_URL) TAG=$(BUILD_TAG) docker buildx bake kubectl-multiplatform --push

push-image-ecr:
make push-image REPO_URL=$(ECR_REPO_URL)
push-image-ecr-tools:
make push-image-tools REPO_URL=$(ECR_REPO_URL)

push-image-ecr-kubectl:
make push-image-kubectl REPO_URL=$(ECR_REPO_URL)

login:
echo "${DOCKER_PASSWORD}" | docker login -u sumodocker --password-stdin
Expand Down

0 comments on commit de727f7

Please sign in to comment.