Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit 86aacf0

Browse files
TriplEightsoc1c
authored andcommitted
Update publishing (#10644)
* docker images are now built on k8s: test run * copy check_sync.sh in build-linux job * copy scripts/docker/hub/* in build-linux job * removed cache var * cleanup, no more nightly dockers * cleanup in dockerfile * some new tags * removed sccsche debug log, cleanup * no_gits, new artifacts dir, changed scripts. Test run. * define version once * one source for TRACK * stop kovan onchain updates * moved changes for two images to a new branch * rename Dockerfile * no need in libudev-dev
1 parent 0afcbe4 commit 86aacf0

File tree

7 files changed

+137
-67
lines changed

7 files changed

+137
-67
lines changed

.gitlab-ci.yml

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ variables:
3232
expire_in: 1 mos
3333
paths:
3434
- artifacts/
35+
- tools/
3536

3637
.docker-cache-status: &docker-cache-status
3738
variables:
3839
CARGO_HOME: "/ci-cache/parity-ethereum/cargo/${CI_JOB_NAME}"
3940
dependencies: []
4041
before_script:
42+
- rustup show
43+
- cargo --version
4144
- SCCACHE_ERROR_LOG=/builds/parity/parity-ethereum/sccache_debug.log
4245
RUST_LOG=sccache=debug
4346
sccache --start-server
@@ -46,10 +49,7 @@ variables:
4649
# sccache debug info
4750
- if test -e sccache_debug.log;
4851
then
49-
echo "_____sccache_debug.log listing start:_____";
50-
cat sccache_debug.log;
51-
echo "_____sccache_debug.log listing end_____";
52-
echo "All crate-types:";
52+
echo "_____All crate-types:_____";
5353
grep 'parse_arguments.*--crate-type' sccache_debug.log | sed -re 's/.*"--crate-type", "([^"]+)".*/\1/' | sort | uniq -c;
5454
echo "_____Non-cacheable reasons:_____";
5555
grep CannotCache sccache_debug.log | sed -re 's/.*CannotCache\((.+)\).*/\1/' | sort | uniq -c;
@@ -67,6 +67,16 @@ variables:
6767
script:
6868
- scripts/gitlab/build-linux.sh
6969
- sccache -s
70+
after_script:
71+
- mkdir -p tools
72+
- cp -r scripts/docker/hub/* ./tools
73+
- cp scripts/gitlab/publish-snap.sh ./tools
74+
- cp scripts/gitlab/publish-onchain.sh ./tools
75+
- cp scripts/gitlab/safe-curl.sh ./tools
76+
- echo v"$(sed -r -n '1,/^version/s/^version\s*=\s*"([^"]+)".*$/\1/p' Cargo.toml)" |
77+
tee ./tools/VERSION
78+
- echo "$(sed -r -n '1,/^track/s/^track\s*=\s*"([^"]+)".*$/\1/p' ./util/version/Cargo.toml)" |
79+
tee ./tools/TRACK
7080

7181

7282
cargo-check 0 3:
@@ -195,19 +205,35 @@ build-windows:
195205

196206
publish-docker:
197207
stage: publish
208+
<<: *no_git
198209
only: *releaseable_branches
199-
cache: {}
210+
except:
211+
variables:
212+
- $SCHEDULE_TAG == "nightly"
200213
dependencies:
201214
- build-linux
202-
tags:
203-
- shell
215+
environment:
216+
name: parity-build
217+
cache: {}
218+
image: docker:stable
219+
services:
220+
- docker:dind
221+
variables:
222+
DOCKER_HOST: tcp://localhost:2375
223+
DOCKER_DRIVER: overlay2
224+
GIT_STRATEGY: none
225+
# DOCKERFILE: tools/Dockerfile
226+
# CONTAINER_IMAGE: parity/parity
204227
script:
205-
- scripts/gitlab/publish-docker.sh parity
228+
# we stopped pushing nightlies to dockerhub, will push to own registry prb.
229+
- ./tools/publish-docker.sh
230+
tags:
231+
- kubernetes-parity-build
206232

207233
publish-snap: &publish-snap
208234
stage: publish
235+
<<: *no_git
209236
only: *releaseable_branches
210-
<<: *collect_artifacts
211237
image: snapcore/snapcraft
212238
variables:
213239
BUILD_ARCH: amd64
@@ -217,39 +243,43 @@ publish-snap: &publish-snap
217243
tags:
218244
- linux-docker
219245
script:
220-
- scripts/gitlab/publish-snap.sh
246+
- ./tools/publish-snap.sh
221247

222248
publish-snap-i386:
223249
<<: *publish-snap
224250
variables:
225251
BUILD_ARCH: i386
252+
CARGO_TARGET: i686-unknown-linux-gnu
226253
dependencies:
227254
- build-linux-i386
228255

229256
publish-snap-arm64:
230257
<<: *publish-snap
231258
variables:
232259
BUILD_ARCH: arm64
260+
CARGO_TARGET: aarch64-unknown-linux-gnu
233261
dependencies:
234262
- build-linux-arm64
235263

236264
publish-snap-armhf:
237265
<<: *publish-snap
238266
variables:
239267
BUILD_ARCH: armhf
268+
CARGO_TARGET: armv7-unknown-linux-gnueabihf
240269
dependencies:
241270
- build-linux-armhf
242271

243272
publish-onchain:
244273
stage: publish
274+
<<: *no_git
245275
only: *releaseable_branches
246276
cache: {}
247277
dependencies:
248278
- build-linux
249279
- build-darwin
250280
- build-windows
251281
script:
252-
- scripts/gitlab/publish-onchain.sh
282+
- ./tools/publish-onchain.sh
253283
tags:
254284
- linux-docker
255285

scripts/docker/hub/Dockerfile

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,48 @@
11
FROM ubuntu:xenial
2-
LABEL MAINTAINER="Parity Technologies <[email protected]>"
32

4-
# install tools and dependencies
5-
RUN apt update && apt install -y --no-install-recommends openssl libudev-dev file curl jq
3+
# metadata
4+
ARG VCS_REF
5+
ARG BUILD_DATE
6+
7+
LABEL io.parity.image.authors="[email protected]" \
8+
io.parity.image.vendor="Parity Technologies" \
9+
io.parity.image.title="parity/parity" \
10+
io.parity.image.description="Parity Ethereum. The Fastest and most Advanced Ethereum Client." \
11+
io.parity.image.source="https://github.com/paritytech/parity-ethereum/blob/${VCS_REF}/\
12+
scripts/docker/hub/Dockerfile" \
13+
io.parity.image.documentation="https://wiki.parity.io/Parity-Ethereum" \
14+
io.parity.image.revision="${VCS_REF}" \
15+
io.parity.image.created="${BUILD_DATE}"
616

717
# show backtraces
818
ENV RUST_BACKTRACE 1
919

10-
# cleanup Docker image
11-
RUN apt autoremove -y \
12-
&& apt clean -y \
13-
&& rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/*
14-
15-
RUN groupadd -g 1000 parity \
16-
&& useradd -m -u 1000 -g parity -s /bin/sh parity
20+
# install tools and dependencies
21+
RUN set -eux; \
22+
apt-get update; \
23+
apt-get install -y --no-install-recommends \
24+
file curl jq; \
25+
# apt cleanup
26+
apt-get autoremove -y; \
27+
apt-get clean; \
28+
rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/*; \
29+
# add user
30+
groupadd -g 1000 parity; \
31+
useradd -m -u 1000 -g parity -s /bin/sh parity
1732

1833
WORKDIR /home/parity
1934

20-
# add parity-ethereum to docker image
35+
# add parity-ethereum binary to docker image
2136
COPY artifacts/x86_64-unknown-linux-gnu/parity /bin/parity
22-
23-
COPY scripts/docker/hub/check_sync.sh /check_sync.sh
37+
COPY tools/check_sync.sh /check_sync.sh
2438

2539
# switch to user parity here
2640
USER parity
2741

42+
# check if executable works in this container
43+
RUN parity --version
44+
2845
EXPOSE 5001 8080 8082 8083 8545 8546 8180 30303/tcp 30303/udp
2946

3047
ENTRYPOINT ["/bin/parity"]
48+

scripts/docker/hub/publish-docker.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/sh
2+
3+
set -e # fail on any error
4+
5+
VERSION=$(cat ./tools/VERSION)
6+
echo "Parity Ethereum version = ${VERSION}"
7+
8+
test "$Docker_Hub_User_Parity" -a "$Docker_Hub_Pass_Parity" \
9+
|| ( echo "no docker credentials provided"; exit 1 )
10+
docker login -u "$Docker_Hub_User_Parity" -p "$Docker_Hub_Pass_Parity"
11+
echo "__________Docker info__________"
12+
docker info
13+
14+
# we stopped pushing nightlies to dockerhub, will push to own registry prb.
15+
case "${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}" in
16+
"$SCHEDULE_TAG")
17+
echo "Docker TAG - 'parity/parity:${SCHEDULE_TAG}'";
18+
docker build --no-cache \
19+
--build-arg VCS_REF="${CI_COMMIT_SHA}" \
20+
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" \
21+
--tag "parity/parity:${SCHEDULE_TAG}" \
22+
--file tools/Dockerfile .;
23+
docker push "parity/parity:${SCHEDULE_TAG}";;
24+
"beta")
25+
echo "Docker TAGs - 'parity/parity:beta', 'parity/parity:latest', \
26+
'parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}'";
27+
docker build --no-cache \
28+
--build-arg VCS_REF="${CI_COMMIT_SHA}" \
29+
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" \
30+
--tag "parity/parity:beta" \
31+
--tag "parity/parity:latest" \
32+
--tag "parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}" \
33+
--file tools/Dockerfile .;
34+
docker push "parity/parity:beta";
35+
docker push "parity/parity:latest";
36+
docker push "parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}";;
37+
"stable")
38+
echo "Docker TAGs - 'parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}', 'parity/parity:stable'";
39+
docker build --no-cache \
40+
--build-arg VCS_REF="${CI_COMMIT_SHA}" \
41+
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" \
42+
--tag "parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}" \
43+
--tag "parity/parity:stable" \
44+
--file tools/Dockerfile .;
45+
docker push "parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}";
46+
docker push "parity/parity:stable";;
47+
*)
48+
echo "Docker TAG - 'parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}'"
49+
docker build --no-cache \
50+
--build-arg VCS_REF="${CI_COMMIT_SHA}" \
51+
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" \
52+
--tag "parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}" \
53+
--file tools/Dockerfile .;
54+
docker push "parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}";;
55+
esac
56+
57+
docker logout

scripts/gitlab/publish-docker.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

scripts/gitlab/publish-docs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ update_wiki_docs() {
3333

3434
setup_git() {
3535
echo "__________Set github__________"
36-
git config --global user.email "devops@parity.com"
37-
git config --global user.name "Devops Parity"
36+
git config --global user.email "devops-team@parity.io"
37+
git config --global user.name "Devops Team Parity"
3838
}
3939

4040
set_remote_wiki() {

scripts/gitlab/publish-onchain.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ echo "__________Register Release__________"
77
DATA="secret=$RELEASES_SECRET"
88

99
echo "Pushing release to Mainnet"
10-
./scripts/gitlab/safe-curl.sh $DATA "http://update.parity.io:1337/push-release/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/$CI_COMMIT_SHA"
11-
12-
echo "Pushing release to Kovan"
13-
./scripts/gitlab/safe-curl.sh $DATA "http://update.parity.io:1338/push-release/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/$CI_COMMIT_SHA"
10+
./tools/safe-curl.sh $DATA "http://update.parity.io:1337/push-release/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/$CI_COMMIT_SHA"
1411

1512
cd artifacts
1613
ls -l | sort -k9
@@ -29,9 +26,7 @@ do
2926
case $DIR in
3027
x86_64* )
3128
DATA="commit=$CI_COMMIT_SHA&sha3=$sha3&filename=parity$WIN&secret=$RELEASES_SECRET"
32-
../../scripts/gitlab/safe-curl.sh $DATA "http://update.parity.io:1337/push-build/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/$DIR"
33-
# Kovan
34-
../../scripts/gitlab/safe-curl.sh $DATA "http://update.parity.io:1338/push-build/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/$DIR"
29+
../../tools/safe-curl.sh $DATA "http://update.parity.io:1337/push-build/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/$DIR"
3530
;;
3631
esac
3732
cd ..

scripts/gitlab/publish-snap.sh

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@
33
set -e # fail on any error
44
set -u # treat unset variables as error
55

6-
# some necromancy:
7-
# gsub(/"/, "", $2) deletes "qoutes"
8-
# gsub(/ /, "", $2) deletes whitespaces
9-
TRACK=`awk -F '=' '/^track/ {gsub(/"/, "", $2); gsub(/ /, "", $2); print $2}' ./util/version/Cargo.toml`
10-
echo Track is: $TRACK
116
# prepare variables
12-
VERSION=v"$(sed -r -n '1,/^version/s/^version = "([^"]+)".*$/\1/p' Cargo.toml)"
7+
TRACK=$(cat ./tools/TRACK)
8+
echo "Track is: ${TRACK}"
9+
VERSION=$(cat ./tools/VERSION)
1310
SNAP_PACKAGE="parity_"$VERSION"_"$BUILD_ARCH".snap"
14-
CARGO_TARGET="$(ls artifacts)"
1511
# Choose snap release channel based on parity ethereum version track
1612
case ${TRACK} in
1713
nightly) export GRADE="devel" CHANNEL="edge";;
@@ -20,12 +16,8 @@ case ${TRACK} in
2016
*) echo "No release" && exit 0;;
2117
esac
2218

23-
# Release untagged versions from branches to the candidate snap channel
24-
case ${CI_COMMIT_REF_NAME} in
25-
beta|stable) export GRADE="stable" CHANNEL="candidate";;
26-
esac
2719
echo "__________Create snap package__________"
28-
echo "Release channel :" $GRADE " Branch/tag: " $CI_COMMIT_REF_NAME
20+
echo "Release channel :" $GRADE " Branch/tag: " $CI_COMMIT_REF_NAME "Track: " ${TRACK}
2921
echo $VERSION:$GRADE:$BUILD_ARCH:$CARGO_TARGET
3022

3123
sed -e 's/$VERSION/'"$VERSION"'/g' \

0 commit comments

Comments
 (0)