Skip to content

Commit a02a8ae

Browse files
authored
chore: add reusable integ workflow, add publish variables (#2979)
* chore: ADO -> GHA, add more go caching, add docker buildx to jobs, and added reusable workflow for porter integration so each integ gets their own job (stop out of space errors) Signed-off-by: Sarah Christoff <28318173+schristoff@users.noreply.github.com> --------- Signed-off-by: Sarah Christoff <28318173+schristoff@users.noreply.github.com>
1 parent ce7ade3 commit a02a8ae

15 files changed

+167
-67
lines changed

.github/workflows/build-publish-from-fork.yaml

-36
This file was deleted.

.github/workflows/build_pipelinesrelease_template.yml

+9-10
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
shell: bash
9393
Validate-integration_test:
9494
env:
95-
GHCR_IOGETPORTER_DOCKER_REGISTRY: https://ghcr.io
95+
GHCR_IOGETPORTER_DOCKER_REGISTRY: ${{inputs.registry}}
9696
GHCR_IOGETPORTER_DOCKER_USERNAME: getporterbot
9797
name: Integration Test
9898
needs:
@@ -140,7 +140,7 @@ jobs:
140140
run: go run mage.go ConfigureAgent UseXBuildBinaries
141141
- name: Run Smoke Tests
142142
run: mage -v TestSmoke
143-
Publish-publish_binaries:
143+
publish_binaries:
144144
name: Publish Binaries
145145
needs:
146146
- Validate-build
@@ -168,10 +168,10 @@ jobs:
168168
env:
169169
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
170170
run: mage PublishPorter PublishMixins
171-
Publish-publish_docker:
171+
publish-ghcr:
172172
env:
173-
DOCKER_REGISTRY:
174-
DOCKER_USERNAME:
173+
DOCKER_REGISTRY: ${{inputs.registry}}
174+
DOCKER_USERNAME: getporterbot
175175
name: Publish Docker Images
176176
needs:
177177
- Validate-build
@@ -195,12 +195,11 @@ jobs:
195195
path: bin
196196
- name: Setup Bin
197197
run: go run mage.go ConfigureAgent UseXBuildBinaries
198-
# Unable to determine registry '${{parameters.registry}}' type. The service connection was not found or the authentication type not supported.
199-
- name: Docker Login
198+
- name: Login to Container Registry
200199
uses: docker/login-action@v3.0.0
201200
with:
202-
registry: "${{ env.DOCKER_REGISTRY }}"
203-
username: "${{ env.DOCKER_USERNAME }}"
204-
password: "${{ secrets.DOCKER_PASSWORD }}"
201+
registry: "${{inputs.registry}}"
202+
username: "${{ github.actor }}"
203+
password: "${{ secrets.GITHUB_TOKEN }}"
205204
- name: Publish Docker Images to ${{inputs.registry}}
206205
run: PORTER_REGISTRY=${{inputs.registry}} mage PublishImages

.github/workflows/check-licenses.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
with:
1515
fetch-depth: 0
1616
- name: Set up Go
17-
uses: actions/setup-go@v3
17+
uses: actions/setup-go@v4
1818
with:
1919
go-version-file: go.mod
2020
cache: true

.github/workflows/close-issues.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ on:
1010
- release/*
1111

1212
jobs:
13-
closeIssue:
13+
closeIssueOnPrMergeTrigger:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Closes issues related to a merged pull request.
17-
uses: ldez/gha-mjolnir@v1.1.0
17+
uses: ldez/gha-mjolnir@v1.0.3
1818
env:
19-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/codeql.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
with:
2222
fetch-depth: 0 # Get all git history
2323
- name: Set up Go
24-
uses: actions/setup-go@v3
24+
uses: actions/setup-go@v4
2525
with:
2626
go-version-file: go.mod
2727
cache: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: integ reusable workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
test_name:
7+
type: string
8+
required: false
9+
env:
10+
GOVERSION: 1.20.7
11+
PORTER_INTEG_FILE: ${{inputs.test_name}}.go
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: checkout
18+
uses: actions/checkout@v4.1.0
19+
- uses: actions/setup-go@v4
20+
with:
21+
go-version: "${{ env.GOVERSION }}"
22+
cache: true
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
- name: Cache Docker layers
26+
uses: actions/cache@v3
27+
with:
28+
path: /tmp/.buildx-cache
29+
key: ${{ runner.os }}-buildx-${{ github.sha }}
30+
- name: Docker Login
31+
uses: docker/login-action@v3.0.0
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
- name: Configure Agent
37+
run: go run mage.go build
38+
shell: bash
39+
- name: Integration Test
40+
run: go run mage.go -v TestIntegration
41+
shell: bash
+95-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
name: porter/porter-integration
2-
# this will only run when this is on main branch apparently so use pr for now (temporary)
3-
#on:
4-
# issue_comment:
5-
# types: [created, edited]
62
on:
73
pull_request:
84
branches:
@@ -14,24 +10,114 @@ env:
1410
GOVERSION: 1.20.7
1511

1612
jobs:
17-
Integration_test:
18-
name: Integration Test
13+
archive_integration_test:
14+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
15+
with:
16+
test_name: archive_test
17+
build_integration_test:
18+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
19+
with:
20+
test_name: build_test
21+
cli_integration_test:
22+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
23+
with:
24+
test_name: cli_test
25+
connection_nix_integration_test:
26+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
27+
with:
28+
test_name: connection_nix_test
29+
copy_integration_test:
30+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
31+
with:
32+
test_name: copy_test
33+
dependenciesv1_integration_test:
34+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
35+
with:
36+
test_name: dependenciesv1_test
37+
dependenciesv2_integration_test:
38+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
39+
with:
40+
test_name: dependenciesv2_test
41+
driver_integration_test:
42+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
43+
with:
44+
test_name: driver_test
45+
install_integration_test:
46+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
47+
with:
48+
test_name: install_test
49+
invoke_integration_test:
50+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
51+
with:
52+
test_name: invoke_test
53+
lint_integration_test:
54+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
55+
with:
56+
test_name: lint_test
57+
migration_integration_test:
58+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
59+
with:
60+
test_name: migration_test
61+
outputs_integration_test:
62+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
63+
with:
64+
test_name: outputs_test
65+
publish_integration_test:
66+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
67+
with:
68+
test_name: publish_test
69+
pull_integration_test:
70+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
71+
with:
72+
test_name: pull_test
73+
registry_integration_test:
74+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
75+
with:
76+
test_name: registry_integration_test
77+
schema_integration_test:
78+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
79+
with:
80+
test_name: schema_test
81+
sensitive_data_integration_test:
82+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
83+
with:
84+
test_name: sensitive_data_test
85+
suppress_output_integration_test:
86+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
87+
with:
88+
test_name: suppress_output_test
89+
telemetry_test:
90+
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
91+
with:
92+
test_name: telemetry_test
93+
# Reusable workflows only supports 20 jobs
94+
uninstall_test_integ:
1995
runs-on: ubuntu-latest
2096
steps:
2197
- name: checkout
2298
uses: actions/checkout@v4.1.0
2399
- uses: actions/setup-go@v4
24100
with:
25101
go-version: "${{ env.GOVERSION }}"
102+
cache: true
103+
- name: Set up Docker Buildx
104+
uses: docker/setup-buildx-action@v3
105+
- name: Cache Docker layers
106+
uses: actions/cache@v3
107+
with:
108+
path: /tmp/.buildx-cache
109+
key: ${{ runner.os }}-buildx-${{ github.sha }}
26110
- name: Docker Login
27111
uses: docker/login-action@v3.0.0
28112
with:
29113
registry: ghcr.io
30114
username: ${{ github.actor }}
31115
password: ${{ secrets.GITHUB_TOKEN }}
32-
- name: Native Build
33-
run: go run mage.go Build
116+
- name: Configure Agent
117+
run: go run mage.go build
34118
shell: bash
35119
- name: Integration Test
36-
run: go run mage.go -v TestIntegration
120+
env:
121+
PORTER_INTEG_FILE: uninstall_test.go
122+
run: go run mage.go -v TestIntegration
37123
shell: bash

.github/workflows/porter.yml

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- uses: actions/setup-go@v4
1919
with:
2020
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
21+
cache: true
2122
- run: go version
2223
- name: Native Build
2324
run: go run mage.go build
@@ -37,6 +38,7 @@ jobs:
3738
- uses: actions/setup-go@v4
3839
with:
3940
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
41+
cache: true
4042
- run: go version
4143
- name: Cross Compile
4244
run: go run mage.go -v XBuildAll
@@ -56,6 +58,7 @@ jobs:
5658
- uses: actions/setup-go@v4
5759
with:
5860
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
61+
cache: true
5962
- run: go version
6063
- name: Unit Test
6164
run: go run mage.go -v TestUnit
@@ -70,6 +73,7 @@ jobs:
7073
- uses: actions/setup-go@v4
7174
with:
7275
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
76+
cache: true
7377
- run: go version
7478
- name: Vet
7579
run: go run mage.go Vet
@@ -90,6 +94,7 @@ jobs:
9094
- uses: actions/setup-go@v4
9195
with:
9296
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
97+
cache: true
9398
- run: go version
9499
- name: Download Cross-Compiled Porter Binaries
95100
uses: actions/download-artifact@v3.0.1
@@ -117,6 +122,7 @@ jobs:
117122
- uses: actions/setup-go@v4
118123
with:
119124
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
125+
cache: true
120126
- run: go version
121127
- name: Setup Bin
122128
run: go run mage.go UseXBuildBinaries

.github/workflows/trivy.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
with:
2222
fetch-depth: 0 # Get all git history
2323
- name: Set up Go
24-
uses: actions/setup-go@v3
24+
uses: actions/setup-go@v4
2525
with:
2626
go-version-file: go.mod
2727
cache: true
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
Dockerfile
2-
.cnab

build/testdata/bundles/wordpressv2/.gitignore

Whitespace-only changes.

magefile.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,15 @@ func TestIntegration() {
580580
verbose = "-v"
581581
}
582582

583-
must.Command("go", "test", verbose, "-timeout=30m", run, "-tags=integration", "./...").CollapseArgs().RunV()
583+
var path string
584+
filename := os.Getenv("PORTER_INTEG_FILE")
585+
if filename == "" {
586+
path = "./..."
587+
} else {
588+
path = "./tests/integration/" + filename
589+
}
590+
591+
must.Command("go", "test", verbose, "-timeout=30m", run, "-tags=integration", path).CollapseArgs().RunV()
584592
}
585593

586594
func TestInitWarnings() {

tests/integration/archive_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
// Validate that archiving a bundle twice results in the same digest
2020
func TestArchive_StableDigest(t *testing.T) {
2121
t.Parallel()
22-
2322
p := porter.NewTestPorter(t)
2423
defer p.Close()
2524
ctx := p.SetupIntegrationTest()

tests/integration/dependenciesv1_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919

2020
func TestDependenciesLifecycle(t *testing.T) {
2121
t.Parallel()
22-
2322
p := porter.NewTestPorter(t)
2423
defer p.Close()
2524
ctx := p.SetupIntegrationTest()

tests/integration/dependenciesv2_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import (
1818

1919
func TestSharedDependencies(t *testing.T) {
2020
t.Parallel()
21-
2221
p := porter.NewTestPorter(t)
22+
defer p.Close()
2323
ctx := p.SetupIntegrationTest()
2424

2525
p.Config.SetExperimentalFlags(experimental.FlagDependenciesV2)

0 commit comments

Comments
 (0)