commit
3b9cfb086c
9 changed files with 88 additions and 5 deletions
23
netci.groovy
23
netci.groovy
|
@ -24,6 +24,7 @@ def static getBuildJobName(def configuration, def os) {
|
|||
// Calculate job name
|
||||
def jobName = getBuildJobName(configuration, os)
|
||||
def buildCommand = '';
|
||||
def postBuildCommand = '';
|
||||
|
||||
// Calculate the build command
|
||||
if (os == 'Windows_NT') {
|
||||
|
@ -31,6 +32,7 @@ def static getBuildJobName(def configuration, def os) {
|
|||
}
|
||||
else {
|
||||
buildCommand = "./scripts/ci_build.sh ${lowerConfiguration}"
|
||||
postBuildCommand = "./scripts/ci_postbuild.sh ${lowerConfiguration}"
|
||||
}
|
||||
|
||||
// Create the new job
|
||||
|
@ -45,6 +47,16 @@ def static getBuildJobName(def configuration, def os) {
|
|||
else {
|
||||
// Shell
|
||||
shell(buildCommand)
|
||||
|
||||
// Post Build Cleanup
|
||||
publishers {
|
||||
postBuildScripts {
|
||||
steps {
|
||||
shell(postBuildCommand)
|
||||
}
|
||||
onlyIfBuildSucceeds(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +79,17 @@ def static getBuildJobName(def configuration, def os) {
|
|||
else {
|
||||
// Shell
|
||||
shell(buildCommand)
|
||||
|
||||
// Post Build Cleanup
|
||||
publishers {
|
||||
postBuildScripts {
|
||||
steps {
|
||||
shell(postBuildCommand)
|
||||
}
|
||||
onlyIfBuildSucceeds(false)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,16 @@
|
|||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
if [[ "$(uname)" == "Linux" ]]; then
|
||||
# Set Docker Container name to be unique
|
||||
container_name=""
|
||||
|
||||
#Jenkins
|
||||
[ ! -z "$BUILD_TAG" ] && container_name="$BUILD_TAG"
|
||||
#VSO
|
||||
[ ! -z "$BUILD_BUILDID" ] && container_name="$BUILD_BUILDID"
|
||||
|
||||
export DOTNET_BUILD_CONTAINER_NAME="$container_name"
|
||||
|
||||
$SCRIPT_DIR/dockerbuild.sh debian $@
|
||||
else
|
||||
$SCRIPT_DIR/../build.sh $@
|
||||
|
|
19
scripts/ci_postbuild.sh
Executable file
19
scripts/ci_postbuild.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
if [[ "$(uname)" == "Linux" ]]; then
|
||||
# Set Docker Container name to be unique
|
||||
container_name=""
|
||||
|
||||
#Jenkins
|
||||
[ ! -z "$BUILD_TAG" ] && container_name="$BUILD_TAG"
|
||||
#VSO
|
||||
[ ! -z "$BUILD_BUILDID" ] && container_name="$BUILD_BUILDID"
|
||||
|
||||
export DOTNET_BUILD_CONTAINER_NAME="$container_name"
|
||||
|
||||
$SCRIPT_DIR/dockerpostbuild.sh $@
|
||||
fi
|
||||
|
||||
ret_code=$?
|
||||
exit $ret_code
|
0
scripts/dnvm2.sh
Normal file → Executable file
0
scripts/dnvm2.sh
Normal file → Executable file
|
@ -21,13 +21,10 @@ echo $DOCKER_HOST_SHARE_DIR
|
|||
docker build -t $DOTNET_BUILD_CONTAINER_TAG scripts/docker/
|
||||
|
||||
# Run the build in the container
|
||||
docker run --rm \
|
||||
docker run --rm --sig-proxy=true \
|
||||
--name $DOTNET_BUILD_CONTAINER_NAME \
|
||||
-v $DOCKER_HOST_SHARE_DIR:/opt/code \
|
||||
-e DOTNET_BUILD_VERSION=$DOTNET_BUILD_VERSION \
|
||||
$DOTNET_BUILD_CONTAINER_TAG $BUILD_COMMAND $1
|
||||
|
||||
docker run --rm \
|
||||
-v $DOCKER_HOST_SHARE_DIR:/opt/code \
|
||||
-e DOTNET_BUILD_VERSION=$DOTNET_BUILD_VERSION \
|
||||
$DOTNET_BUILD_CONTAINER_TAG chmod a+rw /opt/code
|
||||
|
||||
|
|
34
scripts/dockerpostbuild.sh
Executable file
34
scripts/dockerpostbuild.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
|
||||
cd $DIR/..
|
||||
|
||||
[ -z "$DOTNET_BUILD_CONTAINER_TAG" ] && DOTNET_BUILD_CONTAINER_TAG="dotnetcli-build"
|
||||
[ -z "$DOTNET_BUILD_CONTAINER_NAME" ] && DOTNET_BUILD_CONTAINER_NAME="dotnetcli-build-container"
|
||||
[ -z "$DOCKER_HOST_SHARE_DIR" ] && DOCKER_HOST_SHARE_DIR=$(pwd)
|
||||
|
||||
# Build the docker container (will be fast if it is already built)
|
||||
docker build -t $DOTNET_BUILD_CONTAINER_TAG scripts/docker/
|
||||
|
||||
# First thing make sure all of our build containers are stopped
|
||||
docker stop $DOTNET_BUILD_CONTAINER_NAME
|
||||
docker rm $DOTNET_BUILD_CONTAINER_NAME
|
||||
|
||||
# Remove the sticky bit on directories created by docker so we can delete them
|
||||
docker run --rm \
|
||||
-v $DOCKER_HOST_SHARE_DIR:/opt/code \
|
||||
-e DOTNET_BUILD_VERSION=$DOTNET_BUILD_VERSION \
|
||||
$DOTNET_BUILD_CONTAINER_TAG chmod -R -t /opt/code
|
||||
|
||||
# And Actually make those directories accessible to be deleted
|
||||
docker run --rm \
|
||||
-v $DOCKER_HOST_SHARE_DIR:/opt/code \
|
||||
-e DOTNET_BUILD_VERSION=$DOTNET_BUILD_VERSION \
|
||||
$DOTNET_BUILD_CONTAINER_TAG chmod -R a+rwx /opt/code
|
0
scripts/publish.sh
Normal file → Executable file
0
scripts/publish.sh
Normal file → Executable file
0
scripts/repoapi_client.sh
Normal file → Executable file
0
scripts/repoapi_client.sh
Normal file → Executable file
0
scripts/windows_dockerbuild.sh
Normal file → Executable file
0
scripts/windows_dockerbuild.sh
Normal file → Executable file
Loading…
Reference in a new issue