From e24a4babea20681a6608ea16db4f88829360aa6e Mon Sep 17 00:00:00 2001 From: Bishoy Youssef Date: Mon, 11 Feb 2019 16:32:18 -0500 Subject: [PATCH 1/5] migrating to ubuntu:bionic and golang-builder Signed-off-by: Bishoy Youssef --- Dockerfile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 153155f..e1fb076 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:alpine as builder +FROM concourse/golang-builder as builder COPY . /go/src/github.com/concourse/tracker-resource ENV CGO_ENABLED 0 ENV GOPATH /go/src/github.com/concourse/tracker-resource/Godeps/_workspace:${GOPATH} @@ -11,8 +11,14 @@ RUN set -e; mkdir /tests; for pkg in $(go list ./...); do \ go test -o "/tests/$(basename $pkg)/run" -c $pkg; \ done -FROM alpine:edge AS resource -RUN apk add --update bash tzdata ca-certificates git +FROM ubuntu:bionic AS resource +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive \ + apt-get install -y --no-install-recommends \ + tzdata \ + ca-certificates \ + git \ + && rm -rf /var/lib/apt/lists/* COPY --from=builder /assets /opt/resource FROM resource AS tests From e240c9b379a6d2a96592a16ab35148ac7fb5ac15 Mon Sep 17 00:00:00 2001 From: Bishoy Youssef Date: Thu, 21 Feb 2019 11:48:25 -0500 Subject: [PATCH 2/5] moving dockerfiles to a separate folder Signed-off-by: Bishoy Youssef Co-authored-by: Bohan Chen --- dockerfiles/alpine/Dockerfile | 25 +++++++++++++++++++++ Dockerfile => dockerfiles/ubuntu/Dockerfile | 0 2 files changed, 25 insertions(+) create mode 100644 dockerfiles/alpine/Dockerfile rename Dockerfile => dockerfiles/ubuntu/Dockerfile (100%) diff --git a/dockerfiles/alpine/Dockerfile b/dockerfiles/alpine/Dockerfile new file mode 100644 index 0000000..153155f --- /dev/null +++ b/dockerfiles/alpine/Dockerfile @@ -0,0 +1,25 @@ +FROM golang:alpine as builder +COPY . /go/src/github.com/concourse/tracker-resource +ENV CGO_ENABLED 0 +ENV GOPATH /go/src/github.com/concourse/tracker-resource/Godeps/_workspace:${GOPATH} +ENV PATH /go/src/github.com/concourse/tracker-resource/Godeps/_workspace/bin:${PATH} +RUN go build -o /assets/out github.com/concourse/tracker-resource/out/cmd/out +RUN go build -o /assets/in github.com/concourse/tracker-resource/in/cmd/in +RUN go build -o /assets/check github.com/concourse/tracker-resource/check/cmd/check +RUN set -e; mkdir /tests; for pkg in $(go list ./...); do \ + cp -a $(go list -f '{{.Dir}}' $pkg) /tests/$(basename $pkg); \ + go test -o "/tests/$(basename $pkg)/run" -c $pkg; \ + done + +FROM alpine:edge AS resource +RUN apk add --update bash tzdata ca-certificates git +COPY --from=builder /assets /opt/resource + +FROM resource AS tests +COPY --from=builder /tests /tests +RUN set -e; for test in /tests/*/run; do \ + cd $(dirname $test); \ + ./run; \ + done + +FROM resource diff --git a/Dockerfile b/dockerfiles/ubuntu/Dockerfile similarity index 100% rename from Dockerfile rename to dockerfiles/ubuntu/Dockerfile From cee5401c64ae6cf0a1d848187ad193a37893edf4 Mon Sep 17 00:00:00 2001 From: Bin Ju Date: Mon, 18 Mar 2019 15:34:07 -0400 Subject: [PATCH 3/5] update README with instructions for dev Signed-off-by: Bin Ju Co-authored-by: Bohan Chen --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 774c193..0ab7c90 100644 --- a/README.md +++ b/README.md @@ -43,3 +43,19 @@ You'll need a separate resource for each Tracker project. * `repos`: *Required.* Paths to the git repositories which will contain the delivering commits. * `comment`: *Optional.* A file containing a comment to leave on any delivered stories. + +## Development + +### Running the tests + +The tests have been embedded with the `Dockerfile`; ensuring that the testing +environment is consistent across any `docker` enabled platform. When the docker +image builds, the test are run inside the docker container, on failure they +will stop the build. + +Run the tests with the following commands for both `alpine` and `ubuntu` images: + +```sh +docker build -t time-resource -f dockerfiles/alpine/Dockerfile . +docker build -t time-resource -f dockerfiles/ubuntu/Dockerfile . +``` From a5d9402d3bb97d40c30bbe3499c9ff22203d269a Mon Sep 17 00:00:00 2001 From: Bin Ju Date: Mon, 18 Mar 2019 15:35:27 -0400 Subject: [PATCH 4/5] fix typo from copy/paste Signed-off-by: Bin Ju Co-authored-by: Bohan Chen --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0ab7c90..9e9ddbf 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,6 @@ will stop the build. Run the tests with the following commands for both `alpine` and `ubuntu` images: ```sh -docker build -t time-resource -f dockerfiles/alpine/Dockerfile . -docker build -t time-resource -f dockerfiles/ubuntu/Dockerfile . +docker build -t tracker-resource -f dockerfiles/alpine/Dockerfile . +docker build -t tracker-resource -f dockerfiles/ubuntu/Dockerfile . ``` From fdbb9bee43bc888f8d0c01239180104a0230a7fe Mon Sep 17 00:00:00 2001 From: Bin Ju Date: Mon, 18 Mar 2019 15:49:02 -0400 Subject: [PATCH 5/5] add Prerequisites and Contributing to README Signed-off-by: Bin Ju Co-authored-by: Bohan Chen --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 9e9ddbf..2d53b18 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,14 @@ You'll need a separate resource for each Tracker project. ## Development +### Prerequisites + +* golang is *required* - version 1.9.x is tested; earlier versions may also + work. +* docker is *required* - version 17.06.x is tested; earlier versions may also + work. +* godep is used for dependency management of the golang packages. + ### Running the tests The tests have been embedded with the `Dockerfile`; ensuring that the testing @@ -59,3 +67,8 @@ Run the tests with the following commands for both `alpine` and `ubuntu` images: docker build -t tracker-resource -f dockerfiles/alpine/Dockerfile . docker build -t tracker-resource -f dockerfiles/ubuntu/Dockerfile . ``` + +### Contributing + +Please make all pull requests to the `master` branch and ensure tests pass +locally.