Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #8521 from EOSIO/merge-release-2.0.1-to-master
Browse files Browse the repository at this point in the history
Merge release 2.0.1 to master
  • Loading branch information
heifner authored Jan 27, 2020
2 parents 8cfb6d1 + bcd5f64 commit e73a43b
Show file tree
Hide file tree
Showing 30 changed files with 533 additions and 165 deletions.
137 changes: 137 additions & 0 deletions .cicd/build-scripts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
steps:

- label: ":aws: Amazon_Linux 2 - Build Pinned"
plugins:
- docker#v3.3.0:
image: "amazonlinux:2.0.20190508"
always-pull: true
agents:
queue: "automation-eks-eos-builder-fleet"
command:
- "./scripts/eosio_build.sh -P -y"
timeout: 180

- label: ":centos: CentOS 7.7 - Build Pinned"
plugins:
- docker#v3.3.0:
image: "centos:7.7.1908"
always-pull: true
agents:
queue: "automation-eks-eos-builder-fleet"
command:
- "./scripts/eosio_build.sh -P -y"
timeout: 180

- label: ":darwin: macOS 10.14 - Build Pinned"
env:
REPO: "[email protected]:EOSIO/eos.git"
TEMPLATE: "10.14.6_6C_14G_40G"
TEMPLATE_TAG: "clean::cicd::git-ssh::nas::brew::buildkite-agent"
agents: "queue=mac-anka-large-node-fleet"
command:
- "git clone [email protected]:EOSIO/eos.git eos && cd eos && git checkout -f $BUILDKITE_BRANCH && git submodule update --init --recursive"
- "cd eos && ./scripts/eosio_build.sh -P -y"
plugins:
- EOSIO/anka#v0.5.7:
debug: true
vm-name: "10.14.6_6C_14G_40G"
no-volume: true
modify-cpu: 12
modify-ram: 24
always-pull: true
wait-network: true
vm-registry-tag: "clean::cicd::git-ssh::nas::brew::buildkite-agent"
pre-execute-sleep: 10
failover-registries:
- "registry_1"
- "registry_2"
inherit-environment-vars: true
- thedyrt/skip-checkout#v0.1.1:
cd: ~
timeout: 180

- label: ":ubuntu: Ubuntu 16.04 - Build Pinned"
plugins:
- docker#v3.3.0:
image: "ubuntu:16.04"
always-pull: true
agents:
queue: "automation-eks-eos-builder-fleet"
command:
- "apt update && apt upgrade -y && apt install -y git"
- "./scripts/eosio_build.sh -P -y"
timeout: 180

- label: ":ubuntu: Ubuntu 18.04 - Build Pinned"
plugins:
- docker#v3.3.0:
image: "ubuntu:18.04"
always-pull: true
agents:
queue: "automation-eks-eos-builder-fleet"
command:
- "apt update && apt upgrade -y && apt install -y git"
- "./scripts/eosio_build.sh -P -y"
timeout: 180

- label: ":aws: Amazon_Linux 2 - Build UnPinned"
plugins:
- docker#v3.3.0:
image: "amazonlinux:2.0.20190508"
always-pull: true
agents:
queue: "automation-eks-eos-builder-fleet"
command:
- "./scripts/eosio_build.sh -y"
timeout: 180

- label: ":centos: CentOS 7.7 - Build UnPinned"
plugins:
- docker#v3.3.0:
image: "centos:7.7.1908"
always-pull: true
agents:
queue: "automation-eks-eos-builder-fleet"
command:
- "./scripts/eosio_build.sh -y"
timeout: 180

- label: ":darwin: macOS 10.14 - Build UnPinned"
env:
REPO: "[email protected]:EOSIO/eos.git"
TEMPLATE: "10.14.6_6C_14G_40G"
TEMPLATE_TAG: "clean::cicd::git-ssh::nas::brew::buildkite-agent"
agents: "queue=mac-anka-large-node-fleet"
command:
- "git clone [email protected]:EOSIO/eos.git eos && cd eos && git checkout -f $BUILDKITE_BRANCH && git submodule update --init --recursive"
- "cd eos && ./scripts/eosio_build.sh -y"
plugins:
- EOSIO/anka#v0.5.7:
debug: true
vm-name: "10.14.6_6C_14G_40G"
no-volume: true
modify-cpu: 12
modify-ram: 24
always-pull: true
wait-network: true
vm-registry-tag: "clean::cicd::git-ssh::nas::brew::buildkite-agent"
pre-execute-sleep: 10
failover-registries:
- "registry_1"
- "registry_2"
inherit-environment-vars: true
- thedyrt/skip-checkout#v0.1.1:
cd: ~
timeout: 180

- label: ":ubuntu: Ubuntu 18.04 - Build UnPinned"
plugins:
- docker#v3.3.0:
image: "ubuntu:18.04"
always-pull: true
agents:
queue: "automation-eks-eos-builder-fleet"
command:
- "apt update && apt upgrade -y && apt install -y git"
- "./scripts/eosio_build.sh -y"
timeout: 180
2 changes: 1 addition & 1 deletion .cicd/docker-tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -eo pipefail
echo '+++ :evergreen_tree: Configuring Environment'
REPO='eosio/ci-contracts-builder'
PREFIX='base-ubuntu-18.04'
IMAGE="$REPO:$PREFIX-$BUILDKITE_COMMIT"
IMAGE="$REPO:$PREFIX-$BUILDKITE_COMMIT-$PLATFORM_TYPE"
SANITIZED_BRANCH=$(echo "$BUILDKITE_BRANCH" | tr '/' '_')
SANITIZED_TAG=$(echo "$BUILDKITE_TAG" | tr '/' '_')
echo '+++ :arrow_down: Pulling Container'
Expand Down
41 changes: 19 additions & 22 deletions .cicd/generate-pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ if [[ ! -z ${BUILDKITE_TRIGGERED_FROM_BUILD_ID} ]]; then
fi
export BUILD_SOURCE=${BUILD_SOURCE:---build \$BUILDKITE_BUILD_ID}
# set trigger_job if master/release/develop branch and webhook
if [[ $BUILDKITE_BRANCH =~ ^release/[0-9]+\.[0-9]+\.x$ || $BUILDKITE_BRANCH =~ ^master$ || $BUILDKITE_BRANCH =~ ^develop$ ]]; then
[[ $BUILDKITE_SOURCE != 'scheduled' ]] && export TRIGGER_JOB=true
if [[ ! $BUILDKITE_PIPELINE_SLUG =~ 'lrt' ]] && [[ $BUILDKITE_BRANCH =~ ^release/[0-9]+\.[0-9]+\.x$ || $BUILDKITE_BRANCH =~ ^master$ || $BUILDKITE_BRANCH =~ ^develop$ ]]; then
[[ $BUILDKITE_SOURCE != 'schedule' ]] && export TRIGGER_JOB=true
fi
oIFS="$IFS"
IFS=$''
Expand Down Expand Up @@ -438,6 +438,23 @@ EOF
echo ''
fi
done
# Execute multiversion test
if ( [[ ! $PINNED == false ]] ); then
cat <<EOF
- label: ":pipeline: Multiversion Test"
command:
- "buildkite-agent artifact download build.tar.gz . --step ':ubuntu: Ubuntu 18.04 - Build' && tar -xzf build.tar.gz"
- ./.cicd/test.sh .cicd/multiversion.sh
env:
IMAGE_TAG: "ubuntu-18.04-pinned"
PLATFORM_TYPE: "pinned"
agents:
queue: "$BUILDKITE_TEST_AGENT_QUEUE"
timeout: ${TIMEOUT:-30}
skip: ${SKIP_LINUX}${SKIP_UBUNTU_18_04}${SKIP_MULTIVERSION_TEST}
EOF
fi
# trigger eosio-lrt post pr
if [[ -z $BUILDKITE_TRIGGERED_FROM_BUILD_ID && $TRIGGER_JOB == "true" ]]; then
if ( [[ ! $PINNED == false ]] ); then
Expand All @@ -458,26 +475,6 @@ if [[ -z $BUILDKITE_TRIGGERED_FROM_BUILD_ID && $TRIGGER_JOB == "true" ]]; then
SKIP_WASM_SPEC_TESTS: "true"
PINNED: "${PINNED}"
EOF
fi
fi
# trigger multiversion post pr
if [[ -z $BUILDKITE_TRIGGERED_FROM_BUILD_ID && $TRIGGER_JOB = "true" ]]; then
if ( [[ ! $PINNED == false ]] ); then
cat <<EOF
- label: ":pipeline: Trigger Multiversion Test"
trigger: "eos-multiversion-tests"
async: true
build:
message: "Triggered by $BUILDKITE_PIPELINE_SLUG build $BUILDKITE_BUILD_NUMBER"
commit: "${BUILDKITE_COMMIT}"
branch: "${BUILDKITE_BRANCH}"
env:
BUILDKITE_PULL_REQUEST: "${BUILDKITE_PULL_REQUEST}"
BUILDKITE_PULL_REQUEST_BASE_BRANCH: "${BUILDKITE_PULL_REQUEST_BASE_BRANCH}"
BUILDKITE_PULL_REQUEST_REPO: "${BUILDKITE_PULL_REQUEST_REPO}"
BUILDKITE_TRIGGERED_FROM_BUILD_URL: "${BUILDKITE_BUILD_URL}"
EOF
fi
fi
Expand Down
138 changes: 138 additions & 0 deletions .cicd/helpers/multi_eos_docker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
#!/usr/bin/env python

import configparser
import os
import re
import requests
import shutil
import subprocess
import sys
import tarfile


def is_tag(ref):
regex = re.compile('v[0-9]+\.[0-9]+\..*')
return regex.match(ref)

def get_commit_for_branch(branch):
commit = None
r = requests.get('https://api.github.com/repos/EOSIO/eos/git/refs/heads/{}'.format(branch))
if r.status_code == 200:
commit = r.json().get('object').get('sha')

return commit

def get_commit_for_tag(tag):
commit = None
r = requests.get('https://api.github.com/repos/EOSIO/eos/git/refs/tags/{}'.format(tag))
if r.status_code == 200:
commit = r.json().get('object').get('sha')

return commit

def sanitize_label(label):
invalid = [' ', '..', '.', '/', '~', '=']
for c in invalid:
label = label.replace(c, '-')

return label.strip('-')

CURRENT_COMMIT = os.environ.get('BUILDKITE_COMMIT')
BK_TOKEN = os.environ.get('BUILDKITE_API_KEY')
if not BK_TOKEN:
sys.exit('Buildkite token not set')
headers = {
'Authorization': 'Bearer {}'.format(BK_TOKEN)
}

try:
shutil.rmtree('builds')
except OSError:
pass
os.mkdir('builds')

existing_build_found = False
if CURRENT_COMMIT:
print 'Attempting to get build directory for this branch ({})...'.format(CURRENT_COMMIT)
r = requests.get('https://api.buildkite.com/v2/organizations/EOSIO/pipelines/eosio/builds?commit={}'.format(CURRENT_COMMIT), headers=headers)
if r.status_code == 200:
resp = r.json()
if resp:
build = resp.pop(0)
for job in build.get('jobs'):
job_name = job.get('name')
if job_name == ':ubuntu: 18.04 Build':
dir_r = requests.get(job.get('artifacts_url'), headers=headers)
if dir_r.status_code == 200:
download_url = dir_r.json().pop().get('download_url')
if download_url:
dl_r = requests.get(download_url, headers=headers)
open('current_build.tar.gz', 'wb').write(dl_r.content)
tar = tarfile.open('current_build.tar.gz')
tar.extractall(path='builds/current')
tar.close()
os.remove('current_build.tar.gz')
existing_build_found = True
else:
print 'No builds found for this branch ({})'.format(CURRENT_COMMIT)

if not os.path.exists('../tests/multiversion.conf'):
sys.exit('Unable to find config file')

commits = {}
config = configparser.ConfigParser()
config.read('../tests/multiversion.conf')
for item in config.items('eosio'):
label = sanitize_label(item[0])
if is_tag(item[1]):
commits[label] = get_commit_for_tag(item[1])
elif get_commit_for_branch(item[1]):
commits[label] = get_commit_for_branch(item[1])
else:
commits[label] = item[1]

PWD = os.getcwd()
config_path = '../tests/multiversion_paths.conf'
if existing_build_found:
config_path = '{0}/builds/current/build/tests/multiversion_paths.conf'.format(PWD)

with open(config_path, 'w') as fp:
fp.write('[eosio]\n')
for label in commits.keys():
fp.write('{}={}/builds/{}/build\n'.format(label, PWD, label))

print 'Getting build data...'
artifact_urls = {}
for label, commit in commits.items():
r = requests.get('https://api.buildkite.com/v2/organizations/EOSIO/pipelines/eosio/builds?commit={}'.format(commit), headers=headers)
if r.status_code == 200:
resp = r.json()
if resp:
build = resp.pop(0)
for job in build.get('jobs'):
job_name = job.get('name')
if job_name == ':ubuntu: 18.04 Build':
artifact_urls[label] = job.get('artifacts_url')
else:
print 'No builds found for {}'.format(label)
else:
print r.text
sys.exit('Something went wrong getting build data for {}'.format(label))

print 'Downloading and extracting build directories...'
for label, artifact_url in artifact_urls.items():
print ' +++ {}'.format(label)
r = requests.get(artifact_url, headers=headers)
if r.status_code == 200:
download_url = r.json().pop().get('download_url')
if download_url:
dl_r = requests.get(download_url, headers=headers)
open('{}_build.tar.gz'.format(label), 'wb').write(dl_r.content)
tar = tarfile.open('{}_build.tar.gz'.format(label))
tar.extractall(path='builds/{}'.format(label))
tar.close()
os.remove('{}_build.tar.gz'.format(label))
else:
sys.exit('Unable to get artifact download url for {}'.format(label))
else:
sys.exit('Something went wrong getting artifact data for {}'.format(label))
12 changes: 7 additions & 5 deletions .cicd/installation-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ set -eo pipefail
export ENABLE_INSTALL=true
export BRANCH=$(echo $BUILDKITE_BRANCH | sed 's/\//\_/')
export CONTRACTS_BUILDER_TAG="eosio/ci-contracts-builder:base-ubuntu-18.04"
export ARGS="--name ci-contracts-builder-$BUILDKITE_COMMIT --init -v $(pwd):$MOUNTED_DIR"
export ARGS="--name ci-contracts-builder-$BUILDKITE_PIPELINE_SLUG-$BUILDKITE_BUILD_NUMBER --init -v $(pwd):$MOUNTED_DIR"
$CICD_DIR/build.sh
docker commit ci-contracts-builder-$BUILDKITE_COMMIT $CONTRACTS_BUILDER_TAG-$BUILDKITE_COMMIT
docker commit ci-contracts-builder-$BUILDKITE_COMMIT $CONTRACTS_BUILDER_TAG-$BRANCH-$BUILDKITE_COMMIT
docker commit ci-contracts-builder-$BUILDKITE_PIPELINE_SLUG-$BUILDKITE_BUILD_NUMBER $CONTRACTS_BUILDER_TAG-$BUILDKITE_COMMIT
docker commit ci-contracts-builder-$BUILDKITE_PIPELINE_SLUG-$BUILDKITE_BUILD_NUMBER $CONTRACTS_BUILDER_TAG-$BUILDKITE_COMMIT-$PLATFORM_TYPE
docker commit ci-contracts-builder-$BUILDKITE_PIPELINE_SLUG-$BUILDKITE_BUILD_NUMBER $CONTRACTS_BUILDER_TAG-$BRANCH-$BUILDKITE_COMMIT
docker push $CONTRACTS_BUILDER_TAG-$BUILDKITE_COMMIT
docker push $CONTRACTS_BUILDER_TAG-$BUILDKITE_COMMIT-$PLATFORM_TYPE
docker push $CONTRACTS_BUILDER_TAG-$BRANCH-$BUILDKITE_COMMIT
docker stop ci-contracts-builder-$BUILDKITE_COMMIT
docker rm ci-contracts-builder-$BUILDKITE_COMMIT
docker stop ci-contracts-builder-$BUILDKITE_PIPELINE_SLUG-$BUILDKITE_BUILD_NUMBER
docker rm ci-contracts-builder-$BUILDKITE_PIPELINE_SLUG-$BUILDKITE_BUILD_NUMBER
Loading

0 comments on commit e73a43b

Please sign in to comment.