Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>
  • Loading branch information
RealHarshThakur committed Jun 5, 2021
1 parent ca68793 commit ceab51c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 24 deletions.
33 changes: 16 additions & 17 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: release

on:
on:
create:
push:
branches:
- master
tags:
- v*
- 'v*'


jobs:
hnc-manager:
Expand All @@ -24,13 +25,12 @@ jobs:
run: |
echo "::set-output name=DATE::$(date -u +'%Y-%m-%dT%H:%M:%S%Z')"
# Setup gcloud CLI
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@master
with:
version: '270.0.0'
service_account_key: ${{ secrets.GCR_KEY }}


service_account_key: ${{ secrets.GCR_KEY }}
export_default_credentials: true

# Configure docker to use the gcloud command-line tool as a credential helper
- run: |
# Set up docker to authenticate
Expand All @@ -39,20 +39,19 @@ jobs:
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
uses: docker/metadata-action@v3
with:
# add each registry to which the image needs to be pushed here
images: |
gcr.io/k8s-staging-multitenancy/hnc-manager
tag-latest: true
tag-semver: |
{{version}}
images: gcr.io/k8s-staging-multitenancy/hnc-manager
tags: |
type=raw,value=multiarch-{{branch}}
- name: Print Tags
run: |
echo "${{ steps.docker_meta.outputs.tags }}"
echo "RELEASE TAG: ${RELEASE_TAG}"
## QEMU is an emulator which makes it possible to transalte instruction sets to different platforms.
## In this step, we setup the driver which Docker can use to build images on different platforms
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
Expand Down
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,17 @@ docker-build: generate fmt vet
docker build . -t ${HNC_IMG}


buildx-setup:
## This script needs to be run to start the emulator for multiarch builds
# This driver translates the instruction set to different platforms
docker run --rm --privileged linuxkit/binfmt:v0.8
docker buildx create --use --name=qemu
docker buildx inspect --bootstrap


# Build and push multi-arch image
multiarch: generate fmt vet
docker-push-multi: buildx-setup generate fmt vet
@echo "Warning: this does not run tests. Run 'make test' to ensure tests are passing."
bash ./hack/buildx.sh
docker buildx build \
--push \
--platform linux/arm64,linux/amd64,linux/arm/v7 --tag ${HNC_IMG} .
Expand Down
5 changes: 5 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,8 @@ steps:
- '$_HNC_USER:$_HNC_PERSONAL_ACCESS_TOKEN'
- 'https://uploads.github.com/repos/$_HNC_REPO_OWNER/hierarchical-namespaces/releases/$_HNC_RELEASE_ID/assets?name=krew-kubectl-hns.yaml'

# Build Docker image
- name: gcr.io/cloud-builders/docker
args: ['build', '-t', 'gcr.io/$PROJECT_ID/$_HNC_IMG_NAME:$_HNC_IMG_TAG', 'hierarchical-namespaces']

images: ['gcr.io/$PROJECT_ID/$_HNC_IMG_NAME:$_HNC_IMG_TAG']
5 changes: 0 additions & 5 deletions hack/buildx.sh
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@
## This script needs to be run to start the emulator for multiarch builds

docker run --rm --privileged linuxkit/binfmt:v0.8
docker buildx create --use --name=qemu
docker buildx inspect --bootstrap

0 comments on commit ceab51c

Please sign in to comment.