Skip to content
This repository was archived by the owner on May 31, 2019. It is now read-only.

Fix CI scripts for -coreclr images by cp/sed'ing sample #90

Merged
merged 1 commit into from
Sep 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .ci/build-all-tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ set -e # Exit immediately upon failure
: ${1?"Need to pass search directory argument"}

for tag in `.ci/find-tags.sh $1`; do
TAG=${IMAGE}:${tag}
echo "[CI] Building image '$TAG'..."
docker build -t $TAG $1/$tag
(
TAG=${IMAGE}:${tag}
echo "[CI] Building image '$TAG'..."
set -x
docker build -t $TAG $1/$tag
)
done

echo "[CI] All tags build fine."
echo "[CI] All tags build fine."
24 changes: 17 additions & 7 deletions .ci/build-app-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,38 @@ set -e # Exit immediately upon failure
: ${3?"Need to pass TAG as argument"}
: ${4?"Need to pass VERSION as argument"}

set +x

BASE_IMAGE=$1
TEST_APP=$2
TAG=$3
VERSION=$4
SAMPLE=$SAMPLES_REPO/samples/${VERSION%-coreclr}/$TEST_APP
SAMPLE="aspnet-samples/samples/${VERSION}/${TEST_APP}"
SAMPLE_NO_CLR="aspnet-samples/samples/${VERSION%-coreclr}/${TEST_APP}"

echo "[CI] Injecting Dockerfile to project $TEST_APP..."
if [[ ! -d $SAMPLE ]]; then
echo "[CI] Sample '$TEST_APP' not found for Docker image '$VERSION'"
if [[ ! -d "$SAMPLE_NO_CLR" ]]; then
echo "[CI] Sample '$TEST_APP' not found for Docker image '$VERSION' at ${SAMPLE_NO_CLR}"
exit 1
fi
cd $SAMPLE

ls -al
if [[ -d "$SAMPLE_NO_CLR" ]] && [[ ! -d "$SAMPLE" ]]; then
set -x
echo "Samples dir ${SAMPLE} not found. Will clone from ${SAMPLE_NO_CLR}."

mkdir -p "${SAMPLE}"
cp -rf "${SAMPLE_NO_CLR}" $(dirname "${SAMPLE}")
ls -al "${SAMPLE}"
# Append -coreclr to FROM.. directive
sed -i.bak '/^FROM/ s/$/-coreclr/' "${SAMPLE}/Dockerfile"
set +x
fi

cd $SAMPLE
if [[ -f "Dockerfile" ]]; then
echo "Using existing Dockerfile in the sample."
echo "Dockerfile:"
cat Dockerfile
else
echo "[CI] Injecting Dockerfile to project $TEST_APP..."
tee Dockerfile << EOF
FROM $BASE_IMAGE
COPY . /app
Expand Down
6 changes: 6 additions & 0 deletions .ci/clone-samples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -ex

SAMPLES_DIR=aspnet-samples
rm -rf "${SAMPLES_DIR}"
git clone -q git://github.com/aspnet/Home.git -b dev "${SAMPLES_DIR}"
2 changes: 1 addition & 1 deletion .ci/find-tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -o pipefail # carry failures over pipes
: ${1?"Need to pass Dockerfile search directory as argument"}

cd $1
find . -path ./.git -prune -o -name Dockerfile -print0 | xargs -0 -n1 dirname | sed -e "s/\.\///" | grep -v '1.0.0-beta[1-4]' | grep -v 'coreclr-1.0.0-beta5-11624'
find . -path ./.git -prune -o -name Dockerfile -print0 | xargs -0 -n1 dirname | sed -e "s/\.\///" | grep -v samples | grep -v '1.0.0-beta[1-4]'
6 changes: 4 additions & 2 deletions .ci/run-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ set -e # Exit immediately upon failure
: ${2?"Need to pass TEST_APP as argument"}
: ${3?"Need to pass VERSION as argument"}

set -x

BASE_IMAGE=$1
TEST_APP=$2
TEST_PORT=$RANDOM
Expand All @@ -16,7 +18,7 @@ APP_IMG_TAG=$(tr '[:upper:]' '[:lower:]' <<< $TEST_APP)_${TEST_PORT}
.ci/build-app-image.sh $BASE_IMAGE $TEST_APP $APP_IMG_TAG $VERSION

# Start app
.ci/start-container.sh 5004 $TEST_PORT $APP_IMG_TAG $APP_IMG_TAG
# .ci/start-container.sh 5004 $TEST_PORT $APP_IMG_TAG $APP_IMG_TAG

echo "[CI] Verifying connectivity..."
.ci/test-connection.sh http://localhost:$TEST_PORT
# .ci/test-connection.sh http://localhost:$TEST_PORT
7 changes: 5 additions & 2 deletions .ci/run-with-all-tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ for tag in `.ci/find-tags.sh $1`; do
TAG=${IMAGE}:${tag}
echo "[CI] ----------------------------------"
echo "[CI] Verifying '$2' app with '$TAG'"
.ci/run-app.sh $TAG $2 ${tag}
(
set -x
.ci/run-app.sh $TAG $2 ${tag}
)
done

echo "[CI] '$2' runs fine on all tags."
echo "[CI] '$2' runs fine on all tags."
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aspnet-samples
8 changes: 2 additions & 6 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@ machine:
services:
- docker
environment:
IMAGE: aspnet-ci
SAMPLES_REPO: $HOME/aspnet-Home
IMAGE: microsoft/aspnet

general:
artifacts:
- "container-logs"

checkout:
post:
- git clone -q git://github.com/aspnet/Home.git -b dev $SAMPLES_REPO

dependencies:
override:
- .ci/build-all-tags.sh .
- .ci/clone-samples.sh

test:
override:
Expand Down