Skip to content

Commit

Permalink
Update the droid build script
Browse files Browse the repository at this point in the history
1. Support build droid image locally and publish end to end
2. Add script assisting login Azure Container Registry
3. Add a travis yaml prototype for building droid container.
4. Update the py36 dockerfile to derive from a stable base image
5. Update the version.sh to support timestamp as version.
  • Loading branch information
troydai committed Jan 3, 2018
1 parent fbf61a3 commit 4b9c11a
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 8 deletions.
2 changes: 1 addition & 1 deletion scripts/ci/a01/Dockerfile.py36
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM troydai/azurecli-a01-droid:python3.6-0.8.0
FROM troydai/azurecli-a01-droid:python3.6-stable

COPY build /tmp/build

Expand Down
10 changes: 10 additions & 0 deletions scripts/ci/a01/future.travis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sudo: true
dist: trusty
jobs:
include:
- stage: build droid image
script:
- if [ -n $AZURE_CLI_BUILD_CR ]; then
docker login $AZURE_CLI_BUILD_CR -u $AZURE_CLI_CR_SP_USENAME -p $AZURE_CLI_CR_SP_PASSWORD;
fi
- ./scripts/ci/build_droid.sh
22 changes: 17 additions & 5 deletions scripts/ci/build_droid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,30 @@ set -e

dp0=`cd $(dirname $0); pwd`

# Clean up artifacts
if [ -d artifacts ]; then rm -r artifacts; fi

# Build the whl files first
. $dp0/build.sh

# Move dockerfile
cp $dp0/a01/Dockerfile.py36 artifacts/

image_name=azurecli-test:python3.6-$version
# for travis repo slug, remove the suffix to reveal the owner
# - the offical repo will generate image: azurecli-test-Azure
# - the fork repo will generate image: azurecli-test-johnongithub
# for local private build uses local user name.
# - eg. azurecli-test-private-john
image_owner=${TRAVIS_REPO_SLUG%/azure-cli}
image_owner=${image_owner:="private-${USER}"}

image_name=azurecli-test-$image_owner:python3.6-$version

docker build -t $image_name -f artifacts/Dockerfile.py36 artifacts

if [ $A01_ACR ]; then
az acr login -n $A01_ACR
docker tag $image_name $A01_ACR.azurecr.io/$image_name
docker push $A01_ACR.azurecr.io/$image_name
if [ $AZURE_CLI_BUILD_CR ]; then
if [ -z $TRAVIS ]; then $dp0/login_cr.sh; fi
docker tag $image_name $AZURE_CLI_BUILD_CR/$image_name
docker push $AZURE_CLI_BUILD_CR/$image_name
fi

11 changes: 11 additions & 0 deletions scripts/ci/login_cr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

# Login a container registry before build test droid
#
# This command assume you have az on the path and have login the subscription
# containing the Azure Container Registry.
#

acr_name=${AZURE_CLI_BUILD_CR%%'.azurecr.io'}
az acr login -n $acr_name

4 changes: 2 additions & 2 deletions scripts/ci/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ if [ -z $version ]; then
fi

if [ -z $version ]; then
echo 'Missing version string'
exit 1
echo 'Use utc timestamp as version'
version=`date -u '+%Y%m%d%H%M%S'`
fi

echo "Replace with version: $version"
Expand Down

0 comments on commit 4b9c11a

Please sign in to comment.