From 4ad8f0bb7c3645cf2c540f41f0204be8dbb03d45 Mon Sep 17 00:00:00 2001 From: Viktor Farcic Date: Sun, 26 Jan 2020 17:10:19 +0100 Subject: [PATCH 1/5] Trying to extend the pipeline --- charts/go-demo-6/values.yaml | 2 +- functional_test.go | 4 ++-- jenkins-x.yml | 6 ++++++ production_test.go | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/charts/go-demo-6/values.yaml b/charts/go-demo-6/values.yaml index eb3ae73de..f57374064 100755 --- a/charts/go-demo-6/values.yaml +++ b/charts/go-demo-6/values.yaml @@ -1,7 +1,7 @@ # Default values for Go projects. # This is a YAML-formatted file. # Declare variables to be passed into your templates. -replicaCount: 1 +replicaCount: 3 image: repository: draft tag: dev diff --git a/functional_test.go b/functional_test.go index 2db2a18da..9b55736a0 100644 --- a/functional_test.go +++ b/functional_test.go @@ -31,7 +31,7 @@ func (s *FunctionalTestSuite) SetupTest() { // Functional func (s FunctionalTestSuite) Test_Hello_ReturnsStatus200() { - address := fmt.Sprintf("http://%s%s/hello", s.hostIp, s.servicePath) + address := fmt.Sprintf("%s%s/hello", s.hostIp, s.servicePath) logPrintf("Sending a request to %s\n", address) resp, err := http.Get(address) @@ -40,7 +40,7 @@ func (s FunctionalTestSuite) Test_Hello_ReturnsStatus200() { } func (s FunctionalTestSuite) Test_Person_ReturnsStatus200() { - address := fmt.Sprintf("http://%s%s/person", s.hostIp, s.servicePath) + address := fmt.Sprintf("%s%s/person", s.hostIp, s.servicePath) logPrintf("Sending a request to %s\n", address) resp, err := http.Get(address) diff --git a/jenkins-x.yml b/jenkins-x.yml index a121a198e..8826062b7 100755 --- a/jenkins-x.yml +++ b/jenkins-x.yml @@ -1 +1,7 @@ buildPack: go +pipelineConfig: + pipelines: + pullRequest: + build: + preSteps: + - command: make unittest diff --git a/production_test.go b/production_test.go index e0624ce8d..c655e84a5 100644 --- a/production_test.go +++ b/production_test.go @@ -34,7 +34,7 @@ func (s ProductionTestSuite) Test_Hello_ReturnsStatus200() { minutes := float64(0) counter := 0 for time.Since(start).Minutes() < max { - address := fmt.Sprintf("http://%s/demo/hello", s.hostIp) + address := fmt.Sprintf("%s/demo/hello", s.hostIp) resp, err := http.Get(address) counter++ if err != nil { @@ -57,7 +57,7 @@ func (s ProductionTestSuite) Test_Hello_ReturnsStatus200() { time.Sleep(1 * time.Second) } } else { - address := fmt.Sprintf("http://%s/demo/hello", s.hostIp) + address := fmt.Sprintf("%s/demo/hello", s.hostIp) resp, err := http.Get(address) if err != nil { From 1b67c63181579db4c4c1e0c53688f073f3298492 Mon Sep 17 00:00:00 2001 From: Viktor Farcic Date: Sun, 26 Jan 2020 17:20:37 +0100 Subject: [PATCH 2/5] Trying to extend the pipeline --- Makefile | 3 +++ jenkins-x.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 7867c9cc7..49c4e80dd 100644 --- a/Makefile +++ b/Makefile @@ -65,3 +65,6 @@ unittest: CGO_ENABLED=$(CGO_ENABLED) $(GO) \ test --run UnitTest -v +functest: + CGO_ENABLED=$(CGO_ENABLED) $(GO) test -test.v --run FunctionalTest --cover + diff --git a/jenkins-x.yml b/jenkins-x.yml index 8826062b7..880cd6f8a 100755 --- a/jenkins-x.yml +++ b/jenkins-x.yml @@ -5,3 +5,6 @@ pipelineConfig: build: preSteps: - command: make unittest + promote: + steps: + - command: ADDRESS=`jx get preview --current 2>&1` make functest From 2c4acdb75b45d9aa48c0a66ba329fc2b76e8bfc6 Mon Sep 17 00:00:00 2001 From: Viktor Farcic Date: Sun, 26 Jan 2020 17:30:03 +0100 Subject: [PATCH 3/5] Trying to extend the pipeline --- charts/go-demo-6/Makefile | 2 +- charts/preview/Makefile | 2 +- skaffold.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/go-demo-6/Makefile b/charts/go-demo-6/Makefile index 065274768..77af017d8 100755 --- a/charts/go-demo-6/Makefile +++ b/charts/go-demo-6/Makefile @@ -36,7 +36,7 @@ ifeq ($(OS),Darwin) sed -i "" -e "s/tag:.*/tag: $(VERSION)/" values.yaml else ifeq ($(OS),Linux) sed -i -e "s/version:.*/version: $(VERSION)/" Chart.yaml - sed -i -e "s|repository:.*|repository: $(DOCKER_REGISTRY)\/devops-26\/$(NAME)|" values.yaml + sed -i -e "s|repository:.*|repository: $(DOCKER_REGISTRY)\/vfarcic\/$(NAME)|" values.yaml sed -i -e "s/tag:.*/tag: $(VERSION)/" values.yaml else echo "platfrom $(OS) not supported to tag with" diff --git a/charts/preview/Makefile b/charts/preview/Makefile index 7663503a3..c8d4e60cd 100755 --- a/charts/preview/Makefile +++ b/charts/preview/Makefile @@ -8,7 +8,7 @@ ifeq ($(OS),Darwin) else ifeq ($(OS),Linux) sed -i -e "s/version:.*/version: $(PREVIEW_VERSION)/" Chart.yaml sed -i -e "s/version:.*/version: $(PREVIEW_VERSION)/" ../*/Chart.yaml - sed -i -e "s|repository:.*|repository: $(DOCKER_REGISTRY)\/devops-26\/go-demo-6|" values.yaml + sed -i -e "s|repository:.*|repository: $(DOCKER_REGISTRY)\/vfarcic\/go-demo-6|" values.yaml sed -i -e "s/tag:.*/tag: $(PREVIEW_VERSION)/" values.yaml else echo "platfrom $(OS) not supported to release from" diff --git a/skaffold.yaml b/skaffold.yaml index 7eaa482fe..83c8be6df 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -2,7 +2,7 @@ apiVersion: skaffold/v1beta2 kind: Config build: artifacts: - - image: devops-26/go-demo-6 + - image: vfarcic/go-demo-6 context: . docker: {} tagPolicy: From 0de258dc894a8ea4e5a7d1447f99c54733b57445 Mon Sep 17 00:00:00 2001 From: Viktor Farcic Date: Sun, 26 Jan 2020 18:01:56 +0100 Subject: [PATCH 4/5] Added silly tests --- jenkins-x.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/jenkins-x.yml b/jenkins-x.yml index 880cd6f8a..2b0e1e516 100755 --- a/jenkins-x.yml +++ b/jenkins-x.yml @@ -8,3 +8,4 @@ pipelineConfig: promote: steps: - command: ADDRESS=`jx get preview --current 2>&1` make functest + - command: ADDRESS=http://this-domain-does-not-exist.com make functest From f6548efdcb84aeb23d8a74b7cc7bf3bfe648e333 Mon Sep 17 00:00:00 2001 From: Viktor Farcic Date: Sun, 26 Jan 2020 18:07:03 +0100 Subject: [PATCH 5/5] Removed the silly test --- jenkins-x.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/jenkins-x.yml b/jenkins-x.yml index 2b0e1e516..8826062b7 100755 --- a/jenkins-x.yml +++ b/jenkins-x.yml @@ -5,7 +5,3 @@ pipelineConfig: build: preSteps: - command: make unittest - promote: - steps: - - command: ADDRESS=`jx get preview --current 2>&1` make functest - - command: ADDRESS=http://this-domain-does-not-exist.com make functest