Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix quay manifest cache issue #672

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ env:

jobs:
lint:
name: 'Lint'
name: "Lint"
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand All @@ -48,12 +48,12 @@ jobs:
make lint

build_test:
name: 'Build and Test'
name: "Build and Test"
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v2-beta
uses: actions/setup-go@v2
with:
go-version: 1.13
id: go
Expand All @@ -76,7 +76,7 @@ jobs:
kubectl logs -n gatekeeper-system -l control-plane=controller-manager

helm_build_test:
name: '[Helm] Build and Test'
name: "[Helm] Build and Test"
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
Expand Down Expand Up @@ -104,8 +104,8 @@ jobs:
kubectl logs -n gatekeeper-system -l control-plane=controller-manager

pre-release:
name: 'Pre Release'
runs-on: 'ubuntu-latest'
name: "Pre Release"
runs-on: "ubuntu-latest"
if: github.ref == 'refs/heads/master' && github.event_name == 'push' && github.repository == 'open-policy-agent/gatekeeper'
needs: [lint, build_test, helm_build_test]
timeout-minutes: 30
Expand All @@ -126,16 +126,16 @@ jobs:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

- uses: 'marvinpinto/[email protected]'
- uses: "marvinpinto/[email protected]"
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: true
automatic_release_tag: latest
title: 'Development Build'
title: "Development Build"

tagged-release:
name: 'Tagged Release'
runs-on: 'ubuntu-latest'
name: "Tagged Release"
runs-on: "ubuntu-latest"
if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'open-policy-agent/gatekeeper'
needs: [lint, build_test, helm_build_test]
timeout-minutes: 30
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
make e2e-verify-release IMG=${{ env.IMAGE_REPO }}:${TAG} USE_LOCAL_IMG=false

- name: Create GitHub release
uses: 'marvinpinto/[email protected]'
uses: "marvinpinto/[email protected]"
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
30 changes: 24 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -195,19 +195,37 @@ docker-buildx-dev: test
@if ! DOCKER_CLI_EXPERIMENTAL=enabled docker buildx ls | grep -q container-builder; then\
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx create --name container-builder --use;\
fi
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform "linux/amd64,linux/arm64,linux/arm/v7" \
-t $(REPOSITORY):$(DEV_TAG) \
-t $(REPOSITORY):dev \
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform "linux/amd64" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't the issue and also defeats the purpose of a multi-arch image where we don't want to re-tag them rather we want an image that is already multi-arch.

This should remain being

	DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform "linux/amd64,linux/arm64,linux/arm/v7" \
		-t $(REPOSITORY):$(DEV_TAG) \
		. --push

Copy link
Member Author

@sozercan sozercan Jun 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a workaround for the Quay issue. We can not push same tag to Quay twice using buildx, which will be required for release (pushing latest + version).

Open to suggestions for another fix or workaround

-t $(REPOSITORY):$(DEV_TAG)-linux-amd64 \
. --push
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform "linux/arm64" \
-t $(REPOSITORY):$(DEV_TAG)-linux-arm64 \
. --push
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform "linux/arm/v7" \
-t $(REPOSITORY):$(DEV_TAG)-linux-armv7 \
. --push
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create $(REPOSITORY):$(DEV_TAG) $(REPOSITORY):$(DEV_TAG)-linux-amd64 $(REPOSITORY):$(DEV_TAG)-linux-arm64 $(REPOSITORY):$(DEV_TAG)-linux-armv7
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create $(REPOSITORY):dev $(REPOSITORY):$(DEV_TAG)-linux-amd64 $(REPOSITORY):$(DEV_TAG)-linux-arm64 $(REPOSITORY):$(DEV_TAG)-linux-armv7
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push $(REPOSITORY):$(DEV_TAG)
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push $(REPOSITORY):dev
Comment on lines +209 to +210
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see this in my previous PR until now, we don't need both these to be pushed

	DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push $(REPOSITORY):$(DEV_TAG)
	DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push $(REPOSITORY):dev

Makefile L7 DEV_TAG ?= dev which means you're effectively just pushing the same tag twice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not pushing the same tag twice. If you look at the comment above L7, DEV_TAG gets overriden by 7-digit SHA. It's pushing SHA tag + dev tag (so it's easier to grab the latest dev tag)


docker-buildx-release: test
@if ! DOCKER_CLI_EXPERIMENTAL=enabled docker buildx ls | grep -q container-builder; then\
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx create --name container-builder --use;\
fi
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform "linux/amd64,linux/arm64,linux/arm/v7" \
-t $(REPOSITORY):$(VERSION) \
-t $(REPOSITORY):latest \
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform "linux/amd64" \
-t $(REPOSITORY):$(VERSION)-linux-amd64 \
. --push
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform "linux/arm64" \
-t $(REPOSITORY):$(VERSION)-linux-arm64 \
. --push
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform "linux/arm/v7" \
-t $(REPOSITORY):$(VERSION)-linux-armv7 \
. --push
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create $(REPOSITORY):$(VERSION) $(REPOSITORY):$(VERSION)-linux-amd64 $(REPOSITORY):$(VERSION)-linux-arm64 $(REPOSITORY):$(VERSION)-linux-armv7
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create $(REPOSITORY):latest $(REPOSITORY):$(VERSION)-linux-amd64 $(REPOSITORY):$(VERSION)-linux-arm64 $(REPOSITORY):$(VERSION)-linux-armv7
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push $(REPOSITORY):$(VERSION)
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push $(REPOSITORY):latest

# Update manager_image_patch.yaml with image tag
patch-image:
Expand Down