nixpkgs/pkgs/tools/admin/pulumi/update.sh

78 lines
2.0 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2020-09-24 17:02:12 +03:00
# Bash 3 compatible for Darwin
2020-09-24 17:02:12 +03:00
# Version of Pulumi from
# https://www.pulumi.com/docs/get-started/install/versions/
2021-01-21 21:08:05 +03:00
VERSION="2.18.2"
2020-09-24 17:02:12 +03:00
# Grab latest release ${VERSION} from
# https://github.com/pulumi/pulumi-${NAME}/releases
plugins=(
2021-01-18 17:51:36 +03:00
"auth0=1.5.2"
2021-01-21 21:08:05 +03:00
"aws=3.25.0"
2021-01-18 17:51:36 +03:00
"cloudflare=2.11.1"
2021-01-21 21:08:05 +03:00
"consul=2.7.0"
"datadog=2.15.0"
"digitalocean=3.3.0"
2021-01-18 17:51:36 +03:00
"docker=2.6.1"
2021-01-21 21:08:05 +03:00
"gcp=4.8.0"
"github=2.5.0"
"gitlab=3.5.0"
2021-01-18 17:51:36 +03:00
"hcloud=0.5.1"
2021-01-21 21:08:05 +03:00
"kubernetes=2.7.7"
2021-01-18 17:51:36 +03:00
"mailgun=2.3.2"
"mysql=2.3.3"
2021-01-21 21:08:05 +03:00
"openstack=2.11.0"
2020-12-04 22:45:53 +03:00
"packet=3.2.2"
2021-01-18 17:51:36 +03:00
"postgresql=2.5.3"
"random=3.0.1"
"vault=3.2.1"
"vsphere=2.11.4"
)
function genMainSrc() {
local url="https://get.pulumi.com/releases/sdk/pulumi-v${VERSION}-$1-x64.tar.gz"
local sha256
sha256=$(nix-prefetch-url "$url")
echo " {"
echo " url = \"${url}\";"
echo " sha256 = \"$sha256\";"
echo " }"
}
function genSrcs() {
2020-07-14 01:16:00 +03:00
for plugVers in "${plugins[@]}"; do
local plug=${plugVers%=*}
local version=${plugVers#*=}
# url as defined here
# https://github.com/pulumi/pulumi/blob/06d4dde8898b2a0de2c3c7ff8e45f97495b89d82/pkg/workspace/plugins.go#L197
local url="https://api.pulumi.com/releases/plugins/pulumi-resource-${plug}-v${version}-$1-amd64.tar.gz"
local sha256
sha256=$(nix-prefetch-url "$url")
echo " {"
echo " url = \"${url}\";"
echo " sha256 = \"$sha256\";"
echo " }"
done
}
2020-07-14 01:16:00 +03:00
cat <<EOF > data.nix
# DO NOT EDIT! This file is generated automatically by update.sh
{ }:
{
version = "${VERSION}";
pulumiPkgs = {
x86_64-linux = [
EOF
2020-07-14 01:16:00 +03:00
genMainSrc "linux" >> data.nix
genSrcs "linux" >> data.nix
echo " ];" >> data.nix
echo " x86_64-darwin = [" >> data.nix
genMainSrc "darwin" >> data.nix
genSrcs "darwin" >> data.nix
echo " ];" >> data.nix
echo " };" >> data.nix
echo "}" >> data.nix