Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4cebfbc
commit bc96937
Showing
7 changed files
with
143 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
.idea | ||
depcharge | ||
*.exe | ||
*.exe | ||
|
||
bin | ||
pkg | ||
src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
image: golang:1.10-alpine | ||
|
||
stages: | ||
- init | ||
- test | ||
- build | ||
|
||
init: | ||
stage: init | ||
script: | ||
- export GOPATH=$(pwd) | ||
- apk update && apk add git | ||
- go get github.com/ghodss/yaml github.com/cbroglie/mustache/... github.com/stretchr/testify | ||
artifacts: | ||
paths: | ||
- bin/ | ||
- pkg/ | ||
- src/ | ||
|
||
|
||
test: | ||
stage: test | ||
dependencies: | ||
- init | ||
coverage: '/coverage: \d+\.\d+\%/' | ||
script: | ||
- export GOPATH=$(pwd) | ||
- go test -cover | ||
|
||
|
||
build: | ||
stage: build | ||
dependencies: | ||
- init | ||
script: | ||
- export GOPATH=$(pwd) | ||
- go build . | ||
artifacts: | ||
paths: | ||
- depcharge | ||
|
||
|
||
build-docker: | ||
image: docker:latest | ||
stage: build | ||
services: | ||
- docker:dind | ||
script: | ||
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY | ||
- docker build -t $CI_REGISTRY_IMAGE:latest . | ||
|
||
# Ensure the container can run properly | ||
- docker run $CI_REGISTRY_IMAGE:latest | ||
|
||
- docker push $CI_REGISTRY_IMAGE:latest | ||
only: | ||
- master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM golang:1.10-alpine as go | ||
|
||
RUN apk update \ | ||
&& apk add git \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
RUN go get \ | ||
github.com/ghodss/yaml \ | ||
github.com/cbroglie/mustache/... \ | ||
github.com/stretchr/testify | ||
|
||
COPY . /go/src/depcharge | ||
WORKDIR /go/src/depcharge | ||
|
||
RUN go test . | ||
RUN go build . | ||
|
||
FROM alpine:latest | ||
COPY --from=go /go/src/depcharge/depcharge /bin/depcharge | ||
RUN mkdir /mount | ||
WORKDIR /mount | ||
ENTRYPOINT ["depcharge"] | ||
CMD ["--help"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
"github.com/stretchr/testify/assert" | ||
"reflect" | ||
) | ||
|
||
func TestFindActionHandler(t *testing.T) { | ||
var handler func([]Dep, Perform) | ||
|
||
handler = findActionHandler("git") | ||
functionEqual(t, gitActionHandler, handler) | ||
handler = findActionHandler("secret") | ||
functionEqual(t, secretesActionHandler, handler) | ||
handler = findActionHandler("other") | ||
functionEqual(t, defaultActionHandler, handler) | ||
} | ||
|
||
func functionEqual(t *testing.T, expected func([]Dep, Perform), actual func([]Dep, Perform)){ | ||
assert.Equal(t, reflect.ValueOf(expected), reflect.ValueOf(actual)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
deps: | ||
- name: depcharge | ||
kind: project | ||
location: ./ | ||
deps: | ||
- name: gitlab | ||
kind: git | ||
location: | ||
params: | ||
repo: git@gitlab.com:centerorbit/depcharge.git | ||
- name: github | ||
kind: git | ||
location: | ||
params: | ||
repo: git@github.com:centerorbit/depcharge.git | ||
- name: yaml-parser | ||
kind: go | ||
params: | ||
get: github.com/ghodss/yaml | ||
- name: mustache | ||
kind: go | ||
params: | ||
get: github.com/cbroglie/mustache/... | ||
- name: assertions | ||
kind: go | ||
params: | ||
get: github.com/stretchr/testify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
|
||
|
||
exec "$@" |