forked from getporter/porter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into signBundlesPublishedFromArchives
- Loading branch information
Showing
8 changed files
with
125 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ jobs: | |
run: mage build | ||
shell: bash | ||
- name: Publish Native Binaries | ||
uses: actions/upload-artifact@v4.0.0 | ||
uses: actions/upload-artifact@v4.4.0 | ||
with: | ||
name: build-bin | ||
path: "${{ github.workspace }}/bin" | ||
|
@@ -56,7 +56,7 @@ jobs: | |
run: mage XBuildAll | ||
shell: bash | ||
- name: Publish Release Binaries | ||
uses: actions/upload-artifact@v4.0.0 | ||
uses: actions/upload-artifact@v4.4.0 | ||
with: | ||
name: xbuild-bin | ||
path: "${{ github.workspace }}/bin" | ||
|
@@ -112,7 +112,7 @@ jobs: | |
with: | ||
go-version: ${{ inputs.goVersion }} | ||
- name: Download Cross-Compiled Porter Binaries | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].8 | ||
with: | ||
name: xbuild-bin | ||
path: bin | ||
|
@@ -141,7 +141,7 @@ jobs: | |
with: | ||
go-version: ${{ inputs.goVersion }} | ||
- name: Download Cross-Compiled Porter Binaries | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].8 | ||
with: | ||
name: xbuild-bin | ||
path: bin | ||
|
@@ -182,7 +182,7 @@ jobs: | |
with: | ||
go-version: ${{ inputs.goVersion }} | ||
- name: Download Cross-Compiled Porter Binaries | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].8 | ||
with: | ||
name: xbuild-bin | ||
path: bin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,3 +154,33 @@ jobs: | |
PORTER_INTEG_FILE: signing_test.go | ||
run: go run mage.go -v TestIntegration | ||
shell: bash | ||
upgrade_test_integ: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/[email protected] | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: "${{ env.GOVERSION }}" | ||
cache: true | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
- name: Docker Login | ||
uses: docker/[email protected] | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Configure Agent | ||
run: go run mage.go build | ||
shell: bash | ||
- name: Integration Test | ||
env: | ||
PORTER_INTEG_FILE: upgrade_test.go | ||
run: go run mage.go -v TestIntegration | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ jobs: | |
fi | ||
shell: bash | ||
- name: Publish Native Binaries | ||
uses: actions/upload-artifact@v3.1.1 | ||
uses: actions/upload-artifact@v4.4.0 | ||
with: | ||
name: build-bin | ||
path: "${{ github.workspace }}/bin" | ||
|
@@ -58,7 +58,7 @@ jobs: | |
run: go run mage.go -v XBuildAll | ||
shell: bash | ||
- name: Publish Release Binaries | ||
uses: actions/upload-artifact@v3.1.1 | ||
uses: actions/upload-artifact@v4.4.0 | ||
with: | ||
name: xbuild-bin | ||
path: "${{ github.workspace }}/bin" | ||
|
@@ -111,7 +111,7 @@ jobs: | |
cache: true | ||
- run: go version | ||
- name: Download Cross-Compiled Porter Binaries | ||
uses: actions/download-artifact@v3.0.1 | ||
uses: actions/download-artifact@v4.1.8 | ||
with: | ||
name: xbuild-bin | ||
path: bin | ||
|
@@ -129,7 +129,7 @@ jobs: | |
- name: checkout | ||
uses: actions/[email protected] | ||
- name: Download Cross-Compiled Porter Binaries | ||
uses: actions/download-artifact@v3.0.1 | ||
uses: actions/download-artifact@v4.1.8 | ||
with: | ||
name: xbuild-bin | ||
path: bin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tests/integration/testdata/bundles/bundle-with-failing-install/helpers.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
install() { | ||
echo Hello World | ||
exit 1 | ||
} | ||
|
||
upgrade() { | ||
echo World 2.0 | ||
} | ||
|
||
uninstall() { | ||
echo Goodbye World | ||
} | ||
|
||
# Call the requested function and pass the arguments as-is | ||
"$@" |
29 changes: 29 additions & 0 deletions
29
tests/integration/testdata/bundles/bundle-with-failing-install/porter.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
schemaVersion: 1.0.1 | ||
name: porter-failing-install | ||
version: 0.1.0 | ||
description: "A bundle that always fails installation" | ||
registry: "localhost:5000" | ||
|
||
mixins: | ||
- exec | ||
|
||
install: | ||
- exec: | ||
description: "Install Hello World" | ||
command: ./helpers.sh | ||
arguments: | ||
- install | ||
|
||
upgrade: | ||
- exec: | ||
description: "Upgrade Hello World" | ||
command: ./helpers.sh | ||
arguments: | ||
- upgrade | ||
|
||
uninstall: | ||
- exec: | ||
description: "Uninstall Hello World" | ||
command: ./helpers.sh | ||
arguments: | ||
- uninstall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//go:build integration | ||
|
||
package integration | ||
|
||
import ( | ||
"testing" | ||
|
||
"get.porter.sh/porter/pkg/porter" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestUpgrade_failedInstallation(t *testing.T) { | ||
p := porter.NewTestPorter(t) | ||
defer p.Close() | ||
ctx := p.SetupIntegrationTest() | ||
|
||
p.AddTestBundleDir("testdata/bundles/bundle-with-failing-install", false) | ||
|
||
installOpts := porter.NewInstallOptions() | ||
err := installOpts.Validate(ctx, []string{}, p.Porter) | ||
require.NoError(t, err) | ||
|
||
err = p.InstallBundle(ctx, installOpts) | ||
require.Error(t, err, "Installation should fail") | ||
|
||
upgradeOpts := porter.NewUpgradeOptions() | ||
err = upgradeOpts.Validate(ctx, []string{}, p.Porter) | ||
require.NoError(t, err) | ||
|
||
err = p.UpgradeBundle(ctx, upgradeOpts) | ||
require.Error(t, err, "Upgrade should fail, because the installation failed") | ||
} |