-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into dkijania/introduce_postgres_side_docker_job
- Loading branch information
Showing
15 changed files
with
1,269 additions
and
804 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#!/bin/bash | ||
|
||
# Usage (in buildkite definition) | ||
|
||
# steps: | ||
# - commands: | ||
# - "./buildkite/scripts/run_promote_build_job.sh | buildkite-agent pipeline upload" | ||
# label: ":pipeline: run promote dockers build job" | ||
# agents: | ||
# size: "generic" | ||
# plugins: | ||
# "docker#v3.5.0": | ||
# environment: | ||
# - BUILDKITE_AGENT_ACCESS_TOKEN | ||
# - "DOCKERS=Archive,Daemon" | ||
# - "REMOVE_PROFILE_FROM_NAME=1" | ||
# - "PROFILE=Hardfork" | ||
# - "NETWORK=Devnet" | ||
# - "FROM_VERSION=3.0.0devnet-tooling-dkijania-hardfork-package-gen-in-nightly-b37f50e" | ||
# - "NEW_VERSION=3.0.0fake-ddb6fc4" | ||
# - "CODENAMES=Focal,Buster,Bullseye" | ||
# - "FROM_CHANNEL=Unstable" | ||
# - "TO_CHANNEL=Experimental" | ||
# image: codaprotocol/ci-toolchain-base:v3 | ||
# mount-buildkite-agent: true | ||
# propagate-environment: true | ||
|
||
|
||
DEBIAN_DHALL_DEF="(./buildkite/src/Constants/DebianPackage.dhall)" | ||
DOCKER_DHALL_DEF="(./buildkite/src/Constants/Artifacts.dhall)" | ||
DEBIAN_VERSION_DHALL_DEF="(./buildkite/src/Constants/DebianVersions.dhall)" | ||
PROMOTE_PACKAGE_DHALL_DEF="(./buildkite/src/Entrypoints/PromotePackage.dhall)" | ||
PROFILES_DHALL_DEF="(./buildkite/src/Constants/Profiles.dhall)" | ||
NETWORK_DHALL_DEF="(./buildkite/src/Constants/Network.dhall)" | ||
DEBIAN_CHANNEL_DHALL_DEF="(./buildkite/src/Constants/DebianChannel.dhall)" | ||
|
||
|
||
function usage() { | ||
if [[ -n "$1" ]]; then | ||
echo -e "${RED}☞ $1${CLEAR}\n"; | ||
fi | ||
echo " DEBIANS The comma delimitered debian names. For example: 'Daemon,Archive' " | ||
echo " DOCKERS The comma delimitered docker names. For example: 'Daemon,Archive' " | ||
echo " CODENAMES The Debian codenames (Bullseye, Buster etc.)" | ||
echo " NEW_VERSION The new Debian version or new Docker tag" | ||
echo " REMOVE_PROFILE_FROM_NAME Should we remove profile suffix from debian name" | ||
echo " PROFILE The Docker and Debian profile (Standard, Lightnet)" | ||
echo " NETWORK The Docker and Debian network (Devnet, Mainnet, Berkeley)" | ||
echo " TO_CHANNEL Target debian channel" | ||
echo " PUBLISH The Publish to docker.io flag. If defined, script will publish docker do docker.io. Otherwise it will still resides in gcr.io" | ||
echo "" | ||
exit 1 | ||
} | ||
|
||
if [ -z "$DEBIANS" ] && [ -z "$DOCKERS" ]; then usage "No Debians nor Dockers defined for promoting!"; exit 1; fi; | ||
|
||
DHALL_DEBIANS="([] : List $DEBIAN_DHALL_DEF.Type)" | ||
|
||
if [[ -n "$DEBIANS" ]]; then | ||
if [[ -z "$CODENAMES" ]]; then usage "Codenames is not set!"; exit 1; fi; | ||
if [[ -z "$PROFILE" ]]; then PROFILE="Standard"; fi; | ||
if [[ -z "$NETWORK" ]]; then NETWORK="Berkeley"; fi; | ||
if [[ -z "$REMOVE_PROFILE_FROM_NAME" ]]; then REMOVE_PROFILE_FROM_NAME=0; fi; | ||
if [[ -z "$PUBLISH" ]]; then PUBLISH=0; fi; | ||
if [[ -z "$TO_CHANNEL" ]]; then TO_CHANNEL="Unstable"; fi; | ||
if [[ -z "$NEW_VERSION" ]]; then NEW_VERSION=$FROM_VERSION; fi; | ||
|
||
|
||
arr_of_debians=(${DEBIANS//,/ }) | ||
DHALL_DEBIANS="" | ||
for i in "${arr_of_debians[@]}"; do | ||
DHALL_DEBIANS="${DHALL_DEBIANS}, $DEBIAN_DHALL_DEF.Type.${i}" | ||
done | ||
DHALL_DEBIANS="[${DHALL_DEBIANS:1}]" | ||
fi | ||
|
||
|
||
DHALL_DOCKERS="([] : List $DOCKER_DHALL_DEF.Type)" | ||
|
||
if [[ $PUBLISH -eq 1 ]]; then | ||
DHALL_PUBLISH="True" | ||
else | ||
DHALL_PUBLISH="False" | ||
fi | ||
|
||
if [[ -n "$DOCKERS" ]]; then | ||
if [[ -z "$NEW_VERSION" ]]; then usage "New Tag is not set!"; fi; | ||
if [[ -z "$PROFILE" ]]; then PROFILE="Standard"; fi; | ||
|
||
arr_of_dockers=(${DOCKERS//,/ }) | ||
DHALL_DOCKERS="" | ||
for i in "${arr_of_dockers[@]}"; do | ||
DHALL_DOCKERS="${DHALL_DOCKERS}, $DOCKER_DHALL_DEF.Type.${i}" | ||
done | ||
DHALL_DOCKERS="[${DHALL_DOCKERS:1}]" | ||
fi | ||
|
||
CODENAMES=(${CODENAMES//,/ }) | ||
DHALL_CODENAMES="" | ||
for i in "${CODENAMES[@]}"; do | ||
DHALL_CODENAMES="${DHALL_CODENAMES}, $DEBIAN_VERSION_DHALL_DEF.DebVersion.${i}" | ||
done | ||
DHALL_CODENAMES="[${DHALL_CODENAMES:1}]" | ||
|
||
if [[ "${REMOVE_PROFILE_FROM_NAME}" -eq 0 ]]; then | ||
REMOVE_PROFILE_FROM_NAME="False" | ||
else | ||
REMOVE_PROFILE_FROM_NAME="True" | ||
fi | ||
echo $PROMOTE_PACKAGE_DHALL_DEF'.verify_artifacts '"$DHALL_DEBIANS"' '"$DHALL_DOCKERS"' "'"${NEW_VERSION}"'" '$PROFILES_DHALL_DEF'.Type.'"${PROFILE}"' '$NETWORK_DHALL_DEF'.Type.'"${NETWORK}"' '"${DHALL_CODENAMES}"' '$DEBIAN_CHANNEL_DHALL_DEF'.Type.'"${TO_CHANNEL}"' "'"${TAG}"'" '${REMOVE_PROFILE_FROM_NAME}' '${DHALL_PUBLISH}' ' | dhall-to-yaml --quoted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env bash | ||
set -eox pipefail | ||
|
||
CHANNEL=umt-mainnet | ||
VERSION=3.0.0-f872d85 | ||
CODENAME=bullseye | ||
|
||
while [[ "$#" -gt 0 ]]; do case $1 in | ||
-c|--channel) CHANNEL="$2"; shift;; | ||
-v|--version) VERSION="$2"; shift;; | ||
-p|--package) PACKAGE="$2"; shift;; | ||
-m|--codename) CODENAME="$2"; shift;; | ||
*) echo "Unknown parameter passed: $1"; exit 1;; | ||
esac; shift; done | ||
|
||
if [ -z $PACKAGE ]; then | ||
echo "No package defined. exiting.."; exit 1; | ||
fi | ||
|
||
case $PACKAGE in | ||
mina-archive) COMMAND="mina-archive --version && mina-archive --help" ;; | ||
mina-logproc) COMMAND="echo skipped execution for mina-logproc" ;; | ||
mina-*) COMMAND="mina --version && mina --help" ;; | ||
*) echo "Unknown package passed: $PACKAGE"; exit 1;; | ||
esac | ||
|
||
SCRIPT=' set -x \ | ||
&& export DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC \ | ||
&& echo installing mina \ | ||
&& apt-get update > /dev/null \ | ||
&& apt-get install -y lsb-release ca-certificates > /dev/null \ | ||
&& echo "deb [trusted=yes] http://packages.o1test.net '$CODENAME' '$CHANNEL'" > /etc/apt/sources.list.d/mina.list \ | ||
&& apt-get update > /dev/null \ | ||
&& apt list -a '$PACKAGE' \ | ||
&& apt-get install -y --allow-downgrades '$PACKAGE'='$VERSION' \ | ||
&& '$COMMAND' | ||
' | ||
|
||
case $CODENAME in | ||
buster) DOCKER_IMAGE="debian:buster" ;; | ||
bullseye) DOCKER_IMAGE="debian:bullseye" ;; | ||
focal) DOCKER_IMAGE="ubuntu:focal" ;; | ||
*) echo "Unknown codename passed: $CODENAME"; exit 1;; | ||
esac | ||
|
||
echo "Testing packages on all images" \ | ||
&& docker run --rm $DOCKER_IMAGE bash -c "$SCRIPT" \ | ||
&& echo 'OK: ALL WORKED FINE!' || (echo 'KO: ERROR!!!' && exit 1) |
Oops, something went wrong.