diff --git a/scripts/ci/a01/docker_app/metadata.yml b/scripts/ci/a01/docker_app/metadata.yml new file mode 100644 index 00000000000..58d6a0e1d89 --- /dev/null +++ b/scripts/ci/a01/docker_app/metadata.yml @@ -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" \ No newline at end of file diff --git a/scripts/ci/a01/dockerfiles/py36/Dockerfile b/scripts/ci/a01/dockerfiles/py36/Dockerfile index ef7ffeec1c1..761cc307079 100644 --- a/scripts/ci/a01/dockerfiles/py36/Dockerfile +++ b/scripts/ci/a01/dockerfiles/py36/Dockerfile @@ -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 diff --git a/scripts/ci/build_droid.sh b/scripts/ci/build_droid.sh index bd1e31c78c5..7df557f643d 100755 --- a/scripts/ci/build_droid.sh +++ b/scripts/ci/build_droid.sh @@ -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 @@ -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 @@ -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 @@ -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 \ No newline at end of file +fi