Skip to content

Commit 1e971d7

Browse files
Merge pull request #730 from carolynvs/install-specific-version
Support installing a specific version of porter
2 parents 2a660dd + 2d8ae20 commit 1e971d7

9 files changed

+111
-45
lines changed

Makefile

+3-6
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,13 @@ docs-gen:
110110
docs-preview:
111111
hugo serve --source docs/
112112

113-
prep-install-scripts:
113+
publish:
114114
mkdir -p bin/$(VERSION)
115-
sed 's|UNKNOWN|$(PERMALINK)|g' scripts/install/install-mac.sh > bin/$(VERSION)/install-mac.sh
116-
sed 's|UNKNOWN|$(PERMALINK)|g' scripts/install/install-linux.sh > bin/$(VERSION)/install-linux.sh
117-
sed 's|UNKNOWN|$(PERMALINK)|g' scripts/install/install-windows.ps1 > bin/$(VERSION)/install-windows.ps1
118-
119-
publish: prep-install-scripts
120115
$(MAKE) $(MAKE_OPTS) publish MIXIN=exec -f mixin.mk
121116
$(MAKE) $(MAKE_OPTS) publish MIXIN=kubernetes -f mixin.mk
122117

118+
VERSION=$(VERSION) PERMALINK=$(PERMALINK) ./scripts/prep-install-scripts.sh
119+
123120
# AZURE_STORAGE_CONNECTION_STRING will be used for auth in the following commands
124121
if [[ "$(PERMALINK)" == "latest" ]]; then \
125122
az storage blob upload-batch -d porter/$(VERSION) -s bin/$(VERSION); \

docs/content/install.md

+29-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ We have a few release types available for you to use:
77

88
* [Latest](#latest)
99
* [Canary](#canary)
10+
* [Older Version](#older-version)
11+
12+
You can also install and manage [mixins](#mixins) using porter.
1013

1114
# Latest
1215

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

56+
# Older Version
57+
58+
Install an older version of porter. This also installs the latest version of all the mixins.
59+
If you need a specific version of a mixin, use the `--version` flag when
60+
[installing the mixin](#mixin).
61+
62+
See the porter [releases][releases] page for a list of older porter versions.
63+
64+
## Older Version MacOS
65+
```
66+
curl https://cdn.deislabs.io/porter/VERSION/install-mac.sh | bash
67+
```
68+
69+
## Older Version Linux
70+
```
71+
curl https://cdn.deislabs.io/porter/VERSION/install-linux.sh | bash
72+
```
73+
74+
## Older Version Windows
75+
```
76+
iwr "https://cdn.deislabs.io/porter/VERSION/install-windows.ps1" -UseBasicParsing | iex
77+
```
78+
5379
# Mixins
5480

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

73-
All of the DeisLabs mixins are published to `https://cdn.deislabs.io/porter/atom.xml`.
99+
All of the DeisLabs mixins are published to `https://cdn.deislabs.io/porter/atom.xml`.
100+
101+
[releases]: https://github.com/deislabs/porter/releases

scripts/install/install-linux.sh

+11-10
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,25 @@ set -euo pipefail
33

44
PORTER_HOME=~/.porter
55
PORTER_URL=https://deislabs.blob.core.windows.net/porter
6-
PORTER_VERSION=${PORTER_VERSION:-UNKNOWN}
6+
PORTER_PERMALINK=${PORTER_PERMALINK:-latest}
7+
MIXIN_PERMALINK=${MIXIN_PERMALINK:-latest}
78
echo "Installing porter to $PORTER_HOME"
89

910
mkdir -p $PORTER_HOME
1011

11-
curl -fsSLo $PORTER_HOME/porter $PORTER_URL/$PORTER_VERSION/porter-linux-amd64
12+
curl -fsSLo $PORTER_HOME/porter $PORTER_URL/$PORTER_PERMALINK/porter-linux-amd64
1213
chmod +x $PORTER_HOME/porter
1314
cp $PORTER_HOME/porter $PORTER_HOME/porter-runtime
1415
echo Installed `$PORTER_HOME/porter version`
1516

16-
$PORTER_HOME/porter mixin install exec --version $PORTER_VERSION
17-
$PORTER_HOME/porter mixin install kubernetes --version $PORTER_VERSION
18-
$PORTER_HOME/porter mixin install helm --version $PORTER_VERSION
19-
$PORTER_HOME/porter mixin install azure --version $PORTER_VERSION
20-
$PORTER_HOME/porter mixin install terraform --version $PORTER_VERSION
21-
$PORTER_HOME/porter mixin install az --version $PORTER_VERSION
22-
$PORTER_HOME/porter mixin install aws --version $PORTER_VERSION
23-
$PORTER_HOME/porter mixin install gcloud --version $PORTER_VERSION
17+
$PORTER_HOME/porter mixin install exec --version $MIXIN_PERMALINK
18+
$PORTER_HOME/porter mixin install kubernetes --version $MIXIN_PERMALINK
19+
$PORTER_HOME/porter mixin install helm --version $MIXIN_PERMALINK
20+
$PORTER_HOME/porter mixin install azure --version $MIXIN_PERMALINK
21+
$PORTER_HOME/porter mixin install terraform --version $MIXIN_PERMALINK
22+
$PORTER_HOME/porter mixin install az --version $MIXIN_PERMALINK
23+
$PORTER_HOME/porter mixin install aws --version $MIXIN_PERMALINK
24+
$PORTER_HOME/porter mixin install gcloud --version $MIXIN_PERMALINK
2425

2526
echo "Installation complete."
2627
echo "Add porter to your path by running:"

scripts/install/install-mac.sh

+12-11
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,26 @@ set -euo pipefail
33

44
PORTER_HOME=~/.porter
55
PORTER_URL=https://deislabs.blob.core.windows.net/porter
6-
PORTER_VERSION=${PORTER_VERSION:-UNKNOWN}
6+
PORTER_PERMALINK=${PORTER_PERMALINK:-latest}
7+
MIXIN_PERMALINK=${MIXIN_PERMALINK:-latest}
78
echo "Installing porter to $PORTER_HOME"
89

910
mkdir -p $PORTER_HOME
1011

11-
curl -fsSLo $PORTER_HOME/porter $PORTER_URL/$PORTER_VERSION/porter-darwin-amd64
12-
curl -fsSLo $PORTER_HOME/porter-runtime $PORTER_URL/$PORTER_VERSION/porter-linux-amd64
12+
curl -fsSLo $PORTER_HOME/porter $PORTER_URL/$PORTER_PERMALINK/porter-darwin-amd64
13+
curl -fsSLo $PORTER_HOME/porter-runtime $PORTER_URL/$PORTER_PERMALINK/porter-linux-amd64
1314
chmod +x $PORTER_HOME/porter
1415
chmod +x $PORTER_HOME/porter-runtime
1516
echo Installed `$PORTER_HOME/porter version`
1617

17-
$PORTER_HOME/porter mixin install exec --version $PORTER_VERSION
18-
$PORTER_HOME/porter mixin install kubernetes --version $PORTER_VERSION
19-
$PORTER_HOME/porter mixin install helm --version $PORTER_VERSION
20-
$PORTER_HOME/porter mixin install azure --version $PORTER_VERSION
21-
$PORTER_HOME/porter mixin install terraform --version $PORTER_VERSION
22-
$PORTER_HOME/porter mixin install az --version $PORTER_VERSION
23-
$PORTER_HOME/porter mixin install aws --version $PORTER_VERSION
24-
$PORTER_HOME/porter mixin install gcloud --version $PORTER_VERSION
18+
$PORTER_HOME/porter mixin install exec --version $MIXIN_PERMALINK
19+
$PORTER_HOME/porter mixin install kubernetes --version $MIXIN_PERMALINK
20+
$PORTER_HOME/porter mixin install helm --version $MIXIN_PERMALINK
21+
$PORTER_HOME/porter mixin install azure --version $MIXIN_PERMALINK
22+
$PORTER_HOME/porter mixin install terraform --version $MIXIN_PERMALINK
23+
$PORTER_HOME/porter mixin install az --version $MIXIN_PERMALINK
24+
$PORTER_HOME/porter mixin install aws --version $MIXIN_PERMALINK
25+
$PORTER_HOME/porter mixin install gcloud --version $MIXIN_PERMALINK
2526

2627
echo "Installation complete."
2728
echo "Add porter to your path by running:"

scripts/install/install-windows.ps1

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
param([String]$PORTER_VERSION="UNKNOWN")
1+
param([String]$PORTER_PERMALINK='latest', [String]$MIXIN_PERMALINK='latest')
22

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

88
mkdir -f $PORTER_HOME
99

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

14-
& $PORTER_HOME/porter mixin install exec --version $PORTER_VERSION
15-
& $PORTER_HOME/porter mixin install kubernetes --version $PORTER_VERSION
16-
& $PORTER_HOME/porter mixin install helm --version $PORTER_VERSION
17-
& $PORTER_HOME/porter mixin install azure --version $PORTER_VERSION
18-
& $PORTER_HOME/porter mixin install terraform --version $PORTER_VERSION
19-
& $PORTER_HOME/porter mixin install az --version $PORTER_VERSION
20-
& $PORTER_HOME/porter mixin install aws --version $PORTER_VERSION
21-
& $PORTER_HOME/porter mixin install gcloud --version $PORTER_VERSION
14+
& $PORTER_HOME/porter mixin install exec --version $MIXIN_PERMALINK
15+
& $PORTER_HOME/porter mixin install kubernetes --version $MIXIN_PERMALINK
16+
& $PORTER_HOME/porter mixin install helm --version $MIXIN_PERMALINK
17+
& $PORTER_HOME/porter mixin install azure --version $MIXIN_PERMALINK
18+
& $PORTER_HOME/porter mixin install terraform --version $MIXIN_PERMALINK
19+
& $PORTER_HOME/porter mixin install az --version $MIXIN_PERMALINK
20+
& $PORTER_HOME/porter mixin install aws --version $MIXIN_PERMALINK
21+
& $PORTER_HOME/porter mixin install gcloud --version $MIXIN_PERMALINK
2222

2323
echo "Installation complete."
2424
echo "Add porter to your path by running:"

scripts/prep-install-scripts.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# PERMALINK and VERSION must be set before calling this script
5+
# It is intended to only be executed by make publish
6+
7+
if [[ "$PERMALINK" = "canary" ]]; then
8+
PORTER_PERMALINK=$PERMALINK
9+
else
10+
PORTER_PERMALINK=$VERSION
11+
fi
12+
13+
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
14+
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
15+
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

scripts/test/test-linux-install.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,11 @@
22

33
set -xeuo pipefail
44

5-
PORTER_VERSION=canary ./scripts/install/install-linux.sh
6-
PORTER_VERSION=latest ./scripts/install/install-linux.sh
5+
export PATH=$PATH:~/.porter
6+
7+
PORTER_PERMALINK=canary ./scripts/install/install-linux.sh
8+
9+
PORTER_PERMALINK=v0.16.0-beta.1 ./scripts/install/install-linux.sh
10+
porter version | grep v0.16.0-beta.1
11+
12+
PORTER_PERMALINK=latest ./scripts/install/install-linux.sh

scripts/test/test-mac-install.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,11 @@
22

33
set -xeuo pipefail
44

5-
PORTER_VERSION=canary ./scripts/install/install-mac.sh
6-
PORTER_VERSION=latest ./scripts/install/install-mac.sh
5+
export PATH=$PATH:~/.porter
6+
7+
PORTER_PERMALINK=canary ./scripts/install/install-mac.sh
8+
9+
PORTER_PERMALINK=v0.16.0-beta.1 ./scripts/install/install-mac.sh
10+
porter version | grep v0.16.0-beta.1
11+
12+
PORTER_PERMALINK=latest ./scripts/install/install-mac.sh

scripts/test/test-windows-install.ps1

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
1-
& $PSScriptRoot\..\install\install-windows.ps1 -PORTER_VERSION canary
2-
& $PSScriptRoot\..\install\install-windows.ps1 -PORTER_VERSION latest
1+
$ErrorActionPreference = "Stop"
2+
3+
$env:PATH+=";$env:USERPROFILE\.porter"
4+
5+
& $PSScriptRoot\..\install\install-windows.ps1 -PORTER_PERMALINK canary
6+
7+
& $PSScriptRoot\..\install\install-windows.ps1 -PORTER_PERMALINK v0.16.0-beta.1
8+
if (-Not (porter version | Select-String -Pattern 'v0.16.0-beta.1' -SimpleMatch))
9+
{
10+
echo "Failed to install a specific version of porter"
11+
Exit 1
12+
}
13+
14+
& $PSScriptRoot\..\install\install-windows.ps1 -PORTER_PERMALINK latest

0 commit comments

Comments
 (0)