-
Notifications
You must be signed in to change notification settings - Fork 37
Add release workflow #12
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
Changes from 6 commits
edbd1af
41f3021
4055e1d
da3fcd2
7067131
2e6fa28
3edcd68
4b7f804
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Release | ||
| on: | ||
| push: | ||
| tags: | ||
| - "*" | ||
| jobs: | ||
| buildx: | ||
| name: Build & Push Multi Arch Images | ||
| runs-on: ubuntu-18.04 | ||
| steps: | ||
| - name: Checkout code | ||
| # actions/checkout@v2.0.0 | ||
| uses: actions/checkout@722adc6 | ||
| - name: Configure gcloud | ||
| # linkerd/linkerd2-action-gcloud@v1.0.1 | ||
| uses: linkerd/linkerd2-action-gcloud@308c4df | ||
| with: | ||
| cloud_sdk_service_account_key: ${{ secrets.CLOUD_SDK_SERVICE_ACCOUNT_KEY }} | ||
| gcp_project: ${{ secrets.GCP_PROJECT }} | ||
| gcp_zone: ${{ secrets.GCP_ZONE }} | ||
| - name: Set up Docker Buildx | ||
| # crazy-max/ghaction-docker-buildx@v3.1.0 | ||
| uses: crazy-max/ghaction-docker-buildx@373dafb | ||
| - name: Docker Buildx (build) | ||
| run: make images | ||
| - name: Docker Buildx (push) | ||
| run: make push | ||
| - name: Docker Check Manifest | ||
| run: make inspect-manifest | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| DOCKER_REGISTRY ?= gcr.io/linkerd-io | ||
| REPO = $(DOCKER_REGISTRY)/proxy-init | ||
| TESTER_REPO = buoyantio/iptables-tester | ||
| VERSION ?= $(shell git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD) | ||
| SUPPORTED_ARCHS = linux/amd64,linux/arm64,linux/arm/v7 | ||
| PUSH_IMAGE ?= false | ||
|
|
||
| .DEFAULT_GOAL := help | ||
|
|
||
|
|
@@ -39,7 +42,7 @@ integration-test: image ## Perform integration test | |
| ############### | ||
| .PHONY: image | ||
| image: ## Build docker image for the project | ||
| docker build -t $(REPO):latest . | ||
| DOCKER_BUILDKIT=1 docker build -t $(REPO):latest . | ||
|
|
||
| .PHONY: tester-image | ||
| tester-image: ## Build docker image for the tester component | ||
|
|
@@ -49,3 +52,27 @@ tester-image: ## Build docker image for the tester component | |
| kind-load: image tester-image ## Load the required image to KinD cluster | ||
| kind load docker-image $(REPO):latest | ||
| kind load docker-image $(TESTER_REPO):v1 | ||
|
|
||
| .PHONY: images | ||
| images: ## Build multi arch docker images for the project | ||
| docker buildx build \ | ||
| --platform $(SUPPORTED_ARCHS) \ | ||
| --output "type=image,push=$(PUSH_IMAGE)" \ | ||
| --tag $(REPO):$(VERSION) \ | ||
| --tag $(REPO):latest \ | ||
|
Comment on lines
+57
to
+62
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this only works OOB with Docker Desktop, right? Specifically, it only works with a Buildx builder that uses the Assuming that we want the Makefile to work outside of Docker Desktop and CI too, we should add some instructions like the following to the README: On some environments where the default Buildx builder doesn't use the Use the following commands to create a builder that uses the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, instructions in the readme or directly in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can script it as a different make target (say,
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is also possible, I will try it out.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ihcsim
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AIUI, if the Dockerfile has the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAICT, the buildx github action has to do the same thing. See https://github.com/crazy-max/ghaction-docker-buildx/blob/44fd46c7833e095f13bb1d8ace66bd821198bfef/src/main.ts#L24-L38. |
||
| . | ||
|
|
||
| .PHONY: push | ||
| push: ## Push multi arch docker images to the registry | ||
| PUSH_IMAGE=true make images | ||
|
|
||
| .PHONY: inspect-manifest | ||
| inspect-manifest: ## Check the resulting images supported architecture | ||
| docker run --rm mplatform/mquery $(REPO):$(VERSION) | ||
| docker run --rm mplatform/mquery $(REPO):latest | ||
|
|
||
| .PHONY: builder | ||
| builder: ## Create the Buildx builder instance | ||
| docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | ||
| docker buildx create --name=multiarch-builder --driver=docker-container --platform="$(SUPPORTED_ARCHS)" --use | ||
| docker buildx inspect multiarch-builder --bootstrap | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,3 +19,11 @@ Then run the tests with: | |
| ```bash | ||
| make integration-test | ||
| ``` | ||
|
|
||
| # Build Multi-Architecture Docker Images with Buildx | ||
|
|
||
| Please refer to https://docs.docker.com/buildx/working-with-buildx/ to enable Buildx. | ||
|
|
||
| Run `make builder` to create Buildx instance before starting to build the images. | ||
|
|
||
| Run `make images` to start build the images. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for adding this section. Can we provide more context around why and when a user will need to run In some local environments like Ubuntu, where the default Buildx builder uses the To fix this, you can create a new Buildx builder instance by running |
||
Uh oh!
There was an error while loading. Please reload this page.