Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Ijaz Ahmad
ksonnet
Commits
2d58dd5a
Commit
2d58dd5a
authored
Sep 10, 2018
by
Oren Shomron
Browse files
Add target separator migration
Signed-off-by:
Oren Shomron
<
shomron@gmail.com
>
parent
98b36185
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
13 deletions
+25
-13
pkg/app/migrations.go
pkg/app/migrations.go
+10
-1
pkg/app/migrations_test.go
pkg/app/migrations_test.go
+6
-6
pkg/app/testdata/migrations-app010.yaml
pkg/app/testdata/migrations-app010.yaml
+3
-2
pkg/app/testdata/migrations-app020.yaml
pkg/app/testdata/migrations-app020.yaml
+3
-2
pkg/app/testdata/migrations-app030.yaml
pkg/app/testdata/migrations-app030.yaml
+3
-2
No files found.
pkg/app/migrations.go
View file @
2d58dd5a
...
...
@@ -16,6 +16,8 @@
package
app
import
(
"strings"
"github.com/blang/semver"
"github.com/ghodss/yaml"
"github.com/pkg/errors"
...
...
@@ -220,7 +222,14 @@ func migrateSchema010To020(src *Spec010) (*Spec020, error) {
dst
.
Environments
=
EnvironmentConfigs020
{}
for
k
,
v
:=
range
src
.
Environments
{
targets
:=
make
([]
string
,
len
(
v
.
Targets
))
copy
(
targets
,
v
.
Targets
)
for
i
,
t
:=
range
v
.
Targets
{
// Target separators changed from "/" to "." in 0.2.0
if
t
==
"/"
{
targets
[
i
]
=
t
}
else
{
targets
[
i
]
=
strings
.
Replace
(
t
,
"/"
,
"."
,
-
1
)
}
}
dst
.
Environments
[
k
]
=
&
EnvironmentConfig020
{
Name
:
v
.
Name
,
...
...
pkg/app/migrations_test.go
View file @
2d58dd5a
...
...
@@ -73,7 +73,7 @@ func Test_migrateSchema010To020(t *testing.T) {
Server
:
"https://localhost:6443"
,
Namespace
:
"default-namespace"
,
},
Targets
:
[]
string
{
"
target1"
,
"target2
"
},
Targets
:
[]
string
{
"
/"
,
"foo/bar/baz"
,
"simple
"
},
},
},
Libraries
:
LibraryConfigs010
{
...
...
@@ -145,7 +145,7 @@ func Test_migrateSchema010To020(t *testing.T) {
Server
:
"https://localhost:6443"
,
Namespace
:
"default-namespace"
,
},
Targets
:
[]
string
{
"
target1"
,
"target2
"
},
Targets
:
[]
string
{
"
/"
,
"foo.bar.baz"
,
"simple
"
},
Libraries
:
LibraryConfigs020
{},
},
},
...
...
@@ -217,7 +217,7 @@ func Test_migrateSchema020To030(t *testing.T) {
Server
:
"https://localhost:6443"
,
Namespace
:
"default-namespace"
,
},
Targets
:
[]
string
{
"
target1"
,
"target2
"
},
Targets
:
[]
string
{
"
/"
,
"foo.bar.baz"
,
"simple
"
},
Libraries
:
LibraryConfigs020
{
"nginx"
:
&
LibraryConfig020
{
Name
:
"nginx"
,
...
...
@@ -295,7 +295,7 @@ func Test_migrateSchema020To030(t *testing.T) {
Server
:
"https://localhost:6443"
,
Namespace
:
"default-namespace"
,
},
Targets
:
[]
string
{
"
target1"
,
"target2
"
},
Targets
:
[]
string
{
"
/"
,
"foo.bar.baz"
,
"simple
"
},
Libraries
:
LibraryConfigs030
{
"incubator/nginx"
:
&
LibraryConfig030
{
Name
:
"nginx"
,
...
...
@@ -379,7 +379,7 @@ func Test_Migrator_Load(t *testing.T) {
Server
:
"https://localhost:6443"
,
Namespace
:
"default-namespace"
,
},
Targets
:
[]
string
{
"
target1"
,
"target2
"
},
Targets
:
[]
string
{
"
/"
,
"foo.bar.baz"
,
"simple
"
},
Libraries
:
LibraryConfigs030
{
"incubator/nginx"
:
&
LibraryConfig030
{
Name
:
"nginx"
,
...
...
@@ -457,7 +457,7 @@ func Test_Migrator_Load(t *testing.T) {
Server
:
"https://localhost:6443"
,
Namespace
:
"default-namespace"
,
},
Targets
:
[]
string
{
"
target1"
,
"target2
"
},
Targets
:
[]
string
{
"
/"
,
"foo.bar.baz"
,
"simple
"
},
Libraries
:
LibraryConfigs030
{},
},
},
...
...
pkg/app/testdata/migrations-app010.yaml
View file @
2d58dd5a
...
...
@@ -18,8 +18,9 @@ environments:
k8sVersion
:
v1.10.3
path
:
default-path
targets
:
-
target1
-
target2
-
/
-
foo/bar/baz
-
simple
keywords
:
-
ksonnet
-
kubernetes
...
...
pkg/app/testdata/migrations-app020.yaml
View file @
2d58dd5a
...
...
@@ -27,8 +27,9 @@ environments:
version
:
1.2.3
path
:
default-path
targets
:
-
target1
-
target2
-
/
-
foo.bar.baz
-
simple
keywords
:
-
ksonnet
-
kubernetes
...
...
pkg/app/testdata/migrations-app030.yaml
View file @
2d58dd5a
...
...
@@ -27,8 +27,9 @@ environments:
version
:
1.2.3
path
:
default-path
targets
:
-
target1
-
target2
-
/
-
foo.bar.baz
-
simple
keywords
:
-
ksonnet
-
kubernetes
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment