diff --git a/scripts/bootstrap.cmd b/scripts/bootstrap.cmd index e81a08599..3c3371871 100644 --- a/scripts/bootstrap.cmd +++ b/scripts/bootstrap.cmd @@ -144,10 +144,6 @@ xcopy /s /q "%DNX_ROOT%" "%STAGE2_DIR%\dnx\" REM Copy the dotnet-restore script copy "%~dp0dotnet-restore.cmd" "%STAGE2_DIR%\dotnet-restore.cmd" -REM Stamp the output with the commit metadata -git rev-parse HEAD > %STAGE2_DIR%/commit - - REM Smoke-test the output set PATH=%STAGE2_DIR%;%START_PATH% diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 8536342ca..6cb65fdea 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -121,10 +121,6 @@ cp -R $DNX_ROOT $STAGE2_DIR/dnx cp $DIR/dotnet-restore.sh $STAGE2_DIR/dotnet-restore chmod a+x $STAGE2_DIR/dotnet-restore -# Stamp the output with the commit metadata -COMMIT_ID=$(git rev-parse HEAD) -echo $COMMIT_ID > $STAGE2_DIR/commit - # Smoke-test the output banner "Testing stage2 ..." export PATH=$STAGE2_DIR:$START_PATH diff --git a/scripts/package.ps1 b/scripts/package.ps1 index 20050e7bd..6d66a4e29 100644 --- a/scripts/package.ps1 +++ b/scripts/package.ps1 @@ -14,6 +14,14 @@ if(![string]::IsNullOrEmpty($env:DOTNET_BUILD_VERSION)) { $PackageVersion = "0.0.1-alpha-t$Timestamp" } +# Stamp the output with the commit metadata and version number +$Commit = git rev-parse HEAD + +@" +$Commit +$PackageVersion +"@.Trim() > "$Stage2Dir/.version" + $PackageName = Join-Path $PackageDir "dotnet-win-x64.$PackageVersion.zip" if (Test-Path $PackageName) diff --git a/scripts/package.sh b/scripts/package.sh index d669247cc..34d1920e9 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -1,6 +1,5 @@ #!/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 )" @@ -8,6 +7,13 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli [[ $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 )" +REPOROOT="$( cd -P "$DIR/.." && pwd )" + +source "$DIR/_common.sh" + +OUTPUT_ROOT=$REPOROOT/artifacts/$RID +STAGE2_DIR=$OUTPUT_ROOT/stage2 + echo "Starting packaging" if [ -z "$DOTNET_BUILD_VERSION" ]; then @@ -16,6 +22,9 @@ if [ -z "$DOTNET_BUILD_VERSION" ]; then echo "Version: $DOTNET_BUILD_VERSION" fi +COMMIT=$(git rev-parse HEAD) +echo "$COMMIT\n$DOTNET_BUILD_VERSION" > $STAGE2_DIR/.version + # Create Dnvm Package $DIR/package-dnvm.sh diff --git a/scripts/publish.ps1 b/scripts/publish.ps1 index cd5c6be71..1211d8936 100644 --- a/scripts/publish.ps1 +++ b/scripts/publish.ps1 @@ -87,6 +87,15 @@ function UploadBinaries($zipFile) return -1 } + # update the version file + $versionFile = Convert-Path (Join-Path $PSScriptRoot\..\artifacts\win7-x64\stage2\.version) + $Version_URI = "https://$env:STORAGE_ACCOUNT.blob.core.windows.net/$env:STORAGE_CONTAINER/$env:CHANNEL/dnvm/latest.win.version$env:SASTOKEN" + + if(-Not (UploadFile $Version_URI $versionFile)) + { + return -1 + } + return 0 } diff --git a/scripts/publish.sh b/scripts/publish.sh index 3e7b0209b..9b8460ba0 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -15,6 +15,7 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli [[ $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 SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +REPOROOT="$( cd -P "$SCRIPT_DIR/.." && pwd )" source "$SCRIPT_DIR/_common.sh" @@ -139,8 +140,15 @@ upload_binaries_to_blob_storage(){ # update the index file local indexContent="Binaries/$DOTNET_BUILD_VERSION/$filename" local indexfile="latest.$OSNAME.index" - local update_URL="https://$STORAGE_ACCOUNT.blob.core.windows.net/$STORAGE_CONTAINER/$CHANNEL/dnvm/$indexfile$SASTOKEN" - update_file_in_blob_storage $update_URL $indexfile $indexContent + local index_URL="https://$STORAGE_ACCOUNT.blob.core.windows.net/$STORAGE_CONTAINER/$CHANNEL/dnvm/$indexfile$SASTOKEN" + update_file_in_blob_storage $index_URL $indexfile $indexContent + + # update the version file + local versionContent = $(cat $REPOROOT/artifacts/$RID/stage2/.version) + local versionfile="latest.$OSNAME.version" + local version_URL="https://$STORAGE_ACCOUNT.blob.core.windows.net/$STORAGE_CONTAINER/$CHANNEL/dnvm/$versionfile$SASTOKEN" + update_file_in_blob_storage $version_URL $versionfile $versionContent + return $? }