Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support installing a specific version of porter #730

Merged
merged 1 commit into from
Oct 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,13 @@ docs-gen:
docs-preview:
hugo serve --source docs/

prep-install-scripts:
publish:
mkdir -p bin/$(VERSION)
sed 's|UNKNOWN|$(PERMALINK)|g' scripts/install/install-mac.sh > bin/$(VERSION)/install-mac.sh
sed 's|UNKNOWN|$(PERMALINK)|g' scripts/install/install-linux.sh > bin/$(VERSION)/install-linux.sh
sed 's|UNKNOWN|$(PERMALINK)|g' scripts/install/install-windows.ps1 > bin/$(VERSION)/install-windows.ps1

publish: prep-install-scripts
$(MAKE) $(MAKE_OPTS) publish MIXIN=exec -f mixin.mk
$(MAKE) $(MAKE_OPTS) publish MIXIN=kubernetes -f mixin.mk

VERSION=$(VERSION) PERMALINK=$(PERMALINK) ./scripts/prep-install-scripts.sh

# AZURE_STORAGE_CONNECTION_STRING will be used for auth in the following commands
if [[ "$(PERMALINK)" == "latest" ]]; then \
az storage blob upload-batch -d porter/$(VERSION) -s bin/$(VERSION); \
Expand Down
30 changes: 29 additions & 1 deletion docs/content/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ We have a few release types available for you to use:

* [Latest](#latest)
* [Canary](#canary)
* [Older Version](#older-version)

You can also install and manage [mixins](#mixins) using porter.

# Latest

Expand Down Expand Up @@ -50,6 +53,29 @@ curl https://cdn.deislabs.io/porter/canary/install-linux.sh | bash
iwr "https://cdn.deislabs.io/porter/canary/install-windows.ps1" -UseBasicParsing | iex
```

# Older Version

Install an older version of porter. This also installs the latest version of all the mixins.
If you need a specific version of a mixin, use the `--version` flag when
[installing the mixin](#mixin).

See the porter [releases][releases] page for a list of older porter versions.

## Older Version MacOS
```
curl https://cdn.deislabs.io/porter/VERSION/install-mac.sh | bash
```

## Older Version Linux
```
curl https://cdn.deislabs.io/porter/VERSION/install-linux.sh | bash
```

## Older Version Windows
```
iwr "https://cdn.deislabs.io/porter/VERSION/install-windows.ps1" -UseBasicParsing | iex
```

# Mixins

We have a number of [mixins](/mixins) to help you get started. The stable ones
Expand All @@ -70,4 +96,6 @@ installed terraform mixin
v0.3.0-beta.1 (0d24b85)
```

All of the DeisLabs mixins are published to `https://cdn.deislabs.io/porter/atom.xml`.
All of the DeisLabs mixins are published to `https://cdn.deislabs.io/porter/atom.xml`.

[releases]: https://github.com/deislabs/porter/releases
21 changes: 11 additions & 10 deletions scripts/install/install-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@ set -euo pipefail

PORTER_HOME=~/.porter
PORTER_URL=https://deislabs.blob.core.windows.net/porter
PORTER_VERSION=${PORTER_VERSION:-UNKNOWN}
PORTER_PERMALINK=${PORTER_PERMALINK:-latest}
MIXIN_PERMALINK=${MIXIN_PERMALINK:-latest}
echo "Installing porter to $PORTER_HOME"

mkdir -p $PORTER_HOME

curl -fsSLo $PORTER_HOME/porter $PORTER_URL/$PORTER_VERSION/porter-linux-amd64
curl -fsSLo $PORTER_HOME/porter $PORTER_URL/$PORTER_PERMALINK/porter-linux-amd64
chmod +x $PORTER_HOME/porter
cp $PORTER_HOME/porter $PORTER_HOME/porter-runtime
echo Installed `$PORTER_HOME/porter version`

$PORTER_HOME/porter mixin install exec --version $PORTER_VERSION
$PORTER_HOME/porter mixin install kubernetes --version $PORTER_VERSION
$PORTER_HOME/porter mixin install helm --version $PORTER_VERSION
$PORTER_HOME/porter mixin install azure --version $PORTER_VERSION
$PORTER_HOME/porter mixin install terraform --version $PORTER_VERSION
$PORTER_HOME/porter mixin install az --version $PORTER_VERSION
$PORTER_HOME/porter mixin install aws --version $PORTER_VERSION
$PORTER_HOME/porter mixin install gcloud --version $PORTER_VERSION
$PORTER_HOME/porter mixin install exec --version $MIXIN_PERMALINK
$PORTER_HOME/porter mixin install kubernetes --version $MIXIN_PERMALINK
$PORTER_HOME/porter mixin install helm --version $MIXIN_PERMALINK
$PORTER_HOME/porter mixin install azure --version $MIXIN_PERMALINK
$PORTER_HOME/porter mixin install terraform --version $MIXIN_PERMALINK
$PORTER_HOME/porter mixin install az --version $MIXIN_PERMALINK
$PORTER_HOME/porter mixin install aws --version $MIXIN_PERMALINK
$PORTER_HOME/porter mixin install gcloud --version $MIXIN_PERMALINK

echo "Installation complete."
echo "Add porter to your path by running:"
Expand Down
23 changes: 12 additions & 11 deletions scripts/install/install-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@ set -euo pipefail

PORTER_HOME=~/.porter
PORTER_URL=https://deislabs.blob.core.windows.net/porter
PORTER_VERSION=${PORTER_VERSION:-UNKNOWN}
PORTER_PERMALINK=${PORTER_PERMALINK:-latest}
MIXIN_PERMALINK=${MIXIN_PERMALINK:-latest}
echo "Installing porter to $PORTER_HOME"

mkdir -p $PORTER_HOME

curl -fsSLo $PORTER_HOME/porter $PORTER_URL/$PORTER_VERSION/porter-darwin-amd64
curl -fsSLo $PORTER_HOME/porter-runtime $PORTER_URL/$PORTER_VERSION/porter-linux-amd64
curl -fsSLo $PORTER_HOME/porter $PORTER_URL/$PORTER_PERMALINK/porter-darwin-amd64
curl -fsSLo $PORTER_HOME/porter-runtime $PORTER_URL/$PORTER_PERMALINK/porter-linux-amd64
chmod +x $PORTER_HOME/porter
chmod +x $PORTER_HOME/porter-runtime
echo Installed `$PORTER_HOME/porter version`

$PORTER_HOME/porter mixin install exec --version $PORTER_VERSION
$PORTER_HOME/porter mixin install kubernetes --version $PORTER_VERSION
$PORTER_HOME/porter mixin install helm --version $PORTER_VERSION
$PORTER_HOME/porter mixin install azure --version $PORTER_VERSION
$PORTER_HOME/porter mixin install terraform --version $PORTER_VERSION
$PORTER_HOME/porter mixin install az --version $PORTER_VERSION
$PORTER_HOME/porter mixin install aws --version $PORTER_VERSION
$PORTER_HOME/porter mixin install gcloud --version $PORTER_VERSION
$PORTER_HOME/porter mixin install exec --version $MIXIN_PERMALINK
$PORTER_HOME/porter mixin install kubernetes --version $MIXIN_PERMALINK
$PORTER_HOME/porter mixin install helm --version $MIXIN_PERMALINK
$PORTER_HOME/porter mixin install azure --version $MIXIN_PERMALINK
$PORTER_HOME/porter mixin install terraform --version $MIXIN_PERMALINK
$PORTER_HOME/porter mixin install az --version $MIXIN_PERMALINK
$PORTER_HOME/porter mixin install aws --version $MIXIN_PERMALINK
$PORTER_HOME/porter mixin install gcloud --version $MIXIN_PERMALINK

echo "Installation complete."
echo "Add porter to your path by running:"
Expand Down
22 changes: 11 additions & 11 deletions scripts/install/install-windows.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
param([String]$PORTER_VERSION="UNKNOWN")
param([String]$PORTER_PERMALINK='latest', [String]$MIXIN_PERMALINK='latest')

$PORTER_HOME="$env:USERPROFILE\.porter"
$PORTER_URL="https://cdn.deislabs.io/porter"
Expand All @@ -7,18 +7,18 @@ echo "Installing porter to $PORTER_HOME"

mkdir -f $PORTER_HOME

(new-object System.Net.WebClient).DownloadFile("$PORTER_URL/$PORTER_VERSION/porter-windows-amd64.exe", "$PORTER_HOME\porter.exe")
(new-object System.Net.WebClient).DownloadFile("$PORTER_URL/$PORTER_VERSION/porter-linux-amd64", "$PORTER_HOME\porter-runtime")
(new-object System.Net.WebClient).DownloadFile("$PORTER_URL/$PORTER_PERMALINK/porter-windows-amd64.exe", "$PORTER_HOME\porter.exe")
(new-object System.Net.WebClient).DownloadFile("$PORTER_URL/$PORTER_PERMALINK/porter-linux-amd64", "$PORTER_HOME\porter-runtime")
echo "Installed $(& $PORTER_HOME\porter.exe version)"

& $PORTER_HOME/porter mixin install exec --version $PORTER_VERSION
& $PORTER_HOME/porter mixin install kubernetes --version $PORTER_VERSION
& $PORTER_HOME/porter mixin install helm --version $PORTER_VERSION
& $PORTER_HOME/porter mixin install azure --version $PORTER_VERSION
& $PORTER_HOME/porter mixin install terraform --version $PORTER_VERSION
& $PORTER_HOME/porter mixin install az --version $PORTER_VERSION
& $PORTER_HOME/porter mixin install aws --version $PORTER_VERSION
& $PORTER_HOME/porter mixin install gcloud --version $PORTER_VERSION
& $PORTER_HOME/porter mixin install exec --version $MIXIN_PERMALINK
& $PORTER_HOME/porter mixin install kubernetes --version $MIXIN_PERMALINK
& $PORTER_HOME/porter mixin install helm --version $MIXIN_PERMALINK
& $PORTER_HOME/porter mixin install azure --version $MIXIN_PERMALINK
& $PORTER_HOME/porter mixin install terraform --version $MIXIN_PERMALINK
& $PORTER_HOME/porter mixin install az --version $MIXIN_PERMALINK
& $PORTER_HOME/porter mixin install aws --version $MIXIN_PERMALINK
& $PORTER_HOME/porter mixin install gcloud --version $MIXIN_PERMALINK

echo "Installation complete."
echo "Add porter to your path by running:"
Expand Down
15 changes: 15 additions & 0 deletions scripts/prep-install-scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail

# PERMALINK and VERSION must be set before calling this script
# It is intended to only be executed by make publish

if [[ "$PERMALINK" = "canary" ]]; then
PORTER_PERMALINK=$PERMALINK
else
PORTER_PERMALINK=$VERSION
fi

sed -e "s|PORTER_PERMALINK:-latest|PORTER_PERMALINK:-$PORTER_PERMALINK|g" -e "s|MIXIN_PERMALINK:-latest|MIXIN_PERMALINK:-$PERMALINK|" scripts/install/install-mac.sh > bin/$VERSION/install-mac.sh
sed -e "s|PORTER_PERMALINK:-latest|PORTER_PERMALINK:-$PORTER_PERMALINK|g" -e "s|MIXIN_PERMALINK:-latest|MIXIN_PERMALINK:-$PERMALINK|" scripts/install/install-linux.sh > bin/$VERSION/install-linux.sh
sed -e "s|PORTER_PERMALINK='latest'|PORTER_PERMALINK='$PORTER_PERMALINK'|g" -e "s|MIXIN_PERMALINK='latest'|MIXIN_PERMALINK='$PERMALINK'|g" scripts/install/install-windows.ps1 > bin/$VERSION/install-windows.ps1
10 changes: 8 additions & 2 deletions scripts/test/test-linux-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@

set -xeuo pipefail

PORTER_VERSION=canary ./scripts/install/install-linux.sh
PORTER_VERSION=latest ./scripts/install/install-linux.sh
export PATH=$PATH:~/.porter

PORTER_PERMALINK=canary ./scripts/install/install-linux.sh

PORTER_PERMALINK=v0.16.0-beta.1 ./scripts/install/install-linux.sh
porter version | grep v0.16.0-beta.1

PORTER_PERMALINK=latest ./scripts/install/install-linux.sh
10 changes: 8 additions & 2 deletions scripts/test/test-mac-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@

set -xeuo pipefail

PORTER_VERSION=canary ./scripts/install/install-mac.sh
PORTER_VERSION=latest ./scripts/install/install-mac.sh
export PATH=$PATH:~/.porter

PORTER_PERMALINK=canary ./scripts/install/install-mac.sh

PORTER_PERMALINK=v0.16.0-beta.1 ./scripts/install/install-mac.sh
porter version | grep v0.16.0-beta.1

PORTER_PERMALINK=latest ./scripts/install/install-mac.sh
16 changes: 14 additions & 2 deletions scripts/test/test-windows-install.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
& $PSScriptRoot\..\install\install-windows.ps1 -PORTER_VERSION canary
& $PSScriptRoot\..\install\install-windows.ps1 -PORTER_VERSION latest
$ErrorActionPreference = "Stop"

$env:PATH+=";$env:USERPROFILE\.porter"

& $PSScriptRoot\..\install\install-windows.ps1 -PORTER_PERMALINK canary

& $PSScriptRoot\..\install\install-windows.ps1 -PORTER_PERMALINK v0.16.0-beta.1
if (-Not (porter version | Select-String -Pattern 'v0.16.0-beta.1' -SimpleMatch))
{
echo "Failed to install a specific version of porter"
Exit 1
}

& $PSScriptRoot\..\install\install-windows.ps1 -PORTER_PERMALINK latest