Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve issues with hack/new-version.sh so it works w/ no manual changes necessary #8750

Merged
merged 1 commit into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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