Skip to content

Commit 229a4d3

Browse files
committed
refactor: add functions, refactor stderr logging
1 parent d4ab49b commit 229a4d3

File tree

58 files changed

+639
-1154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+639
-1154
lines changed

cmd/deploy.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,16 @@ func runPipeline(ctx *devspacecontext.Context, f factory.Factory, forceLeader bo
309309
}
310310
ctx.Log.Debugf("Marked project excluded: %v", ctx.Config.Config().Name)
311311

312-
// get a writer
313-
writer := ctx.Log.Writer(ctx.Log.GetLevel())
314-
defer writer.Close()
312+
// get a stdout writer
313+
stdoutWriter := ctx.Log.Writer(ctx.Log.GetLevel(), true)
314+
defer stdoutWriter.Close()
315+
316+
// get a stderr writer
317+
stderrWriter := ctx.Log.Writer(logrus.WarnLevel, true)
318+
defer stderrWriter.Close()
315319

316320
// start pipeline
317-
err = pipe.Run(ctx.WithLogger(logpkg.NewStreamLoggerWithFormat(writer, ctx.Log.GetLevel(), logpkg.TimeFormat)))
321+
err = pipe.Run(ctx.WithLogger(logpkg.NewStreamLoggerWithFormat(stdoutWriter, stderrWriter, ctx.Log.GetLevel(), logpkg.TimeFormat)))
318322
if err != nil {
319323
return err
320324
}

cmd/use/namespace.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@ func (cmd *namespaceCmd) RunUseNamespace(f factory.Factory, cobraCmd *cobra.Comm
5757

5858
// Check if current kube context belongs to a space
5959
kubeLoader := client.KubeConfigLoader()
60-
isSpace, err := kubeLoader.IsCloudSpace(client.CurrentContext())
61-
if err != nil {
62-
return errors.Errorf("Unable to check if context belongs to Space: %v", err)
63-
}
64-
if isSpace {
65-
return errors.Errorf("Current kube-context belongs to a Space created by DevSpace Cloud. Changing the default namespace for a Space context is not possible.")
66-
}
6760

6861
// Load kube-config
6962
kubeConfig, err := kubeLoader.LoadRawConfig()

e2e/tests/dependencies/testdata/git/devspace.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ dependencies:
1414

1515
pipelines:
1616
dev:
17-
steps:
18-
- run: |-
19-
run_dependency_pipelines dependency
20-
run_dependency_pipelines dependency-deploy > dependency.txt
21-
run_command dep-test > imports.txt
17+
run: |-
18+
run_dependency_pipelines dependency
19+
run_dependency_pipelines dependency-deploy > dependency.txt
20+
dep-test > imports.txt

e2e/tests/deploy/testdata/helm_concurrent_new/devspace.yaml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ deployments:
99

1010
pipelines:
1111
deploy:
12-
steps:
13-
- run: |-
14-
echo '{"helm": {"values": {"containers": [{"image":"alpine"}]}}}' > ${devspace.tempFolder}/deployment.yaml
15-
16-
create_deployments test1 test2 test3 test4 --from-file test1:${devspace.tempFolder}/deployment.yaml \
17-
--from test2:base \
18-
--set test3:helm.values.containers[0].image=alpine \
19-
--set-string test4:helm.values.containers[0].image=alpine \
20-
--set helm.values.containers[0].name=test
12+
run: |-
13+
echo '{"helm": {"values": {"containers": [{"image":"alpine"}]}}}' > ${devspace.tempFolder}/deployment.yaml
14+
15+
create_deployments test1 test2 test3 test4 --from-file test1:${devspace.tempFolder}/deployment.yaml \
16+
--from test2:base \
17+
--set test3:helm.values.containers[0].image=alpine \
18+
--set-string test4:helm.values.containers[0].image=alpine \
19+
--set helm.values.containers[0].name=test

e2e/tests/imports/testdata/local/devspace.yaml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ dependencies:
1515

1616
pipelines:
1717
deploy:
18-
steps:
19-
- run: |-
20-
echo ${devspace.name} > name.txt
21-
echo ${devspace.tempFolder} > temp.txt
22-
23-
run_dependency_pipelines --all > dependency.txt
24-
25-
run_pipelines import1 > import1.txt
26-
run_pipelines import2 > import2.txt
27-
run_pipelines import2-name > import2-name.txt
28-
run_pipelines import3 > import3.txt
18+
run: |-
19+
echo ${devspace.name} > name.txt
20+
echo ${devspace.tempFolder} > temp.txt
21+
22+
run_dependency_pipelines --all > dependency.txt
23+
24+
run_pipelines import1 > import1.txt
25+
run_pipelines import2 > import2.txt
26+
run_pipelines import2-name > import2-name.txt
27+
run_pipelines import3 > import3.txt
2928
30-
echo ${DEVSPACE_NAMESPACE}-${devspace.namespace}-${BASE}-${IMPORT1}-${IMPORT2}-${IMPORT3} > vars.txt
29+
echo ${DEVSPACE_NAMESPACE}-${devspace.namespace}-${BASE}-${IMPORT1}-${IMPORT2}-${IMPORT3} > vars.txt

e2e/tests/imports/testdata/local/import1.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ vars:
99

1010
pipelines:
1111
import1:
12-
steps:
13-
- run: |-
14-
echo ${IMPORT1}
12+
run: |-
13+
echo ${IMPORT1}

e2e/tests/imports/testdata/local/import2.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ vars:
66

77
pipelines:
88
import2-name:
9-
steps:
10-
- run: |-
11-
echo ${devspace.name}
9+
run: |-
10+
echo ${devspace.name}
1211
import2:
13-
steps:
14-
- run: |-
15-
echo ${IMPORT2}
12+
run: |-
13+
echo ${IMPORT2}

e2e/tests/imports/testdata/local/import3.yaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ vars:
66

77
pipelines:
88
import3:
9-
steps:
10-
- run: |-
11-
echo ${IMPORT3}
9+
run: |-
10+
echo ${IMPORT3}
1211
import3-dep:
13-
steps:
14-
- run: |-
15-
echo ${IMPORT3}
16-
echo ${devspace.name} > dependency-name.txt
17-
echo ${devspace.tempFolder} > dependency-temp.txt
12+
run: |-
13+
echo ${IMPORT3}
14+
echo ${devspace.name} > dependency-name.txt
15+
echo ${devspace.tempFolder} > dependency-temp.txt

e2e/tests/pipelines/pipelines.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var _ = DevSpaceDescribe("portforward", func() {
5353
})
5454

5555
ginkgo.It("should watch files", func() {
56-
tempDir, err := framework.CopyToTempDir("tests/pipelines/testdata/watch")
56+
tempDir, err := framework.CopyToTempDir("tests/pipelines/testdata/run_watch")
5757
framework.ExpectNoError(err)
5858
defer framework.CleanupTempDir(initialDir, tempDir)
5959

e2e/tests/pipelines/testdata/exec_container/devspace.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ deployments:
1111

1212
pipelines:
1313
dev:
14-
steps:
15-
- run: |-
16-
run_default_pipeline deploy
17-
18-
echo "Hello World!" | exec_container --image-selector alpine --silent -- cat - > test.txt
14+
run: |-
15+
run_default_pipeline deploy
16+
17+
echo "Hello World!" | exec_container --image-selector alpine -- cat - > test.txt

0 commit comments

Comments
 (0)