Skip to content

Commit

Permalink
Add s390x arch support (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-claire authored Oct 27, 2021
1 parent 8660674 commit 5d2ec39
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 3 deletions.
70 changes: 69 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ steps:
image: rancher/hardened-build-base:v1.16.7b7
commands:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- make DRONE_TAG=${DRONE_TAG} image-push image-manifest
- make DRONE_TAG=${DRONE_TAG} image-push
environment:
DOCKER_PASSWORD:
from_secret: docker_password
Expand All @@ -47,4 +47,72 @@ volumes:
host:
path: /var/run/docker.sock

---
kind: pipeline
type: docker
name: linux-s390x

platform:
os: linux
arch: amd64

node:
arch: s390x

steps:
- name: build
pull: always
image: rancher/hardened-build-base:v1.16.9b7
failure: ignore
commands:
- make DRONE_TAG=${DRONE_TAG}
volumes:
- name: docker
path: /var/run/docker.sock

- name: publish
image: rancher/hardened-build-base:v1.16.9b7
failure: ignore
commands:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- make DRONE_TAG=${DRONE_TAG} image-push
environment:
DOCKER_PASSWORD:
from_secret: docker_password
DOCKER_USERNAME:
from_secret: docker_username
volumes:
- name: docker
path: /var/run/docker.sock
when:
event:
- tag

volumes:
- name: docker
host:
path: /var/run/docker.sock
---
kind: pipeline
type: docker
name: manifest
platform:
os: linux
arch: amd64
steps:
- name: push
image: plugins/manifest:1.2.3
settings:
password:
from_secret: docker_password
username:
from_secret: docker_username
spec: manifest.tmpl
ignore_missing: true
when:
event:
- tag
depends_on:
- linux-amd64
- linux-s390x
...
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG UBI_IMAGE=registry.access.redhat.com/ubi7/ubi-minimal:latest
ARG GO_IMAGE=rancher/hardened-build-base:v1.16.7b7
ARG GO_IMAGE=rancher/hardened-build-base:v1.16.9b7
FROM ${UBI_IMAGE} as ubi
FROM ${GO_IMAGE} as builder
# setup required packages
Expand All @@ -15,6 +15,7 @@ RUN set -x \
ARG PKG="github.com/kubernetes-incubator/metrics-server"
ARG SRC="github.com/kubernetes-sigs/metrics-server"
ARG TAG="v0.5.0"
ARG ARCH="amd64"
RUN git clone --depth=1 https://${SRC}.git $GOPATH/src/${PKG}
WORKDIR $GOPATH/src/${PKG}
RUN git fetch --all --tags --prune
Expand Down Expand Up @@ -44,7 +45,9 @@ RUN GO111MODULE=$(if echo ${TAG} | grep -qE '^v0\.3\.'; then echo off; fi) \
" \
go-build-static.sh -gcflags=-trimpath=${GOPATH}/src -o bin/metrics-server ./cmd/metrics-server
RUN go-assert-static.sh bin/*
RUN go-assert-boring.sh bin/*
RUN if [ "${ARCH}" != "s390x" ]; then \
go-assert-boring.sh bin/*; \
fi
RUN install -s bin/* /usr/local/bin
RUN metrics-server --help

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ image-build:
--pull \
--build-arg PKG=$(PKG) \
--build-arg SRC=$(SRC) \
--build-arg ARCH=$(ARCH) \
--build-arg TAG=$(TAG:$(BUILD_META)=) \
--tag $(ORG)/hardened-k8s-metrics-server:$(TAG) \
--tag $(ORG)/hardened-k8s-metrics-server:$(TAG)-$(ARCH) \
Expand Down
12 changes: 12 additions & 0 deletions manifest.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
image: rancher/metrics-server:{{build.tag}}
manifests:
-
image: rancher/metrics-server:{{build.tag}}-amd64
platform:
architecture: amd64
os: linux
-
image: rancher/metrics-server:{{build.tag}}-s390x
platform:
architecture: s390x
os: linux

0 comments on commit 5d2ec39

Please sign in to comment.