Skip to content

Commit

Permalink
fix: resolve issues with hack/new-version.sh so it works w/ no manual…
Browse files Browse the repository at this point in the history
… changes necessary (#8750)
  • Loading branch information
aaron-prindle authored May 8, 2023
1 parent 9682905 commit 7aed57a
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 24 deletions.
74 changes: 52 additions & 22 deletions hack/versions/cmd/new/templates/upgrade_test.template
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,30 @@ build:
auto: true
- image: ko://github.com/GoogleContainerTools/skaffold/cmd/skaffold
ko: {}
platforms: ['linux/arm64', 'linux/amd64']
- image: gcr.io/k8s-skaffold/leeroy-app
context: leeroy-web
googleCloudBuild:
projectId: test-project
test:
- image: gcr.io/k8s-skaffold/skaffold-example
structureTests:
- ./test/*
deploy:
kubectl:
manifests:
manifests:
rawYaml:
- k8s-*
kustomize:
paths:
- kustomization-main
helm:
releases:
- name: skaffold-helm
chartPath: charts
deploy:
kubectl:
remoteManifests:
- deploy/test
helm: {}
portForward:
- resourceType: deployment
resourceName: leeroy-app
Expand All @@ -85,13 +96,14 @@ profiles:
- image: gcr.io/k8s-skaffold/skaffold-example
structureTests:
- ./test/*
deploy:
kubectl:
manifests:
- k8s-*
manifests:
rawYaml:
- k8s-*
kustomize:
paths:
- kustomization-test
deploy:
kubectl: {}
- name: test local
build:
artifacts:
Expand All @@ -100,11 +112,14 @@ profiles:
dockerfile: path/to/Dockerfile
local:
push: false
manifests:
rawYaml:
- k8s-*
kustomize:
paths:
- "."
deploy:
kubectl:
manifests:
- k8s-*
kustomize: {}
kubectl: {}
`
expected := `apiVersion: skaffold/%NEXT_VERSION%
kind: Config
Expand Down Expand Up @@ -133,19 +148,30 @@ build:
auto: true
- image: ko://github.com/GoogleContainerTools/skaffold/cmd/skaffold
ko: {}
platforms: ['linux/arm64', 'linux/amd64']
- image: gcr.io/k8s-skaffold/leeroy-app
context: leeroy-web
googleCloudBuild:
projectId: test-project
test:
- image: gcr.io/k8s-skaffold/skaffold-example
structureTests:
- ./test/*
deploy:
kubectl:
manifests:
manifests:
rawYaml:
- k8s-*
kustomize:
paths:
- kustomization-main
helm:
releases:
- name: skaffold-helm
chartPath: charts
deploy:
kubectl:
remoteManifests:
- deploy/test
helm: {}
portForward:
- resourceType: deployment
resourceName: leeroy-app
Expand All @@ -166,13 +192,14 @@ profiles:
- image: gcr.io/k8s-skaffold/skaffold-example
structureTests:
- ./test/*
deploy:
kubectl:
manifests:
- k8s-*
manifests:
rawYaml:
- k8s-*
kustomize:
paths:
- kustomization-test
deploy:
kubectl: {}
- name: test local
build:
artifacts:
Expand All @@ -181,11 +208,14 @@ profiles:
dockerfile: path/to/Dockerfile
local:
push: false
manifests:
rawYaml:
- k8s-*
kustomize:
paths:
- "."
deploy:
kubectl:
manifests:
- k8s-*
kustomize: {}
kubectl: {}
`
verifyUpgrade(t, yaml, expected)
}
Expand Down
3 changes: 2 additions & 1 deletion hack/versions/cmd/new/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
// After: prev -> current -> new (latest)
func main() {
logrus.SetLevel(logrus.DebugLevel)
prev := strings.TrimPrefix(schema.SchemaVersionsV1[len(schema.SchemaVersionsV1)-2].APIVersion, "skaffold/")
prev := strings.TrimPrefix(schema.SchemaVersionsV1[len(schema.SchemaVersionsV1)-1].APIVersion, "skaffold/")
logrus.Infof("Previous Skaffold version: %s", prev)

current, latestIsReleased := hackschema.GetLatestVersion()
Expand All @@ -56,6 +56,7 @@ func main() {
walk.From(path("latest")).WhenIsFile().MustDo(func(file string, info walk.Dirent) error {
cp(file, path(current, info.Name()))
sed(path(current, info.Name()), "package v1", "package "+current)
sed(path(current, info.Name()), "package latest", "package "+current)
return nil
})

Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/latest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)

// This config version is not yet released, it is SAFE TO MODIFY the structs in this file.
// !!! WARNING !!! This config version is already released, please DO NOT MODIFY the structs in this file.
const Version string = "skaffold/v4beta5"

// NewSkaffoldConfig creates a SkaffoldConfig
Expand Down

0 comments on commit 7aed57a

Please sign in to comment.