mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
Simnet triggers and images (#2714)
* CI: new image for simnet * CI: chore * CI: separate image for collator * dockerfile: it's bad upgrading in the images * CI: correct links to Dockerfiles * CI: right dotenv usage * CI: workaround GitLab's bug that failed trigger status is not reported and 'job runs forever' * CI: debug: need instead of rules to avoid the bug * dockerfile: fix storage * CI: workaround sending the status when the trigger is failed * CI: fix needed job * CI: edit comments * CI: trigger simnet with API * CI: triggering script * CI: remove real-overseer * CI: trigger real simnet
This commit is contained in:
@@ -3,10 +3,11 @@ FROM debian:buster-slim
|
||||
# metadata
|
||||
ARG VCS_REF
|
||||
ARG BUILD_DATE
|
||||
ARG IMAGE_NAME
|
||||
|
||||
LABEL io.parity.image.authors="devops-team@parity.io" \
|
||||
io.parity.image.vendor="Parity Technologies" \
|
||||
io.parity.image.title="parity/polkadot" \
|
||||
io.parity.image.title="${IMAGE_NAME}" \
|
||||
io.parity.image.description="polkadot: a platform for web3" \
|
||||
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/Dockerfile" \
|
||||
io.parity.image.revision="${VCS_REF}" \
|
||||
@@ -18,7 +19,6 @@ ENV RUST_BACKTRACE 1
|
||||
|
||||
# install tools and dependencies
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get upgrade -y && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
libssl1.1 \
|
||||
ca-certificates \
|
||||
@@ -45,4 +45,3 @@ EXPOSE 30333 9933 9944
|
||||
VOLUME ["/polkadot"]
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/polkadot"]
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
FROM debian:buster-slim
|
||||
|
||||
# metadata
|
||||
ARG VCS_REF
|
||||
ARG BUILD_DATE
|
||||
ARG IMAGE_NAME
|
||||
|
||||
LABEL io.parity.image.authors="devops-team@parity.io" \
|
||||
io.parity.image.vendor="Parity Technologies" \
|
||||
io.parity.image.title="${IMAGE_NAME}" \
|
||||
io.parity.image.description="polkadot: a platform for web3" \
|
||||
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/Dockerfile" \
|
||||
io.parity.image.revision="${VCS_REF}" \
|
||||
io.parity.image.created="${BUILD_DATE}" \
|
||||
io.parity.image.documentation="https://github.com/paritytech/polkadot/"
|
||||
|
||||
# show backtraces
|
||||
ENV RUST_BACKTRACE 1
|
||||
|
||||
# install tools and dependencies
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
libssl1.1 \
|
||||
ca-certificates \
|
||||
curl && \
|
||||
# apt cleanup
|
||||
apt-get autoremove -y && \
|
||||
apt-get clean && \
|
||||
find /var/lib/apt/lists/ -type f -not -name lock -delete; \
|
||||
# add user and link ~/.local/share/adder-collator to /data
|
||||
useradd -m -u 1000 -U -s /bin/sh -d /adder-collator adder-collator && \
|
||||
mkdir -p /data /adder-collator/.local/share && \
|
||||
chown -R adder-collator:adder-collator /data && \
|
||||
ln -s /data /adder-collator/.local/share/polkadot
|
||||
|
||||
# add adder-collator binary to docker image
|
||||
COPY ./adder-collator /usr/local/bin
|
||||
|
||||
USER adder-collator
|
||||
|
||||
# check if executable works in this container
|
||||
RUN /usr/local/bin/adder-collator --version
|
||||
|
||||
EXPOSE 30333 9933 9944
|
||||
VOLUME ["/adder-collator"]
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/adder-collator"]
|
||||
Executable
+46
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
# API trigger another project's pipeline
|
||||
curl --silent \
|
||||
-X POST \
|
||||
-F "token=${CI_JOB_TOKEN}" \
|
||||
-F "ref=master" \
|
||||
-F "variables[TRGR_PROJECT]=${TRGR_PROJECT}" \
|
||||
-F "variables[TRGR_REF]=${TRGR_REF}" \
|
||||
-F "variables[IMAGE_NAME]=${IMAGE_NAME}" \
|
||||
-F "variables[IMAGE_TAG]=${IMAGE_TAG}" \
|
||||
-F "variables[COLLATOR_IMAGE_TAG]=${COLLATOR_IMAGE_TAG}" \
|
||||
"https://${CI_SERVER_HOST}/api/v4/projects/${DWNSTRM_ID}/trigger/pipeline" | \
|
||||
tee pipeline
|
||||
|
||||
PIPELINE_ID=$(cat pipeline | jq ".id")
|
||||
echo "\nWaiting on ${PIPELINE_ID} status..."
|
||||
|
||||
# This part polls for the triggered pipeline status, the native
|
||||
# `trigger` job does not return this status via API.
|
||||
# This is a workaround for a Gitlab bug, waits here until
|
||||
# https://gitlab.com/gitlab-org/gitlab/-/issues/326137 gets fixed.
|
||||
# The timeout is 360 curls with 8 sec interval, roughly an hour.
|
||||
|
||||
function get_status() {
|
||||
curl --silent \
|
||||
--header "PRIVATE-TOKEN: ${PIPELINE_TOKEN}" \
|
||||
"https://${CI_SERVER_HOST}/api/v4/projects/${DWNSTRM_ID}/pipelines/${PIPELINE_ID}" | \
|
||||
jq --raw-output ".status";
|
||||
}
|
||||
|
||||
for i in $(seq 1 360); do
|
||||
STATUS=$(get_status);
|
||||
echo "Triggered pipeline status is ${STATUS}";
|
||||
if [[ ${STATUS} =~ ^(pending|running|created)$ ]]; then
|
||||
echo "Busy...";
|
||||
elif [[ ${STATUS} =~ ^(failed|canceled|skipped|manual)$ ]]; then
|
||||
exit 1;
|
||||
elif [[ ${STATUS} =~ ^(success)$ ]]; then
|
||||
exit 0;
|
||||
else
|
||||
exit 1;
|
||||
fi
|
||||
sleep 8;
|
||||
done
|
||||
Reference in New Issue
Block a user