Skip to content

Commit

Permalink
Merge branch 'main' into schristoff-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
schristoff authored Mar 28, 2024
2 parents 85dc8c5 + c6659f2 commit 3989d17
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_pipelinesrelease_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
inputs:
goVersion:
required: false
default: 1.20.7
default: 1.21.3
type: string
registry:
required: false
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
- Validate-smoke_test
runs-on: ubuntu-latest
permissions: write-all
if: success() && inputs.shouldPublish
if: success() && ${{ inputs.shouldPublish == true }}
steps:
- name: checkout
uses: actions/checkout@v4.1.0
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
- Validate-smoke_test
runs-on: ubuntu-latest
permissions: write-all
if: success() && inputs.shouldPublish
if: success() && ${{inputs.shouldPublish == true}}
steps:
- name: checkout
uses: actions/checkout@v4.1.0
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/porter-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ on:
- v*
- "!latest*"
- "!canary*"

jobs:
build_pipelinesrelease_template:
name: build_pipelinesrelease_template
uses: "./.github/workflows/build_pipelinesrelease_template.yml"
with:
registry: ghcr.io/getporter
shouldPublish: true
skipTests: true
skipTests: false
2 changes: 1 addition & 1 deletion .github/workflows/protoc.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20
FROM golang:1.21
RUN apt-get update && apt-get -y install protobuf-compiler
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ grpc-porter-tls.key
grpc-porter.csr
.grpcurl/
config.yaml

# Output of the go coverage tool
coverage-unit.out
coverage-integration.out
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,4 @@ and we will add you. **All** contributors belong here. 💯
- [Ray Terrill](https://github.com/rayterrill)
- [Kim Christensen](https://github.com/kichristensen)
- [Shivam](https://github.com/Bharadwajshivam28)
- [David Gannon](https://github.com/dgannon991)
13 changes: 11 additions & 2 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@ The [OWNERS.md] file defines the maintainers of the project.
## Release Process

Maintainers create the next release when the main branch is stable and related
groupings of work is complete. We do not have a fixed cadence and prefer to release
smaller batches of work more often.
groupings of work is complete. We have a loose cadence, and strive to hit a release
every three (3) months.

Releases are done by creating a [new release](https://github.com/getporter/porter/releases/new)
This will trigger the Github Action Pipelines to build and publish the new release to Github and
the Website. After this is done, we update the [CNCF Slack Channel](https://cloud-native.slack.com/) (#porter) & [Mailing List](https://groups.io/g/porter).

## Issue Response Timeline

Porter is taken care of by maintainers and contributors who volunteer their time.
We aim to **respond** to issues within five (5) business days.

## Roadmap

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ replace (
)

require (
get.porter.sh/magefiles v0.6.2
get.porter.sh/magefiles v0.6.3
github.com/Masterminds/semver/v3 v3.2.1
github.com/PaesslerAG/jsonpath v0.1.1
github.com/carolynvs/aferox v0.3.0
Expand Down Expand Up @@ -155,7 +155,7 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/klauspost/compress v1.17.6 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/klauspost/pgzip v1.2.6 // indirect
github.com/kr/pty v1.1.5 // indirect
github.com/magiconair/properties v1.8.7 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
get.porter.sh/magefiles v0.6.2 h1:kHuurvykssL6iZsE5S2XLtTsps79h9D4rrxDSCiHOU8=
get.porter.sh/magefiles v0.6.2/go.mod h1:YsSlQWtGoXCGC4pdD7NxPpvh/FryM1bM0wzMWlJC+Bg=
get.porter.sh/magefiles v0.6.3 h1:OE9YqCArn9fvM+VdanGlXNyIjy2F8W4yJGy5kcC/xD0=
get.porter.sh/magefiles v0.6.3/go.mod h1:w37oTKICvvaEKR5KVB9UfN2EX30uYO9Qk0oRoz80DOU=
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU=
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8=
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 h1:59MxjQVfjXsBpLy+dbd2/ELV5ofnUkUZBvWSC85sheA=
Expand Down Expand Up @@ -565,6 +567,8 @@ github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.17.6 h1:60eq2E/jlfwQXtvZEeBUYADs+BwKBWURIY+Gj2eRGjI=
github.com/klauspost/compress v1.17.6/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg=
github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU=
Expand Down
15 changes: 10 additions & 5 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func TestUnit() {
v = "-v"
}

must.Command("go", "test", v, "./...").CollapseArgs().RunV()
must.Command("go", "test", v, "./...", "-coverprofile", "coverage-unit.out").CollapseArgs().RunV()

// Verify integration tests compile since we don't run them automatically on pull requests
must.Run("go", "test", "-run=non", "-tags=integration", "./...")
Expand Down Expand Up @@ -588,7 +588,7 @@ func TestIntegration() {
path = "./tests/integration/" + filename
}

must.Command("go", "test", verbose, "-timeout=30m", run, "-tags=integration", path).CollapseArgs().RunV()
must.Command("go", "test", verbose, "-timeout=30m", run, "-tags=integration", path, "-coverprofile", "coverage-integration.out").CollapseArgs().RunV()
}

func TestInitWarnings() {
Expand Down Expand Up @@ -645,8 +645,14 @@ func Install() {
// Removing the file first clears the cache so that we don't run into "zsh: killed porter..."
// See https://stackoverflow.com/questions/67378106/mac-m1-cping-binary-over-another-results-in-crash
// See https://openradar.appspot.com/FB8914231
mgx.Must(os.Remove(filepath.Join(porterHome, "porter"+xplat.FileExt())))
mgx.Must(os.RemoveAll(filepath.Join(porterHome, "runtimes")))
removeError := os.Remove(filepath.Join(porterHome, "porter"+xplat.FileExt()))
if !os.IsNotExist(removeError) {
mgx.Must(removeError)
}
removeError = os.RemoveAll(filepath.Join(porterHome, "runtimes"))
if !os.IsNotExist(removeError) {
mgx.Must(removeError)
}

// Okay now it's safe to copy these files over
mgx.Must(shx.Copy(filepath.Join("bin", "porter"+xplat.FileExt()), porterHome))
Expand Down Expand Up @@ -679,7 +685,6 @@ func Install() {
// Removing the file first clears the cache so that we don't run into "zsh: killed MIXIN..."
// See https://stackoverflow.com/questions/67378106/mac-m1-cping-binary-over-another-results-in-crash
// See https://openradar.appspot.com/FB8914231


// Copy the mixin client binary
mgx.Must(shx.Copy(filepath.Join(srcDir, mixin+xplat.FileExt()), destDir))
Expand Down
7 changes: 7 additions & 0 deletions pkg/manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ func (m *Manifest) Validate(ctx context.Context, cfg *config.Config) error {
result = multierror.Append(result, fmt.Errorf(invalidStepErrorFormat, "uninstall", err))
}

if m.Upgrade != nil {
err = m.Upgrade.Validate(m)
if err != nil {
result = multierror.Append(result, fmt.Errorf(invalidStepErrorFormat, "upgrade", err))
}
}

for actionName, steps := range m.CustomActions {
err := steps.Validate(m)
if err != nil {
Expand Down
39 changes: 39 additions & 0 deletions pkg/manifest/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,45 @@ func TestAction_Validate_RequireSingleMixinData(t *testing.T) {
assert.EqualError(t, err, "more than one mixin specified")
}

func TestAction_Validate_RequireSingleMixinData_Actions(t *testing.T) {
testcases := []struct {
name string
getStep func(*Manifest) *Steps
}{
{"install", func(m *Manifest) *Steps { return &m.Install }},
{"uninstall", func(m *Manifest) *Steps { return &m.Uninstall }},
{"upgrade", func(m *Manifest) *Steps { return &m.Upgrade }},
{"custom", func(m *Manifest) *Steps { status := m.CustomActions["status"]; return &status }},
}

for _, tc := range testcases {
t.Run(tc.name, func(t *testing.T) {
ctx := context.Background()
c := config.NewTestConfig(t)

c.TestContext.AddTestFile("testdata/simple.porter.yaml", config.Name)

m, err := LoadManifestFrom(ctx, c.Config, config.Name)
require.NoError(t, err, "could not load manifest")
step := tc.getStep(m)

if len(*step) == 0 {
*step = make(Steps, 1)
(*step)[0] = &Step{
Data: make(map[string]interface{}),
}
(*step)[0].Data["exec"] = ""
}

// Sabotage!
(*step)[0].Data["rando-mixin"] = ""

err = m.Validate(ctx, c.Config)
assert.ErrorContains(t, err, "more than one mixin specified")
})
}
}

func TestManifest_Empty_Steps(t *testing.T) {
c := config.NewTestConfig(t)

Expand Down

0 comments on commit 3989d17

Please sign in to comment.