Skip to content

Commit

Permalink
Add VSTS integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko Driesprong committed Jul 8, 2018
1 parent 739c5a1 commit 3f60b39
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
*.iml
target/
*.DS_Store
.zinc/
.m2/
14 changes: 14 additions & 0 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
steps:
- task: DockerCompose@0
displayName: package fat jar
inputs:
dockerComposeCommand: run --rm maven mvn clean package
- task: ShellScript@2
displayName: Upload artifact to ADLS
inputs:
scriptPath: ./deploy_to_adls.sh
env:
AZURE_SP_USERNAME: $(azure_sp_username)
AZURE_SP_PASSWORD: $(azure_sp_password)
AZURE_SP_TENANTID: $(azure_sp_tenantid)
AZURE_ADLS_NAME: $(azure_adls_name)
32 changes: 32 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

echo "Checking if commit is release tag"

tag=`git describe --exact-match --tags HEAD`
if [[ ${tag} =~ ^([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2})$ ]]
then
echo "Commit is a release, deploying artifact"
echo "logging into azure"

az login \
--service-principal \
-u ${AZURE_SP_USERNAME} \
-p ${AZURE_SP_PASSWORD} \
--tenant ${AZURE_SP_TENANTID}

fn=`find ./target/scala-2.11/ -name "*.jar" | rev | cut -d '/' -f1 | rev | head -n 1` # gotta love `rev`
source=./target/scala-2.11/${fn}
destination=/libraries/${BUILD_DEFINITIONNAME}/${BUILD_DEFINITIONNAME}-${tag}.jar

echo "uploading artifact from"
echo " | from ${source}"
echo " | to ${AZURE_ADLS_NAME}"
echo " | on path ${destination}"

az dls fs upload \
--account ${AZURE_ADLS_NAME} \
--source-path ${source} \
--destination-path ${destination}
else
echo "Commit is not a release, not deploying artifact"
fi
32 changes: 32 additions & 0 deletions deploy_to_adls.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

echo "Checking if commit is release tag"

tag=`git describe --exact-match --tags HEAD`
if [[ ${tag} =~ ^([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2})$ ]]
then
echo "Commit is a release, deploying artifact"
echo "logging into azure"

az login \
--service-principal \
-u ${AZURE_SP_USERNAME} \
-p ${AZURE_SP_PASSWORD} \
--tenant ${AZURE_SP_TENANTID}

fn=`find ./target/ -name "*uber.jar" | rev | cut -d '/' -f1 | rev | head -n 1` # gotta love `rev`
source=./target/scala-2.11/${fn}
destination=/libraries/${BUILD_DEFINITIONNAME}/${BUILD_DEFINITIONNAME}-${tag}.jar

echo "uploading artifact from"
echo " | from ${source}"
echo " | to ${AZURE_ADLS_NAME}"
echo " | on path ${destination}"

az dls fs upload \
--account ${AZURE_ADLS_NAME} \
--source-path ${source} \
--destination-path ${destination}
else
echo "Commit is not a release, not deploying artifact"
fi
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "3.3"
services:
maven:
image: maven:3.5.4
working_dir: /root/
volumes:
- type: bind
source: .
target: /root
tty: true
environment:
- AZURE_COSMOS_END_POINT
- AZURE_COSMOS_MASTER_KEY

0 comments on commit 3f60b39

Please sign in to comment.