Skip to content

Commit 38fafc4

Browse files
authored
Merge pull request #154 from rohitsakala/rohit/s390x
Add s390x arch support
2 parents dd93b30 + 062400d commit 38fafc4

3 files changed

Lines changed: 83 additions & 2 deletions

File tree

.drone.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,78 @@ volumes:
136136

137137
---
138138

139+
kind: pipeline
140+
name: s390x
141+
142+
platform:
143+
os: linux
144+
arch: amd64
145+
146+
node:
147+
arch: s390x
148+
149+
steps:
150+
- name: build
151+
pull: default
152+
image: rancher/dapper:v0.5.8
153+
commands:
154+
- dapper ci
155+
privileged: true
156+
volumes:
157+
- name: docker
158+
path: /var/run/docker.sock
159+
when:
160+
event:
161+
- tag
162+
- pull_request
163+
164+
- name: github_binary_release
165+
image: rancher/drone-images:github-release-s390x
166+
settings:
167+
api_key:
168+
from_secret: github_token
169+
files:
170+
- "dist/artifacts/*"
171+
when:
172+
instance:
173+
- drone-publish.rancher.io
174+
ref:
175+
- refs/head/master
176+
- refs/tags/*
177+
event:
178+
- tag
179+
180+
- name: stage-binaries
181+
image: rancher/dapper:v0.5.8
182+
commands:
183+
- "cp -r ./bin/* ./package/"
184+
when:
185+
event:
186+
- tag
187+
188+
- name: docker-publish
189+
image: rancher/drone-images:docker-s390x
190+
settings:
191+
purge: false
192+
context: package/
193+
dockerfile: package/Dockerfile
194+
password:
195+
from_secret: docker_password
196+
repo: rancher/machine
197+
tag: "${DRONE_TAG}-s390x"
198+
username:
199+
from_secret: docker_username
200+
when:
201+
event:
202+
- tag
203+
204+
volumes:
205+
- name: docker
206+
host:
207+
path: /var/run/docker.sock
208+
209+
---
210+
139211
kind: pipeline
140212
name: manifest
141213

@@ -150,6 +222,7 @@ steps:
150222
platforms:
151223
- linux/amd64
152224
- linux/arm64
225+
- linux/s390x
153226
target: "rancher/machine:${DRONE_TAG}"
154227
template: "rancher/machine:${DRONE_TAG}-ARCH"
155228
when:
@@ -168,3 +241,4 @@ trigger:
168241
depends_on:
169242
- amd64
170243
- arm64
244+
- s390x

Dockerfile.dapper

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ RUN apt-get update && \
77
apt-get install -y gcc ca-certificates git wget curl vim less file && \
88
rm -f /bin/sh && ln -s /bin/bash /bin/sh
99

10-
ENV GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm=armv6l GOLANG_ARCH_arm64=arm64 GOLANG_ARCH=GOLANG_ARCH_${ARCH} \
10+
ENV GOLANG_ARCH_s390x=s390x GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm=armv6l GOLANG_ARCH_arm64=arm64 GOLANG_ARCH=GOLANG_ARCH_${ARCH} \
1111
GOPATH=/go PATH=/go/bin:/usr/local/go/bin:${PATH} SHELL=/bin/bash
1212

1313
RUN wget -O - https://storage.googleapis.com/golang/go1.15.6.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local
@@ -20,7 +20,13 @@ ENV DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-1.10.3 \
2020
DOCKER_URL_arm64=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm64 \
2121
DOCKER_URL=DOCKER_URL_${ARCH}
2222

23-
RUN wget -O - ${!DOCKER_URL} > /usr/bin/docker && chmod +x /usr/bin/docker
23+
RUN if [ "${ARCH}" == "s390x" ]; then \
24+
curl -L https://download.docker.com/linux/static/stable/s390x/docker-18.06.3-ce.tgz | tar xzvf - && \
25+
cp docker/docker /usr/bin/ && \
26+
chmod +x /usr/bin/docker; \
27+
else \
28+
wget -O - ${!DOCKER_URL} > /usr/bin/docker && chmod +x /usr/bin/docker; \
29+
fi
2430

2531
ENV DAPPER_ENV CROSS DRONE_TAG
2632
ENV DAPPER_SOURCE /go/src/github.com/rancher/machine/

scripts/build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ if [ "$CROSS" = 1 ]; then
1212
CGO_ENABLED=0 GOOS=windows go build -ldflags "-X main.VERSION=$VERSION" -o ./bin/rancher-machine-Windows-x86_64.exe ./cmd/rancher-machine
1313
CGO_ENABLED=0 GOARCH=arm64 go build -a -tags netgo -installsuffix netgo -ldflags "-X main.VERSION=$VERSION" -o ./bin/rancher-machine-Linux-arm64 ./cmd/rancher-machine
1414
CGO_ENABLED=0 GOARCH=ppc64le go build -a -tags netgo -installsuffix netgo -ldflags "-X main.VERSION=$VERSION" -o ./bin/rancher-machine-Linux-ppc64le ./cmd/rancher-machine
15+
CGO_ENABLED=0 GOARCH=s390x go build -a -tags netgo -installsuffix netgo -ldflags "-X main.VERSION=$VERSION" -o ./bin/rancher-machine-Linux-s390x ./cmd/rancher-machine
1516
CGO_ENABLED=0 GOARCH=arm GOARM=6 go build -a -tags netgo -installsuffix netgo -ldflags "-X main.VERSION=$VERSION" -o ./bin/rancher-machine-Linux-arm ./cmd/rancher-machine
1617
CGO_ENABLED=0 GOARCH=arm GOARM=6 go build -a -tags netgo -installsuffix netgo -ldflags "-X main.VERSION=$VERSION" -o ./bin/rancher-machine-Linux-armv6l ./cmd/rancher-machine
1718
CGO_ENABLED=0 GOARCH=arm GOARM=7 go build -a -tags netgo -installsuffix netgo -ldflags "-X main.VERSION=$VERSION" -o ./bin/rancher-machine-Linux-armv7l ./cmd/rancher-machine

0 commit comments

Comments
 (0)