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

My PR #177

Merged
merged 3 commits into from
May 20, 2020
Merged

My PR #177

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
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@ lint: vendor | $(PKGS) $(GOLINT) # ❷
test -z "$$($(GOLINT) $$pkg | tee /dev/stderr)" || ret=1 ; \
done ; exit $$ret

unittest:
CGO_ENABLED=$(CGO_ENABLED) $(GO) \
test --run UnitTest -v

2 changes: 1 addition & 1 deletion charts/go-demo-6/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)\/jx-demo-276816\/$(NAME)|" values.yaml
sed -i -e "s/tag:.*/tag: $(VERSION)/" values.yaml
else
echo "platfrom $(OS) not supported to tag with"
Expand Down
2 changes: 1 addition & 1 deletion charts/preview/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)\/jx-demo-276816\/go-demo-6|" values.yaml
sed -i -e "s/tag:.*/tag: $(PREVIEW_VERSION)/" values.yaml
else
echo "platfrom $(OS) not supported to release from"
Expand Down
8 changes: 8 additions & 0 deletions charts/preview/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ preview:
tag:
pullPolicy: IfNotPresent
probePath: /demo/hello?health=true


db:
enabled: false

preview-db:
persistence:
enabled: false
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func HelloServer(w http.ResponseWriter, req *http.Request) {
delayNum, _ := strconv.Atoi(delay)
sleep(time.Duration(delayNum) * time.Millisecond)
}
io.WriteString(w, "hello, world!\n")
io.WriteString(w, "hello, PR not again!\n")
}

func RandomErrorServer(w http.ResponseWriter, req *http.Request) {
Expand Down
2 changes: 1 addition & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (s *MainTestSuite) Test_HelloServer_WritesHelloWorld() {

HelloServer(w, req)

w.AssertCalled(s.T(), "Write", []byte("hello, world!\n"))
w.AssertCalled(s.T(), "Write", []byte("hello, PR not again!\n"))
}

func (s *MainTestSuite) Test_HelloServer_Waits_WhenDelayIsPresent() {
Expand Down
28 changes: 0 additions & 28 deletions skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +0,0 @@
apiVersion: skaffold/v1beta2
kind: Config
build:
artifacts:
- image: devops-26/go-demo-6
context: .
docker: {}
tagPolicy:
envTemplate:
template: '{{.DOCKER_REGISTRY}}/{{.IMAGE_NAME}}:{{.VERSION}}'
local: {}
deploy:
kubectl: {}
profiles:
- name: dev
build:
tagPolicy:
envTemplate:
template: '{{.DOCKER_REGISTRY}}/{{.IMAGE_NAME}}:{{.DIGEST_HEX}}'
local: {}
deploy:
helm:
releases:
- name: go-demo-6
chartPath: charts/go-demo-6
setValueTemplates:
image.repository: '{{.DOCKER_REGISTRY}}/{{.IMAGE_NAME}}'
image.tag: '{{.DIGEST_HEX}}'
4 changes: 2 additions & 2 deletions watch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

# watch the go files and continously deploy the service
make linux
skaffold run -p dev
reflex -r "\.go$" -- bash -c 'make linux && skaffold run -p dev'
UUID=$(uuidgen) skaffold run -p dev
reflex -r "\.go$" -- bash -c 'make linux && make unittest && UUID=$(uuidgen) skaffold run -p dev'