Skip to content

Commit

Permalink
Updates for CI (#252)
Browse files Browse the repository at this point in the history
* Updating CI scripts

* Updating CI scripts

* Updating CI scripts

* Updating CI scripts

* file permissions

* Updating CI

* Updating CI

* Updating CI

* Updating CI
  • Loading branch information
lenala authored and anuchandy committed Mar 15, 2018
1 parent b531513 commit c55462c
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 84 deletions.
30 changes: 3 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,8 @@ before_script:
- sleep 5
script:
- |-
if [ ${TRAVIS_EVENT_TYPE} = "push" -o ${TRAVIS_EVENT_TYPE} = "pull_request" ]; then
LOG_PARAMS='-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn --batch-mode' ;
if [ ${TRAVIS_JDK_VERSION} = "oraclejdk8" ]; then
mvn checkstyle:check || travis_terminate 1 ;
fi
mvn -pl !azure-samples package javadoc:aggregate -DskipTests=true $LOG_PARAMS || travis_terminate 1 ;
echo '==> Starting mvn test ===' ;
mvn test -Dsurefire.rerunFailingTestsCount=3 $LOG_PARAMS -Dparallel=classes -DthreadCount=2 -DforkCount=1C || travis_terminate 1 ;
else
openssl aes-256-cbc -K $encrypted_25450b691aae_key -iv $encrypted_25450b691aae_iv -in my.azureauth.txt.enc -out my.azureauth.txt -d;
export AZURE_TEST_MODE=RECORD || travis_terminate 1 ;
export AZURE_AUTH_LOCATION=$TRAVIS_BUILD_DIR/my.azureauth.txt || travis_terminate 1 ;
mvn -Dorg.slf4j.simpleLogger.defaultLogLevel=error || travis_terminate 1 ;
fi
if [ ${TRAVIS_EVENT_TYPE} = "push" ]; then
java -jar ./ci/java-test-collector-1.0-SNAPSHOT.jar ./
image=azuresdk-a01-droid:java-$TRAVIS_BUILD_NUMBER
docker build -t $image -f ci/Dockerfile .
docker images
image=azuresdk-a01-droid:java-$TRAVIS_BUILD_NUMBER
docker build --pull -t $image -f ci/Dockerfile .
docker images
docker login azureclidev.azurecr.io -u $AZURESDKDEV_ACR_SP_USERNAME -p $AZURESDK_ACR_SP_PASSWORD
docker tag azuresdk-a01-droid:java-$TRAVIS_BUILD_NUMBER azureclidev.azurecr.io/azuresdk-a01-droid:java-$TRAVIS_BUILD_NUMBER
docker tag azuresdk-a01-droid:java-$TRAVIS_BUILD_NUMBER azureclidev.azurecr.io/azuresdk-a01-droid:java-latest
docker push azureclidev.azurecr.io/azuresdk-a01-droid:java-$TRAVIS_BUILD_NUMBER
docker push azureclidev.azurecr.io/azuresdk-a01-droid:java-latest
./ci/run_tests.sh
if [ ${TRAVIS_JDK_VERSION} = "oraclejdk8" ]; then
./ci/create_image.sh ;
fi
13 changes: 2 additions & 11 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM openjdk:8u121-jdk-alpine
FROM openjdk:8u121-jdk

LABEL a01.product="javasdk"
LABEL a01.index.schema="v2"

LABEL a01.env.AZURE_CLIENT_ID="secret:client"
LABEL a01.env.AZURE_CLIENT_SECRET="secret:key"
LABEL a01.env.AZURE_TENANT_ID="secret:tenant"
LABEL a01.env.AZURE_SUBSCRIPTION_ID="secret:subscription"
LABEL a01.env.AZURE_TEST_MODE="arg-mode"

RUN apk add --no-cache curl tar bash
# RUN apk add --no-cache curl tar bash

ARG MAVEN_VERSION=3.5.2
ARG USER_HOME_DIR="/root"
Expand Down
Binary file removed ci/app/a01droid
Binary file not shown.
46 changes: 0 additions & 46 deletions ci/app/collect_tests.py

This file was deleted.

22 changes: 22 additions & 0 deletions ci/app/metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
kind: DroidMetadata
version: v3
product: javasdk
storage: true
environments:
- name: AZURE_CLIENT_ID
type: secret
value: client
- name: AZURE_CLIENT_SECRET
type: secret
value: key
- name: AZURE_TENANT_ID
type: secret
value: tenant
- name: AZURE_SUBSCRIPTION_ID
type: secret
value: subscription
- name: AZURE_TEST_MODE
type: argument-value-mode
value: ""
owners:
- fluent
25 changes: 25 additions & 0 deletions ci/create_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#############################################
# Define colored output func
function title {
LGREEN='\033[1;32m'
CLEAR='\033[0m'

echo -e ${LGREEN}$1${CLEAR}
}

#############################################

title 'Generating tasks list'
java -jar ./ci/java-test-collector-1.0-SNAPSHOT.jar ./

title 'Building docker image'
image=azuresdk-java:java-$TRAVIS_BUILD_NUMBER
docker build -t $image -f ci/Dockerfile .

title 'Pushing docker image'
image=azuresdk-java:java-$TRAVIS_BUILD_NUMBER
docker login azureclidev.azurecr.io -u $AZURESDKDEV_ACR_SP_USERNAME -p $AZURESDK_ACR_SP_PASSWORD
docker tag azuresdk-java:java-$TRAVIS_BUILD_NUMBER azureclidev.azurecr.io/azuresdk-java:java-$TRAVIS_BUILD_NUMBER
docker tag azuresdk-java:java-$TRAVIS_BUILD_NUMBER azureclidev.azurecr.io/azuresdk-java:java-latest
docker push azureclidev.azurecr.io/azuresdk-java:java-$TRAVIS_BUILD_NUMBER
docker push azureclidev.azurecr.io/azuresdk-java:java-latest
19 changes: 19 additions & 0 deletions ci/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#############################################
# Define colored output func
function title {
LGREEN='\033[1;32m'
CLEAR='\033[0m'

echo -e ${LGREEN}$1${CLEAR}
}

#############################################
LOG_PARAMS='-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn --batch-mode' ;
if [ ${TRAVIS_JDK_VERSION} = "oraclejdk8" ]; then
title 'Running checkstyle:check'
mvn checkstyle:check || travis_terminate 1 ;
fi
title 'Running mvn -pl !azure-samples package javadoc:aggregate -DskipTests=true $LOG_PARAMS'
mvn -pl !azure-samples package javadoc:aggregate -DskipTests=true $LOG_PARAMS || travis_terminate 1 ;
echo '==> Starting mvn test ===' ;
mvn test -Dsurefire.rerunFailingTestsCount=3 $LOG_PARAMS -Dparallel=classes -DthreadCount=2 -DforkCount=1C || travis_terminate 1 ;

0 comments on commit c55462c

Please sign in to comment.