Browse Source

Merge 'release-v0.13.x' into 'release-v0.14.x'

pull/7816/head
David Canas 8 months ago
parent
commit
33a29dff56
  1. 2
      .buildkite/pipeline.yml
  2. 48
      .buildkite/setup_and_upload_artifact.sh
  3. 11
      .buildkite/upload_artifacts.py
  4. 9
      docker/upload_artifacts.dockerfile
  5. 1
      requirements/release_upload.txt

2
.buildkite/pipeline.yml

@ -66,8 +66,6 @@ steps:
- label: Upload Release Artifacts
command: .buildkite/setup_and_upload_artifact.sh
agents:
vader=true
if: build.tag != null
- block: "Create integration testing worksheet?"

48
.buildkite/setup_and_upload_artifact.sh

@ -2,32 +2,30 @@
set -euo pipefail
SCRIPTPATH=$(pwd)
PIP_PATH="$SCRIPTPATH/env/bin/pip"
PYTHON_PATH="$SCRIPTPATH/env/bin/python"
echo "--- Downloading all artifacts here for upload to GH"
mkdir -p dist
buildkite-agent artifact download 'dist/*' dist/
echo "Now creating virtualenv..."
virtualenv -p python3.5 env
if [ $? -ne 0 ]; then
echo ".. Abort! Can't create virtualenv."
exit 1
fi
echo "--- Building docker environment in Docker"
# Depends on relevant requirements file and script locations
docker build \
--iidfile upload_artifacts.iid \
-f docker/upload_artifacts.dockerfile \
.
PIP_CMD="$PIP_PATH install -r requirements/release_upload.txt"
echo "Running $PIP_CMD..."
$PIP_CMD
if [ $? -ne 0 ]; then
echo ".. Abort! Can't install '$PIP_CMD'."
exit 1
fi
IMAGE=$(cat upload_artifacts.iid)
PYTHON_CMD="$PYTHON_PATH .buildkite/upload_artifacts.py"
echo "Now excuting upload artifacts script..."
mkdir -p dist
buildkite-agent artifact download 'dist/*' dist/
echo "--- Running script in Docker, image ID: $IMAGE"
# Mounting dist so that we're not redundantly copying
# Adding envars for GH access and Tag information
# Binding google app creds for shared use
docker run \
--mount type=bind,src=$PWD/dist,target=/dist \
-e GITHUB_ACCESS_TOKEN \
-e BUILDKITE_TAG \
--cidfile upload_artifacts.cid \
$IMAGE \
CONTAINER=$(cat upload_artifacts.cid)
$PYTHON_CMD
if [ $? -ne 0 ]; then
echo ".. Abort! Can't execute '$PYTHON_CMD'."
exit 1
fi
trap "docker rm $CONTAINER" exit

11
.buildkite/upload_artifacts.py

@ -13,7 +13,6 @@ from os import listdir
import requests
from github3 import login
from google.cloud import storage
logging.getLogger().setLevel(logging.INFO)
@ -141,16 +140,6 @@ def upload_gh_release_artifacts(artifacts={}):
"Error uploading release asset: %s" % (artifact.get("name"))
)
logging.info("Uploading to Google")
client = storage.Client()
bucket = client.bucket("le-downloads")
blob = bucket.blob(
"kolibri-release-{artifact}".format(artifact=artifact["name"])
)
blob.upload_from_filename(filename=artifact["file_location"])
blob.make_public()
def main():
if TAG:

9
docker/upload_artifacts.dockerfile

@ -0,0 +1,9 @@
FROM python:3.5-slim-buster
COPY requirements/release_upload.txt .
RUN pip install -r release_upload.txt
COPY .buildkite/upload_artifacts.py .
ENTRYPOINT ["python", "upload_artifacts.py"]

1
requirements/release_upload.txt

@ -1,3 +1,2 @@
requests==2.21.0
github3.py==1.1.0
google-cloud-storage==1.24.1

Loading…
Cancel
Save