Skip to content

Commit

Permalink
add support for ARM64 in build-tools Dockerfile (kedacore#3094)
Browse files Browse the repository at this point in the history
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
xoanmm and dependabot[bot] authored Jun 4, 2022
1 parent 21fcd64 commit c00294c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 31 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,11 @@ jobs:
# Server address of Docker registry. If not set then will default to Docker Hub
registry: ghcr.io

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and publish Tools image
run: make publish-build-tools
14 changes: 3 additions & 11 deletions .github/workflows/fossa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,12 @@ on:
jobs:
build:
runs-on: ubuntu-latest
# build-tools is built from ../../tools/build-tools.Dockerfile
container: ghcr.io/kedacore/build-tools:main
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
- run: go version
# Runs a set of commands to initialize and analyze with FOSSA
- name: run FOSSA analysis
env:
FOSSA_API_KEY: 'b0bfb312cf03c6c63752afaa5c98c7c8'
run: |
export GOPATH=$HOME/go
export PATH=$PATH:$(go env GOPATH)/bin
fossa init
fossa analyze
- uses: fossas/fossa-action@main
with:
api-key: "b0bfb312cf03c6c63752afaa5c98c7c8"
8 changes: 8 additions & 0 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ jobs:
tools:
- 'tools/**'
- name: Set up QEMU
if: steps.filter.outputs.tools == 'true'
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
if: steps.filter.outputs.tools == 'true'
uses: docker/setup-buildx-action@v2

- name: Build tools
if: steps.filter.outputs.tools == 'true'
run: make docker-build-tools
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ To learn more about our roadmap, we recommend reading [this document](ROADMAP.md

- **General:** Fix devcontainer on ARM64 Arch. ([3084](https://github.com/kedacore/keda/issues/3084))
- **General:** Improve e2e on PR process. ([3004](https://github.com/kedacore/keda/issues/3004))
- **General:** Unify the used tooling on different workflows and arch. ([3092](https://github.com/kedacore/keda/issues/3092))
- **General:** Use Github's Checks API for e2e tests on PR. ([2567](https://github.com/kedacore/keda/issues/2567))

## v2.7.1
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

.PHONY: docker-build-tools
docker-build-tools: ## Build build-tools image
docker build -f tools/build-tools.Dockerfile -t $(IMAGE_BUILD_TOOLS) .
docker-build-tools: ## Build multi-arch Docker image for build-tools.
docker buildx build --platform=${BUILD_PLATFORMS} -f tools/build-tools.Dockerfile -t ${IMAGE_BUILD_TOOLS} .

.PHONY: publish-build-tools
publish-build-tools: docker-build-tools ## Publish build-tools image
docker push $(IMAGE_BUILD_TOOLS)
publish-build-tools: ## Build and push multi-arch Docker image for build-tools.
docker buildx build --push --platform=${BUILD_PLATFORMS} -f tools/build-tools.Dockerfile -t ${IMAGE_BUILD_TOOLS} .

.PHONY: docker-build-dev-containers
docker-build-dev-containers: ## Build dev-containers image
Expand Down
29 changes: 13 additions & 16 deletions tools/build-tools.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN apt update && \
apt-get install software-properties-common -y
RUN apt-add-repository ppa:git-core/ppa && \
apt update && \
apt install -y wget curl build-essential git git-lfs
apt install -y wget curl build-essential git git-lfs unzip

# Use Bash instead of Dash
RUN ln -sf bash /bin/sh
Expand All @@ -15,7 +15,7 @@ RUN apt-get install apt-transport-https lsb-release dirmngr -y && \
curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | \
tee /etc/apt/trusted.gpg.d/microsoft.asc.gpg > /dev/null && \
AZ_REPO=$(lsb_release -cs) && \
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \
echo "deb [arch=$(dpkg --print-architecture)] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \
tee /etc/apt/sources.list.d/azure-cli.list && \
apt-key --keyring /etc/apt/trusted.gpg.d/Microsoft.gpg adv \
--keyserver keyserver.ubuntu.com \
Expand All @@ -26,24 +26,24 @@ RUN apt-get install apt-transport-https lsb-release dirmngr -y && \
# Install docker
RUN apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common lsb-release && \
curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - 2>/dev/null && \
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" && \
add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" && \
apt-get update &&\
apt-get install -y docker-ce-cli

# Install golang
RUN GO_VERSION=1.17.9 && \
curl -LO https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz && \
go_sha256=9dacf782028fdfc79120576c872dee488b81257b1c48e9032d122cfdb379cca6 && \
echo "$go_sha256 go${GO_VERSION}.linux-amd64.tar.gz" | sha256sum -c - && \
tar -C /usr/local -xvzf go${GO_VERSION}.linux-amd64.tar.gz && \
rm -rf go${GO_VERSION}.linux-amd64.tar.gz
curl -LO https://golang.org/dl/go${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz && \
ARCH=$(dpkg --print-architecture) && if [ ${ARCH} == "amd64" ]; then go_sha256="9dacf782028fdfc79120576c872dee488b81257b1c48e9032d122cfdb379cca6" ; elif [ ${ARCH} == "arm64" ]; then go_sha256="44dcdcd4f0fa6f83c15ef70b31580f1e3f95895c2f11a00e36c440c3554b6ad5" ; fi && \
echo "$go_sha256 go${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz" | sha256sum -c - && \
tar -C /usr/local -xvzf go${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz && \
rm -rf go${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz

# Install kubectl
RUN apt-get update && apt-get install -y apt-transport-https && \
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list && \
apt-get update && \
apt-get install -y kubectl
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/$(dpkg --print-architecture)/kubectl" && \
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/$(dpkg --print-architecture)/kubectl.sha256" && \
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check && \
chmod +x ./kubectl && mv ./kubectl /usr/bin/kubectl && \
rm kubectl.sha256

# Install node
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
Expand All @@ -65,9 +65,6 @@ ENV GOROOT=/usr/local/go
ENV GOPATH=/go
ENV PATH=${PATH}:${GOPATH}/bin

# Install FOSSA tooling
RUN curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | bash

# Install gh
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \
Expand Down

0 comments on commit c00294c

Please sign in to comment.