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

Commit

Permalink
Merge branch 'master' into ao-upgrade-ethereum-types
Browse files Browse the repository at this point in the history
* master:
  introduce MissingParent Error, fixes #10699 (#10700)
  Update publishing (#10644)
  • Loading branch information
ordian committed Jun 3, 2019
2 parents 722971b + 33d3bfa commit 94db3a0
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 68 deletions.
52 changes: 41 additions & 11 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ variables:
expire_in: 1 mos
paths:
- artifacts/
- tools/

.docker-cache-status: &docker-cache-status
variables:
CARGO_HOME: "/ci-cache/parity-ethereum/cargo/${CI_JOB_NAME}"
dependencies: []
before_script:
- rustup show
- cargo --version
- SCCACHE_ERROR_LOG=/builds/parity/parity-ethereum/sccache_debug.log
RUST_LOG=sccache=debug
sccache --start-server
Expand All @@ -46,10 +49,7 @@ variables:
# sccache debug info
- if test -e sccache_debug.log;
then
echo "_____sccache_debug.log listing start:_____";
cat sccache_debug.log;
echo "_____sccache_debug.log listing end_____";
echo "All crate-types:";
echo "_____All crate-types:_____";
grep 'parse_arguments.*--crate-type' sccache_debug.log | sed -re 's/.*"--crate-type", "([^"]+)".*/\1/' | sort | uniq -c;
echo "_____Non-cacheable reasons:_____";
grep CannotCache sccache_debug.log | sed -re 's/.*CannotCache\((.+)\).*/\1/' | sort | uniq -c;
Expand All @@ -67,6 +67,16 @@ variables:
script:
- scripts/gitlab/build-linux.sh
- sccache -s
after_script:
- mkdir -p tools
- cp -r scripts/docker/hub/* ./tools
- cp scripts/gitlab/publish-snap.sh ./tools
- cp scripts/gitlab/publish-onchain.sh ./tools
- cp scripts/gitlab/safe-curl.sh ./tools
- echo v"$(sed -r -n '1,/^version/s/^version\s*=\s*"([^"]+)".*$/\1/p' Cargo.toml)" |
tee ./tools/VERSION
- echo "$(sed -r -n '1,/^track/s/^track\s*=\s*"([^"]+)".*$/\1/p' ./util/version/Cargo.toml)" |
tee ./tools/TRACK


cargo-check 0 3:
Expand Down Expand Up @@ -195,19 +205,35 @@ build-windows:

publish-docker:
stage: publish
<<: *no_git
only: *releaseable_branches
cache: {}
except:
variables:
- $SCHEDULE_TAG == "nightly"
dependencies:
- build-linux
tags:
- shell
environment:
name: parity-build
cache: {}
image: docker:stable
services:
- docker:dind
variables:
DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay2
GIT_STRATEGY: none
# DOCKERFILE: tools/Dockerfile
# CONTAINER_IMAGE: parity/parity
script:
- scripts/gitlab/publish-docker.sh parity
# we stopped pushing nightlies to dockerhub, will push to own registry prb.
- ./tools/publish-docker.sh
tags:
- kubernetes-parity-build

publish-snap: &publish-snap
stage: publish
<<: *no_git
only: *releaseable_branches
<<: *collect_artifacts
image: snapcore/snapcraft
variables:
BUILD_ARCH: amd64
Expand All @@ -217,39 +243,43 @@ publish-snap: &publish-snap
tags:
- linux-docker
script:
- scripts/gitlab/publish-snap.sh
- ./tools/publish-snap.sh

publish-snap-i386:
<<: *publish-snap
variables:
BUILD_ARCH: i386
CARGO_TARGET: i686-unknown-linux-gnu
dependencies:
- build-linux-i386

publish-snap-arm64:
<<: *publish-snap
variables:
BUILD_ARCH: arm64
CARGO_TARGET: aarch64-unknown-linux-gnu
dependencies:
- build-linux-arm64

publish-snap-armhf:
<<: *publish-snap
variables:
BUILD_ARCH: armhf
CARGO_TARGET: armv7-unknown-linux-gnueabihf
dependencies:
- build-linux-armhf

publish-onchain:
stage: publish
<<: *no_git
only: *releaseable_branches
cache: {}
dependencies:
- build-linux
- build-darwin
- build-windows
script:
- scripts/gitlab/publish-onchain.sh
- ./tools/publish-onchain.sh
tags:
- linux-docker

Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/engines/authority_round/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ impl AuthorityRound {

if !epoch_manager.zoom_to_after(&*client, &self.machine, &*self.validators, *header.parent_hash()) {
debug!(target: "engine", "Unable to zoom to epoch.");
return Err(EngineError::RequiresClient.into())
return Err(EngineError::MissingParent.into())
}

(CowLike::Owned(epoch_manager.validators().clone()), epoch_manager.epoch_transition_number)
Expand Down
3 changes: 3 additions & 0 deletions ethcore/src/engines/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ pub enum EngineError {
InvalidEngine,
/// Requires signer ref, but none registered.
RequiresSigner,
/// Missing Parent Epoch
MissingParent,
/// Checkpoint is missing
CliqueMissingCheckpoint(H256),
/// Missing vanity data
Expand Down Expand Up @@ -137,6 +139,7 @@ impl fmt::Display for EngineError {
RequiresClient => format!("Call requires client but none registered"),
RequiresSigner => format!("Call requires signer but none registered"),
InvalidEngine => format!("Invalid engine specification or implementation"),
MissingParent => format!("Parent Epoch is missing from database"),
};

f.write_fmt(format_args!("Engine error ({})", msg))
Expand Down
43 changes: 30 additions & 13 deletions scripts/docker/hub/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,47 @@
FROM ubuntu:xenial
LABEL MAINTAINER="Parity Technologies <devops-team@parity.io>"

# install tools and dependencies
RUN apt update && apt install -y --no-install-recommends openssl file curl jq
# metadata
ARG VCS_REF
ARG BUILD_DATE

LABEL io.parity.image.authors="devops-team@parity.io" \
io.parity.image.vendor="Parity Technologies" \
io.parity.image.title="parity/parity" \
io.parity.image.description="Parity Ethereum. The Fastest and most Advanced Ethereum Client." \
io.parity.image.source="https://github.com/paritytech/parity-ethereum/blob/${VCS_REF}/\
scripts/docker/hub/Dockerfile" \
io.parity.image.documentation="https://wiki.parity.io/Parity-Ethereum" \
io.parity.image.revision="${VCS_REF}" \
io.parity.image.created="${BUILD_DATE}"

# show backtraces
ENV RUST_BACKTRACE 1

# cleanup Docker image
RUN apt autoremove -y \
&& apt clean -y \
&& rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/*

RUN groupadd -g 1000 parity \
&& useradd -m -u 1000 -g parity -s /bin/sh parity
# install tools and dependencies
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
file curl jq; \
# apt cleanup
apt-get autoremove -y; \
apt-get clean; \
rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/*; \
# add user
groupadd -g 1000 parity; \
useradd -m -u 1000 -g parity -s /bin/sh parity

WORKDIR /home/parity

# add parity-ethereum to docker image
# add parity-ethereum binary to docker image
COPY artifacts/x86_64-unknown-linux-gnu/parity /bin/parity

COPY scripts/docker/hub/check_sync.sh /check_sync.sh
COPY tools/check_sync.sh /check_sync.sh

# switch to user parity here
USER parity

# check if executable works in this container
RUN parity --version

EXPOSE 5001 8080 8082 8083 8545 8546 8180 30303/tcp 30303/udp

ENTRYPOINT ["/bin/parity"]
57 changes: 57 additions & 0 deletions scripts/docker/hub/publish-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/sh

set -e # fail on any error

VERSION=$(cat ./tools/VERSION)
echo "Parity Ethereum version = ${VERSION}"

test "$Docker_Hub_User_Parity" -a "$Docker_Hub_Pass_Parity" \
|| ( echo "no docker credentials provided"; exit 1 )
docker login -u "$Docker_Hub_User_Parity" -p "$Docker_Hub_Pass_Parity"
echo "__________Docker info__________"
docker info

# we stopped pushing nightlies to dockerhub, will push to own registry prb.
case "${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}" in
"$SCHEDULE_TAG")
echo "Docker TAG - 'parity/parity:${SCHEDULE_TAG}'";
docker build --no-cache \
--build-arg VCS_REF="${CI_COMMIT_SHA}" \
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" \
--tag "parity/parity:${SCHEDULE_TAG}" \
--file tools/Dockerfile .;
docker push "parity/parity:${SCHEDULE_TAG}";;
"beta")
echo "Docker TAGs - 'parity/parity:beta', 'parity/parity:latest', \
'parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}'";
docker build --no-cache \
--build-arg VCS_REF="${CI_COMMIT_SHA}" \
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" \
--tag "parity/parity:beta" \
--tag "parity/parity:latest" \
--tag "parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}" \
--file tools/Dockerfile .;
docker push "parity/parity:beta";
docker push "parity/parity:latest";
docker push "parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}";;
"stable")
echo "Docker TAGs - 'parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}', 'parity/parity:stable'";
docker build --no-cache \
--build-arg VCS_REF="${CI_COMMIT_SHA}" \
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" \
--tag "parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}" \
--tag "parity/parity:stable" \
--file tools/Dockerfile .;
docker push "parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}";
docker push "parity/parity:stable";;
*)
echo "Docker TAG - 'parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}'"
docker build --no-cache \
--build-arg VCS_REF="${CI_COMMIT_SHA}" \
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" \
--tag "parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}" \
--file tools/Dockerfile .;
docker push "parity/parity:${VERSION}-${CI_COMMIT_REF_NAME}";;
esac

docker logout
22 changes: 0 additions & 22 deletions scripts/gitlab/publish-docker.sh

This file was deleted.

4 changes: 2 additions & 2 deletions scripts/gitlab/publish-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ update_wiki_docs() {

setup_git() {
echo "__________Set github__________"
git config --global user.email "devops@parity.com"
git config --global user.name "Devops Parity"
git config --global user.email "devops-team@parity.io"
git config --global user.name "Devops Team Parity"
}

set_remote_wiki() {
Expand Down
9 changes: 2 additions & 7 deletions scripts/gitlab/publish-onchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ echo "__________Register Release__________"
DATA="secret=$RELEASES_SECRET"

echo "Pushing release to Mainnet"
./scripts/gitlab/safe-curl.sh $DATA "http://update.parity.io:1337/push-release/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/$CI_COMMIT_SHA"

echo "Pushing release to Kovan"
./scripts/gitlab/safe-curl.sh $DATA "http://update.parity.io:1338/push-release/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/$CI_COMMIT_SHA"
./tools/safe-curl.sh $DATA "http://update.parity.io:1337/push-release/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/$CI_COMMIT_SHA"

cd artifacts
ls -l | sort -k9
Expand All @@ -29,9 +26,7 @@ do
case $DIR in
x86_64* )
DATA="commit=$CI_COMMIT_SHA&sha3=$sha3&filename=parity$WIN&secret=$RELEASES_SECRET"
../../scripts/gitlab/safe-curl.sh $DATA "http://update.parity.io:1337/push-build/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/$DIR"
# Kovan
../../scripts/gitlab/safe-curl.sh $DATA "http://update.parity.io:1338/push-build/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/$DIR"
../../tools/safe-curl.sh $DATA "http://update.parity.io:1337/push-build/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/$DIR"
;;
esac
cd ..
Expand Down
16 changes: 4 additions & 12 deletions scripts/gitlab/publish-snap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
set -e # fail on any error
set -u # treat unset variables as error

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

# Release untagged versions from branches to the candidate snap channel
case ${CI_COMMIT_REF_NAME} in
beta|stable) export GRADE="stable" CHANNEL="candidate";;
esac
echo "__________Create snap package__________"
echo "Release channel :" $GRADE " Branch/tag: " $CI_COMMIT_REF_NAME
echo "Release channel :" $GRADE " Branch/tag: " $CI_COMMIT_REF_NAME "Track: " ${TRACK}
echo $VERSION:$GRADE:$BUILD_ARCH:$CARGO_TARGET

sed -e 's/$VERSION/'"$VERSION"'/g' \
Expand Down

0 comments on commit 94db3a0

Please sign in to comment.