From 6cad50fea31f35ced1af33d5c8c548defcd52a62 Mon Sep 17 00:00:00 2001 From: Lee Briggs Date: Sun, 21 Jun 2020 15:35:31 -0700 Subject: [PATCH 1/5] update scripts to support community packages --- ci/add-plugin-installer-script.js | 2 +- ci/publish-tfgen-package | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/add-plugin-installer-script.js b/ci/add-plugin-installer-script.js index 1d75d34..5fed515 100644 --- a/ci/add-plugin-installer-script.js +++ b/ci/add-plugin-installer-script.js @@ -37,7 +37,7 @@ stdin.on("close", function() { if (name.lastIndexOf("/") !== -1) { name = name.substring(name.lastIndexOf("/")+1); } - packageJSON.scripts["install"] = `node scripts/install-pulumi-plugin.js resource ${name} ${packageJSON.version}`; + packageJSON.scripts["install"] = `node scripts/install-pulumi-plugin.js resource ${name} --server ${packageJSON.repository}/releases/download/${packageJSON.version} ${packageJSON.version}`; // Now print out the result to stdout. console.log(JSON.stringify(packageJSON, null, 4)); diff --git a/ci/publish-tfgen-package b/ci/publish-tfgen-package index bc9e960..70f77f1 100755 --- a/ci/publish-tfgen-package +++ b/ci/publish-tfgen-package @@ -94,9 +94,9 @@ if [[ "${TRAVIS_OS_NAME:-}" == "linux" ]]; then if [ -n "${NO_TFGEN_PYTHON_PACKAGE}" ] ; then echo "Skipping publishing pip package because of NO_TFGEN_PYTHON_PACKAGE" else - echo "Publishing Pip package to pulumi.com:" + echo "Publishing Pip package to pypi:" twine upload \ - -u pulumi -p "${PYPI_PASSWORD}" \ + -u "${PYPI_USERNAME}" -p "${PYPI_PASSWORD}" \ "${SOURCE_ROOT}/sdk/python/bin/dist/*.tar.gz" \ --skip-existing \ --verbose From 76c10f53b622d06edb19660b7eaad88bd4730876 Mon Sep 17 00:00:00 2001 From: Lee Briggs Date: Sun, 21 Jun 2020 15:37:24 -0700 Subject: [PATCH 2/5] set nounset This will stop the publish script publishing if there's a variable unset --- ci/publish-tfgen-package | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/publish-tfgen-package b/ci/publish-tfgen-package index 70f77f1..83887dc 100755 --- a/ci/publish-tfgen-package +++ b/ci/publish-tfgen-package @@ -11,6 +11,7 @@ set -o errexit set -o pipefail +set -o nounset if [ "$#" -ne 1 ]; then >&2 echo "usage: $0 " From a4c56a180401c0a5250153720b8198ee05019475 Mon Sep 17 00:00:00 2001 From: Lee Briggs Date: Sun, 21 Jun 2020 15:41:01 -0700 Subject: [PATCH 3/5] better variable error checking --- ci/publish-tfgen-package | 47 +++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/ci/publish-tfgen-package b/ci/publish-tfgen-package index 83887dc..07182c8 100755 --- a/ci/publish-tfgen-package +++ b/ci/publish-tfgen-package @@ -11,13 +11,32 @@ set -o errexit set -o pipefail -set -o nounset if [ "$#" -ne 1 ]; then >&2 echo "usage: $0 " exit 1 fi +if [[ -z "$PYPI_USERNAME" ]]; then + echo "Must provide PYPI_USERNAME" 1>&2 + exit 1 +fi + +if [[ -z "$PYPI_PASSWORD" ]]; then + echo "Must provide PYPI_PASSWORD" 1>&2 + exit 1 +fi + +if [[ -z "$NUGET_PUBLISH_KEY" ]]; then + echo "Must provide NUGET_PUBLISH_KEY" 1>&2 + exit 1 +fi + +if [[ -z "$NPM_TOKEN" ]]; then + echo "Must provide NPM_TOKEN" 1>&2 + exit 1 +fi + SCRIPT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" SOURCE_ROOT="$1" @@ -44,17 +63,6 @@ if [[ "${TRAVIS_OS_NAME:-}" == "linux" ]]; then NPM_TAG="dev" - # We use the "features/" and "feature-" prefix on branches that we want to build and publish for - # doing cross repo work. But in this case, we don't want to publish over "dev", since the bits - # could be totally busted and the dev tag tracks master. - if [[ "${TRAVIS_BRANCH:-}" == features/* ]]; then - NPM_TAG=$(echo "${TRAVIS_BRANCH}" | sed -e 's|^features/|feature-|g') - fi - - if [[ "${TRAVIS_BRANCH:-}" == feature-* ]]; then - NPM_TAG=$(echo "${TRAVIS_BRANCH}") - fi - # If the package doesn't have a pre-release tag, use the tag of latest instead of # dev. NPM uses this tag as the default version to add, so we want it to mean # the newest released version. @@ -91,17 +99,12 @@ if [[ "${TRAVIS_OS_NAME:-}" == "linux" ]]; then mv package.json.dev package.json popd - # Next, publish the PyPI package, if we didn't opt out - if [ -n "${NO_TFGEN_PYTHON_PACKAGE}" ] ; then - echo "Skipping publishing pip package because of NO_TFGEN_PYTHON_PACKAGE" - else - echo "Publishing Pip package to pypi:" - twine upload \ - -u "${PYPI_USERNAME}" -p "${PYPI_PASSWORD}" \ - "${SOURCE_ROOT}/sdk/python/bin/dist/*.tar.gz" \ + echo "Publishing Pip package to pypi:" + twine upload \ + -u "${PYPI_USERNAME}" -p "${PYPI_PASSWORD}" \ + "${SOURCE_ROOT}/sdk/python/bin/dist/*.tar.gz" \ --skip-existing \ - --verbose - fi + --verbose # Finally, publish the NuGet package if any exists. if [ -n "${NUGET_PUBLISH_KEY}" ]; then From c8eb8c46e065eab2909681e2005492b3912475f0 Mon Sep 17 00:00:00 2001 From: Lee Briggs Date: Tue, 4 Jan 2022 20:04:25 -0800 Subject: [PATCH 4/5] use xargs for nuget publish --- ci/publish-tfgen-package | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/publish-tfgen-package b/ci/publish-tfgen-package index 65e9147..fd4421b 100755 --- a/ci/publish-tfgen-package +++ b/ci/publish-tfgen-package @@ -121,7 +121,7 @@ if [[ "${TRAVIS_OS_NAME:-}" == "linux" ]]; then # Finally, publish the NuGet package if any exists. if [ -n "${NUGET_PUBLISH_KEY}" ]; then - find "${SOURCE_ROOT}/sdk/dotnet/bin/Debug/" -name 'Pulumi.*.nupkg' \ - -exec dotnet nuget push -k "${NUGET_PUBLISH_KEY}" -s https://api.nuget.org/v3/index.json {} ';' + find "${SOURCE_ROOT}/sdk/dotnet/bin/Debug/" -name 'Pulumi.*.nupkg' | \ + xargs dotnet nuget push -k "${NUGET_PUBLISH_KEY}" -s https://api.nuget.org/v3/index.json fi fi From 53e2b571f04225b5a70eea6ff88fbd12adeb4922 Mon Sep 17 00:00:00 2001 From: Lee Briggs Date: Tue, 4 Jan 2022 20:06:01 -0800 Subject: [PATCH 5/5] remove --server flag --- ci/add-plugin-installer-script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/add-plugin-installer-script.js b/ci/add-plugin-installer-script.js index 5fed515..1d75d34 100644 --- a/ci/add-plugin-installer-script.js +++ b/ci/add-plugin-installer-script.js @@ -37,7 +37,7 @@ stdin.on("close", function() { if (name.lastIndexOf("/") !== -1) { name = name.substring(name.lastIndexOf("/")+1); } - packageJSON.scripts["install"] = `node scripts/install-pulumi-plugin.js resource ${name} --server ${packageJSON.repository}/releases/download/${packageJSON.version} ${packageJSON.version}`; + packageJSON.scripts["install"] = `node scripts/install-pulumi-plugin.js resource ${name} ${packageJSON.version}`; // Now print out the result to stdout. console.log(JSON.stringify(packageJSON, null, 4));