Skip to content

Commit

Permalink
Update droid image (Azure#5720)
Browse files Browse the repository at this point in the history
This reflects the major overhaul of A01 system. The key changes are:
1. Moving metadata from image label to metadata.yml
2. Onboard a01dispatcher executable
  • Loading branch information
troydai authored Mar 3, 2018
1 parent d8659f1 commit aad12aa
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 18 deletions.
17 changes: 17 additions & 0 deletions scripts/ci/a01/docker_app/metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
kind: DroidMetadata
version: v3
product: azurecli
storage: true
environments:
- name: A01_SP_USERNAME
type: secret
value: sp.username
- name: A01_SP_PASSWORD
type: secret
value: sp.password
- name: A01_SP_TENANT
type: secret
value: sp.tenant
- name: AZURE_TEST_RUN_LIVE
type: argument-switch-live
value: "True"
25 changes: 11 additions & 14 deletions scripts/ci/a01/dockerfiles/py36/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
FROM python:3.6-jessie
FROM python:3.6-stretch

LABEL a01.product="azurecli"
LABEL a01.index.schema="v2"
LABEL a01.env.A01_SP_USERNAME="secret:sp.username"
LABEL a01.env.A01_SP_PASSWORD="secret:sp.password"
LABEL a01.env.A01_SP_TENANT="secret:sp.tenant"
LABEL a01.env.AZURE_TEST_RUN_LIVE="arg-live:True"
LABEL a01.setting.storage="True"

ADD https://a01tools.blob.core.windows.net/droid/latest/linux/a01droid /app/a01droid
COPY build /tmp/build
COPY docker_app /app

RUN rm /usr/bin/python && ln /usr/local/bin/python3.6 /usr/bin/python && \
apt-get update && apt-get install jq && \
find /tmp/build -name '*.whl' | xargs pip install && \
rm -rf /tmp/build && \
python /app/collect_tests.py > /app/test_index && \
rm /app/collect_tests.py && \
chmod +x /app/a01droid
apt-get update && apt-get install -y jq

COPY docker_app/collect_tests.py /tmp/collect_tests.py

RUN find /tmp/build -name '*.whl' | xargs pip install && \
mkdir /app && \
python /tmp/collect_tests.py > /app/test_index && \
rm -rf /tmp

COPY docker_app /app

CMD /app/a01droid
18 changes: 14 additions & 4 deletions scripts/ci/build_droid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ function title {
#############################################
# Clean up artifacts
title 'Remove artifacts folder'
if [ -d artifacts ]; then rm -r artifacts; fi
if [ -d artifacts ] && [ "$AZURE_CLI_BUILD_INCREMENTAL" != "True" ]; then rm -r artifacts; fi

#############################################
# Build the whl files first
$dp0/build.sh
if [ ! -d artifacts ]; then $dp0/build.sh; fi

#############################################
# Move dockerfile
Expand All @@ -30,6 +30,16 @@ cp $dp0/a01/dockerfiles/py36/Dockerfile artifacts/
# Move other scripts for docker
cp -R $dp0/a01/* artifacts/

title 'Downloading applications'

curl -L https://a01tools.blob.core.windows.net/droid/latest/linux/a01droid \
-o artifacts/docker_app/a01droid
chmod +x artifacts/docker_app/a01droid

curl -L https://a01tools.blob.core.windows.net/droid/latest/linux/a01dispatcher \
-o artifacts/docker_app/a01dispatcher
chmod +x artifacts/docker_app/a01dispatcher

#############################################
# for travis repo slug, remove the suffix to reveal the owner
# - the offical repo will generate image: azurecli-test-Azure
Expand All @@ -42,7 +52,7 @@ image_owner=${image_owner:="private-${USER}"}
image_owner=`echo $image_owner | tr '[:upper:]' '[:lower:]'`
version=`cat artifacts/version`
image_name=azureclidev.azurecr.io/azurecli-test-$image_owner:python3.6-$version
echo 'Image name: $image_name'
echo "Image name: $image_name"

title 'Login docker registry'
if [ $AZURECLIDEV_ACR_SP_USERNAME ] && [ $AZURECLIDEV_ACR_SP_PASSWORD ]; then
Expand All @@ -63,4 +73,4 @@ title 'Push docker image as latest'
if [ "$TRAVIS" == "true" ]; then
docker tag $image_name azureclidev.azurecr.io/azurecli-test-$image_owner:latest
docker push azureclidev.azurecr.io/azurecli-test-$image_owner:latest
fi
fi

0 comments on commit aad12aa

Please sign in to comment.