Migrate the version calculation to use pulumictl (#6460)

This commit is contained in:
Paul Stack 2021-03-10 19:03:29 +00:00 committed by GitHub
parent dc7eb5e2d2
commit c48ba37fcf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 100 additions and 239 deletions

View file

@ -54,6 +54,10 @@ jobs:
run: python -m pip install pip twine
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Fetch Tags
run: |
git fetch --quiet --prune --unshallow --tags
@ -90,7 +94,7 @@ jobs:
run: |
git fetch --quiet --prune --unshallow --tags
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Configure AWS Credentials
@ -162,6 +166,10 @@ jobs:
echo "${{ runner.temp }}/opt/pulumi/bin" >> $GITHUB_PATH
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Fetch Tags
run: |
git fetch --quiet --prune --unshallow --tags
@ -249,6 +257,10 @@ jobs:
uses: actions/checkout@v2
with:
path: ./src/github.com/${{ github.repository }}
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Fetch Tags
run: |
cd ./src/github.com/${{ github.repository }} && git fetch --quiet --prune --unshallow --tags
@ -298,7 +310,7 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Checkout Repo

View file

@ -53,6 +53,10 @@ jobs:
run: python -m pip install pip twine
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Fetch Tags
run: |
git fetch --quiet --prune --unshallow --tags
@ -88,7 +92,7 @@ jobs:
run: |
git fetch --quiet --prune --unshallow --tags
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Configure AWS Credentials
@ -152,6 +156,10 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: Install pipenv
uses: dschep/install-pipenv-action@v1
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Setup git
run: |
git config --global user.email "you@example.com"
@ -239,6 +247,10 @@ jobs:
echo "D:\\Pulumi\\bin" >> $GITHUB_PATH
- name: Install AWS CLI Tools
uses: chrislennon/action-aws-cli@v1.1
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Check out scripts repo into the Go module directory
uses: actions/checkout@v2
with:
@ -289,7 +301,7 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Checkout Repo

View file

@ -25,7 +25,7 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Repository Dispatch
@ -41,7 +41,7 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Repository Dispatch
@ -57,7 +57,7 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Repository Dispatch
@ -73,7 +73,7 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Repository Dispatch
@ -89,7 +89,7 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Repository Dispatch
@ -105,7 +105,7 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Repository Dispatch
@ -149,6 +149,10 @@ jobs:
run: python -m pip install pip twine
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Fetch Tags
run: |
git fetch --quiet --prune --unshallow --tags
@ -184,7 +188,7 @@ jobs:
run: |
git fetch --quiet --prune --unshallow --tags
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Configure AWS Credentials
@ -263,6 +267,10 @@ jobs:
- name: Set Go Dep path
run: |
echo "PULUMI_GO_DEP_ROOT=$(dirname $(pwd))" >> $GITHUB_ENV
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Ensure
run: |
make ensure
@ -335,6 +343,10 @@ jobs:
echo "D:\\Pulumi\\bin" >> $GITHUB_PATH
- name: Install AWS CLI Tools
uses: chrislennon/action-aws-cli@v1.1
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Check out scripts repo into the Go module directory
uses: actions/checkout@v2
with:
@ -385,7 +397,7 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Checkout Repo

View file

@ -89,6 +89,10 @@ jobs:
- name: Set Go Dep path
run: |
echo "PULUMI_GO_DEP_ROOT=$(dirname $(pwd))" >> $GITHUB_ENV
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Ensure
run: |
make ensure
@ -154,6 +158,10 @@ jobs:
echo "D:\\Pulumi\\bin" >> $GITHUB_PATH
- name: Install AWS CLI Tools
uses: chrislennon/action-aws-cli@v1.1
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:

View file

@ -33,7 +33,7 @@ jobs:
- name: Install Pulumi CLI
uses: pulumi/action-install-pulumi-cli@v1.0.1
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl

View file

@ -41,7 +41,7 @@ jobs:
- name: Install Pulumi CLI
uses: pulumi/action-install-pulumi-cli@v1.0.1
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.2.0
with:
repo: pulumi/pulumictl
- name: Check out source code

View file

@ -5,7 +5,7 @@ include build/common.mk
PROJECT := github.com/pulumi/pulumi/pkg/v2/cmd/pulumi
PROJECT_PKGS := $(shell cd ./pkg && go list ./... | grep -v /vendor/)
TESTS_PKGS := $(shell cd ./tests && go list ./... | grep -v tests/templates | grep -v /vendor/)
VERSION := $(shell scripts/get-version HEAD)
VERSION := $(shell pulumictl get version)
TESTPARALLELISM := 10

View file

@ -56,21 +56,21 @@
</Target>
<Target Name="DotNetBuild">
<Exec Command="&quot;$(MSBuildThisFileDirectory)\scripts\get-version.cmd&quot;" ConsoleToMSBuild="true">
<Exec Command="pulumictl get version --language dotnet" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
</Exec>
<PropertyGroup>
<VersionPart>$(Version.Split("-")[0])</VersionPart>
<VersionPrefix>$(VersionPart.Replace("v",""))</VersionPrefix>
</PropertyGroup>
<Exec Command="dotnet build dotnet.sln /p:VersionPrefix=$(VersionPrefix) /p:VersionSuffix=preview"
<Exec Command="dotnet build dotnet.sln /p:Version=$(Version)"
WorkingDirectory="$(DotNetSdkDirectory)" />
<Exec Command="go install -ldflags &quot;-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=$(Version)&quot; github.com/pulumi/pulumi/sdk/v2/dotnet/cmd/pulumi-language-dotnet"
WorkingDirectory="$(SdkDirectory)"/>
</Target>
<Target Name="DotNetInstallPlugin">
<Exec Command="&quot;$(MSBuildThisFileDirectory)\scripts\get-version.cmd&quot;" ConsoleToMSBuild="true">
<Exec Command="pulumictl get version --language dotnet" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
</Exec>
<Exec Command="go install -ldflags &quot;-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=$(Version)&quot; github.com/pulumi/pulumi/sdk/v2/dotnet/cmd/pulumi-language-dotnet"
@ -93,7 +93,7 @@
</Target>
<Target Name="GoBuild">
<Exec Command="&quot;$(MSBuildThisFileDirectory)\scripts\get-version.cmd&quot;" ConsoleToMSBuild="true">
<Exec Command="pulumictl get version" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
</Exec>
<Exec Command="go install -ldflags &quot;-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=$(Version)&quot; github.com/pulumi/pulumi/sdk/v2/go/pulumi-language-go"
@ -101,7 +101,7 @@
</Target>
<Target Name="GoInstallPlugin">
<Exec Command="&quot;$(MSBuildThisFileDirectory)\scripts\get-version.cmd&quot;" ConsoleToMSBuild="true">
<Exec Command="pulumictl get version" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
</Exec>
<Exec Command="go install -ldflags &quot;-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=$(Version)&quot; github.com/pulumi/pulumi/sdk/v2/go/pulumi-language-go"
@ -120,7 +120,7 @@
</Target>
<Target Name="NodeJSBuild">
<Exec Command="&quot;$(MSBuildThisFileDirectory)\scripts\get-version.cmd&quot;" ConsoleToMSBuild="true">
<Exec Command="pulumictl get version --language javascript" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
</Exec>
<Exec Command="yarn run tsc" WorkingDirectory="$(NodeJSSdkDirectory)" />
@ -149,7 +149,7 @@
</ItemGroup>
<Copy SourceFiles="@(NodeJSDistFiles)"
DestinationFolder="$(PulumiBin)\" />
<Exec Command="&quot;$(MSBuildThisFileDirectory)\scripts\get-version.cmd&quot;" ConsoleToMSBuild="true">
<Exec Command="pulumictl get version --language javascript" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
</Exec>
<Exec Command="go install -ldflags &quot;-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=$(Version)&quot; github.com/pulumi/pulumi/sdk/v2/nodejs/cmd/pulumi-language-nodejs"
@ -187,7 +187,10 @@
</Target>
<Target Name="PythonBuild">
<Exec Command="&quot;$(MSBuildThisFileDirectory)\scripts\get-version.cmd&quot;" ConsoleToMSBuild="true">
<Exec Command="pulumictl get version --language python" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="PypiVersion" />
</Exec>
<Exec Command="pulumictl get version" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
</Exec>
<ItemGroup>
@ -200,7 +203,7 @@
InputFilename="$(PythonSdkDirectory)\env\src\setup.py"
OutputFilename="$(PythonSdkDirectory)\env\src\setup.py"
MatchExpression="\$\{VERSION\}"
ReplacementText="$(VERSION)" />
ReplacementText="$(PypiVersion)" />
<ItemGroup>
<ReadMeFile Include="$(RepoRootDirectory)\README.md" />
</ItemGroup>
@ -223,7 +226,7 @@
</ItemGroup>
<Copy SourceFiles="@(PythonDistFiles)"
DestinationFolder="$(PulumiBin)\" />
<Exec Command="&quot;$(MSBuildThisFileDirectory)\scripts\get-version.cmd&quot;" ConsoleToMSBuild="true">
<Exec Command="pulumictl get version" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
</Exec>
<Exec Command="go install -ldflags &quot;-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=$(Version)&quot; github.com/pulumi/pulumi/sdk/v2/python/cmd/pulumi-language-python"
@ -233,7 +236,7 @@
<!-- Install the Pulumi SDK -->
<Target Name="InstallPulumiPlugin">
<Exec Command="&quot;$(MSBuildThisFileDirectory)\scripts\get-version.cmd&quot;" ConsoleToMSBuild="true">
<Exec Command="pulumictl get version" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="Version" />
</Exec>
<Exec Command="go install -ldflags &quot;-X github.com/pulumi/pulumi/pkg/v2/version.Version=$(Version)&quot; github.com/pulumi/pulumi/pkg/v2/cmd/pulumi"

View file

@ -1,7 +0,0 @@
#!/bin/bash
set -o nounset -o errexit -o pipefail
SCRIPT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
NPM_VERSION="$($SCRIPT_ROOT/get-version "$@")"
GO111MODULE=on go run "${SCRIPT_ROOT}/get-py-version.go" "${NPM_VERSION}"

View file

@ -1,23 +0,0 @@
package main
import (
"fmt"
"os"
"github.com/pulumi/pulumi/sdk/v2/go/common/util/buildutil"
)
func main() {
if len(os.Args) != 2 {
fmt.Fprintf(os.Stderr, "error: need exactly one argument\n")
os.Exit(-1)
}
p, err := buildutil.PyPiVersionFromNpmVersion(os.Args[1])
if err != nil {
fmt.Fprintf(os.Stderr, "error: %s\n", err)
os.Exit(-1)
}
fmt.Println(p)
}

View file

@ -1,103 +0,0 @@
#!/bin/bash
set -o nounset -o errexit -o pipefail
if [ $# -eq 0 ]; then
echo "No arguments provided. Pass appropriate git commit-ish value get version of (i.e. 'HEAD')"
exit 1
fi
# Allow version to be set manually when building outside of git repo
if [ -n "${PULUMI_VERSION+x}" ]; then
echo "${PULUMI_VERSION}"
exit 0
fi
COMMITISH=$1
DIRTY_TAG=""
EXACT=0
# Figure out if the worktree is dirty, we run update-index first
# as we've seen cases in Travis where not doing so causes git to
# treat the worktree as dirty when it is not.
git update-index -q --refresh
if ! git diff-files --quiet -- . ':!**/go.mod' ':!**/go.sum'; then
DIRTY_TAG="dirty"
fi
# If we have an exact tag, just use it.
if git describe --tags --exact-match "${COMMITISH}" >/dev/null 2>&1; then
EXACT=1
TAG=$(git describe --tags --exact-match "${COMMITISH}")
# Otherwise, increment the minor version version (if the package is 1.X or later) or the
# patch version (if the package is pre 1.0), add the -alpha tag and some
# commit metadata. If there's no existing tag, pretend a v0.0.0 was
# there so we'll produce v0.0.1-dev builds.
elif git describe --tags --abbrev=0 "${COMMITISH}" > /dev/null 2>&1; then
TAG=$(git describe --tags --abbrev=0 "${COMMITISH}")
else
TAG="v0.0.0"
fi
# Check to see if the latest tag is for a submodule and transform to semver tolerant
# e.g: submodule/submodule/.../v.X.X.X
# sdk/v1.1.1 -> v1.1.1
IFS='/'
read -a tagsplit <<< "${TAG}"
if echo "${#tagsplit[@]}" > /dev/null 2>&1 -gt 1;
then
TAG=${tagsplit[${#tagsplit[@]}-1]}
fi
# if we found an exact match, return it at this point
# after we have removed any submodule prefixes.
if [ $EXACT -eq 1 ]
then
echo -n "${TAG}"
if [ ! -z "${DIRTY_TAG}" ]; then
echo -n "+${DIRTY_TAG}"
fi
echo ""
exit 0
fi
# Strip off any pre-release tag we might have (e.g. from doing a -rc build)
TAG=${TAG%%-*}
MAJOR=$(cut -d. -f1 <<< "${TAG}")
MINOR=$(cut -d. -f2 <<< "${TAG}")
PATCH=$(cut -d. -f3 <<< "${TAG}")
if [ "${MAJOR}" = "v0" ]; then
PATCH=$((${PATCH}+1))
else
MINOR=$((${MINOR}+1))
PATCH=0
fi
# if we're in a features/xxx branch and caller passed --embed-feature-branch then append `-xxx` to
# the version as well.
FEATURE_TAG=""
for arg in "$@"
do
if [[ "$arg" == "--embed-feature-branch" ]]; then
if [[ "${TRAVIS_BRANCH:-}" == features/* ]]; then
FEATURE_TAG=$(echo "${TRAVIS_BRANCH}" | sed -e 's|^features/|-|g')
fi
if [[ "${TRAVIS_BRANCH:-}" == feature-* ]]; then
FEATURE_TAG=$(echo "${TRAVIS_BRANCH}")
fi
fi
done
# We want to include some additional information. To the base tag we
# add a timestamp and commit hash. We use the timestamp of the commit
# itself, not the date it was authored (so it will change when someone
# rebases a PR into master, for example).
echo -n "${MAJOR}.${MINOR}.${PATCH}-alpha${FEATURE_TAG}.$(git show -s --format='%ct+g%h' ${COMMITISH})"
if [ ! -z "${DIRTY_TAG}" ]; then
echo -n ".${DIRTY_TAG}"
fi
echo ""

View file

@ -1,2 +0,0 @@
@echo off
powershell -noprofile -executionPolicy Unrestricted -file "%~dpn0.ps1" %*

View file

@ -1,55 +0,0 @@
Set-StrictMode -Version 2.0
$ErrorActionPreference="Stop"
git update-index -q --refresh
git diff-files --quiet -- . ':!**/go.mod' ':!**/go.sum' | Out-Null
$dirty=($LASTEXITCODE -ne 0)
try {
git describe --tags --exact-match >$null 2>$null
# If we get here the above did not throw, so we can use the exact tag
$tag = "$(git describe --tags --exact-match)"
# Remove any sub-module prefixes
if ($tag.LastIndexOf("/") -ne -1) {
$tag=$tag.Substring($tag.LastIndexOf("/")+1)
}
if ($dirty) {
Write-Output "$tag+dirty"
} else {
Write-Output "$tag"
}
} catch {
# Otherwise, take the existing tag, increment the patch version and append the timestamp of the commit and hash
$tag=""
try {
git describe --tags --abbrev=0 >$null 2>$null
$tag="$(git describe --tags --abbrev=0)"
} catch {
$tag="v0.0.0"
}
# Remove any sub-module prefixes
if ($tag.LastIndexOf("/") -ne -1) {
$tag=$tag.Substring($tag.LastIndexOf("/")+1)
}
# Remove any pre-release tag
if ($tag.LastIndexOf("-") -ne -1) {
$tag=$tag.Substring(0, $tag.LastIndexOf("-"))
}
$tagParts = $tag.Split('.');
$major = $tagParts[0];
$minor = $tagParts[1];
$patch = $tagParts[2];
$patch = ([int]$patch + 1);
if ($dirty) {
Write-Output "$major.$minor.$patch-dev.$(git show -s --format='%ct+g%h').dirty"
} else {
Write-Output "$major.$minor.$patch-dev.$(git show -s --format='%ct+g%h')"
}
}

View file

@ -6,7 +6,7 @@ $Root=Join-Path $PSScriptRoot ".."
$PublishDir=New-Item -ItemType Directory -Path "$env:TEMP\$([System.IO.Path]::GetRandomFileName())"
$GitHash=$(git rev-parse HEAD)
$PublishFile="$(Split-Path -Parent -Path $PublishDir)\$GitHash.zip"
$Version = $( & "$PSScriptRoot\get-version.cmd")
$Version = $( & "pulumictl get version --language python")
$Branch = $(if (Test-Path env:APPVEYOR_REPO_BRANCH) { $env:APPVEYOR_REPO_BRANCH } else { $(git rev-parse --abbrev-ref HEAD) })
$PublishTargets = @($GitHash, $Version, $Branch)

View file

@ -8,7 +8,10 @@ readonly ROOT=$(dirname "${0}")/..
readonly PUBDIR=$(mktemp -d)
readonly GITHASH=$(git rev-parse HEAD)
readonly PUBFILE=$(dirname "${PUBDIR})/${GITHASH}.tgz")
readonly VERSION=$("${ROOT}/scripts/get-version" HEAD)
readonly VERSION=$(pulumictl get version)
echo $VERSION
exit 1
# Figure out which branch we're on. Prefer $TRAVIS_BRANCH, if set, since
# Travis leaves us at detached HEAD and `git rev-parse` just returns "HEAD".

View file

@ -16,5 +16,5 @@ $PublishTargets=${ReleaseInfo}.Targets
Remove-Item -Force $ReleaseInfo.ArchivePath
$Version=& $PSScriptRoot\get-version.ps1
$Version=& "$(pulumictl get version)"
& $BuildSdkScript $Version "$(git rev-parse HEAD)"

View file

@ -5,7 +5,7 @@ set -o errexit
set -o pipefail
readonly ROOT=$(dirname "${0}")/..
NPM_VERSION=$("${ROOT}/scripts/get-version" HEAD)
NPM_VERSION=$(pulumictl get version --language javascript)
"${ROOT}/scripts/build-sdk.sh" $(echo ${NPM_VERSION} | sed -e 's/\+.*//g') $(git rev-parse HEAD)
if [[ "${TRAVIS_PUBLISH_PACKAGES:-}" == "true" ]]; then

View file

@ -1,15 +1,16 @@
PROJECT_NAME := Pulumi .NET Core SDK
LANGHOST_PKG := github.com/pulumi/pulumi/sdk/v2/dotnet/cmd/pulumi-language-dotnet
PROJECT_NAME := Pulumi .NET Core SDK
LANGHOST_PKG := github.com/pulumi/pulumi/sdk/v2/dotnet/cmd/pulumi-language-dotnet
PROJECT_PKGS := $(shell go list ./cmd...)
PROJECT_PKGS := $(shell go list ./cmd...)
VERSION := $(shell ../../scripts/get-version HEAD --embed-feature-branch)
VERSION_DOTNET := ${VERSION:v%=%} # strip v from the beginning
VERSION_FIRST_WORD := $(word 1,$(subst -, ,${VERSION_DOTNET})) # e.g. 1.5.0
VERSION_SECOND_WORD := $(word 2,$(subst -, ,${VERSION_DOTNET})) # e.g. alpha or alpha.1
VERSION_THIRD_WORD := $(word 3,$(subst -, ,${VERSION_DOTNET})) # e.g. featbranch or featbranch.1
DOTNET_VERSION := $(shell cd ../../ && pulumictl get version --language dotnet)
VERSION_PREFIX := $(strip ${VERSION_FIRST_WORD})
### TO-DO: Automation Version - this will be deleted at 3.0
VERSION_FIRST_WORD := $(word 1,$(subst -, ,${DOTNET_VERSION})) # e.g. 1.5.0
VERSION_SECOND_WORD := $(word 2,$(subst -, ,${DOTNET_VERSION})) # e.g. alpha or alpha.1
VERSION_THIRD_WORD := $(word 3,$(subst -, ,${DOTNET_VERSION})) # e.g. featbranch or featbranch.1
PREVIEW_VERSION_PREFIX := $(strip ${VERSION_FIRST_WORD})
ifeq ($(strip ${VERSION_SECOND_WORD}),)
VERSION_SUFFIX := ""
@ -38,13 +39,13 @@ build::
# following:
#
# -alpha: Alpha release, typically used for work-in-progress and experimentation
dotnet clean
dotnet build dotnet.sln /p:VersionPrefix=${VERSION_PREFIX} /p:VersionSuffix=${VERSION_SUFFIX}
go install -ldflags "-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=${VERSION}" ${LANGHOST_PKG}
#dotnet clean
dotnet build dotnet.sln /p:Version=${DOTNET_VERSION}
go install -ldflags "-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=${DOTNET_VERSION}" ${LANGHOST_PKG}
# Automation is pre-release, so build it separately with a different version to produce a preview NuGet package
dotnet pack Pulumi.Automation/Pulumi.Automation.csproj /p:VersionPrefix=${VERSION_PREFIX} /p:VersionSuffix=${PREVIEW_VERSION_SUFFIX}
dotnet pack Pulumi.Automation/Pulumi.Automation.csproj /p:VersionPrefix=${PREVIEW_VERSION_PREFIX} /p:VersionSuffix=${PREVIEW_VERSION_SUFFIX}
ifneq (${PREVIEW_VERSION_SUFFIX},${VERSION_SUFFIX})
rm -f ./Pulumi/bin/*/Pulumi.${VERSION_PREFIX}-${PREVIEW_VERSION_SUFFIX}.nupkg
rm -f ./Pulumi/bin/*/Pulumi.${PREVIEW_VERSION_PREFIX}-${PREVIEW_VERSION_SUFFIX}.nupkg
endif
install_plugin::
@ -58,7 +59,7 @@ install:: build install_plugin
dotnet_test:: install
# include the version prefix/suffix to avoid generating a separate nupkg file
dotnet test /p:VersionPrefix=${VERSION_PREFIX} /p:VersionSuffix=${VERSION_SUFFIX}
dotnet test /p:Version=${DOTNET_VERSION}
test_fast:: dotnet_test
$(GO_TEST_FAST) ${PROJECT_PKGS}

View file

@ -1,6 +1,6 @@
PROJECT_NAME := Pulumi Go SDK
LANGHOST_PKG := github.com/pulumi/pulumi/sdk/v2/go/pulumi-language-go
VERSION := $(shell ../../scripts/get-version HEAD)
VERSION := $(shell cd ../../ && pulumictl get version)
PROJECT_PKGS := $(shell go list ./pulumi/... ./pulumi-language-go/... ./common/... ./x/...| grep -v /vendor/ | grep -v templates)
TESTPARALLELISM := 10

View file

@ -1,6 +1,6 @@
PROJECT_NAME := Pulumi Node.JS SDK
NODE_MODULE_NAME := @pulumi/pulumi
VERSION := $(shell ../../scripts/get-version HEAD)
VERSION := $(shell cd ../../ && pulumictl get version --language javascript)
LANGUAGE_HOST := github.com/pulumi/pulumi/sdk/v2/nodejs/cmd/pulumi-language-nodejs

View file

@ -1,7 +1,7 @@
PROJECT_NAME := Pulumi Python SDK
LANGHOST_PKG := github.com/pulumi/pulumi/sdk/v2/python/cmd/pulumi-language-python
VERSION := $(shell ../../scripts/get-version HEAD)
PYPI_VERSION := $(shell cd ../../scripts && ./get-py-version HEAD)
VERSION := $(shell cd ../../ && pulumictl get version)
PYPI_VERSION := $(shell cd ../../ && pulumictl get version --language python)
PYENV := ./env
PYENVSRC := $(PYENV)/src