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

UPPSF-1150 Refactored project #35

Merged
merged 13 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
21 changes: 5 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@ jobs:
- run:
MiroslavGatsanoga marked this conversation as resolved.
Show resolved Hide resolved
name: External dependencies
command: |
go get -u github.com/mattn/goveralls
go get -u github.com/jstemmer/go-junit-report
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
GO111MODULE=off go get -u github.com/mattn/goveralls
GO111MODULE=off go get -u github.com/jstemmer/go-junit-report
- run:
name: Make result folders
command: |
mkdir -p ${CIRCLE_TEST_REPORTS}
mkdir -p ${CIRCLE_COVERAGE_REPORT}
- run:
name: Download vendored dependencies
command: dep ensure -v -vendor-only
- run:
name: Go build
command: go build -v
command: go build -mod=readonly -v ./cmd/content-rw-elasticsearch
powerslider marked this conversation as resolved.
Show resolved Hide resolved
- run:
name: Run tests
command: go test -race -cover -coverprofile=${CIRCLE_COVERAGE_REPORT}/coverage.out ./... | go-junit-report > ${CIRCLE_TEST_REPORTS}/junit.xml
MiroslavGatsanoga marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -47,7 +43,7 @@ jobs:
dredd:
working_directory: /go/src/github.com/Financial-Times/content-rw-elasticsearch
docker:
- image: bankrs/golang-dredd:go1.10.0-dredd5.1.5
- image: bankrs/golang-dredd:go1.13.7-dredd11.2.19
MiroslavGatsanoga marked this conversation as resolved.
Show resolved Hide resolved
environment:
GOPATH: /go
ELASTICSEARCH_SAPI_ENDPOINT: http://localhost:9000
Expand All @@ -57,16 +53,9 @@ jobs:
- run:
name: Load ersatz-fixtures.yml to ersatz image
command: "curl -X POST --data-binary @_ft/ersatz-fixtures.yml -H \"Content-type: text/x-yaml\" http://localhost:9000/__configure"
- run:
name: External Dependencies
command: |
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- run:
name: Download vendored dependencies
command: dep ensure -v -vendor-only
- run:
name: Go Build
command: go build -v
command: go build -mod=readonly -v ./cmd/content-rw-elasticsearch
- run:
name: Dredd API Testing
command: dredd
Expand Down
20 changes: 18 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
*.iml
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
vendor/

# IntelliJ files
*.iml
.idea

/content-rw-elasticsearch
vendor/*/
15 changes: 5 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,28 @@ ENV PROJECT=content-rw-elasticsearch

ENV ORG_PATH="github.com/Financial-Times"
ENV SRC_FOLDER="${GOPATH}/src/${ORG_PATH}/${PROJECT}"
ENV BUILDINFO_PACKAGE="${ORG_PATH}/${PROJECT}/vendor/${ORG_PATH}/service-status-go/buildinfo."
ENV BUILDINFO_PACKAGE="${ORG_PATH}/service-status-go/buildinfo."

COPY . ${SRC_FOLDER}
WORKDIR ${SRC_FOLDER}

# Set up our extra bits in the image
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

# Install dependancies
RUN $GOPATH/bin/dep ensure -vendor-only

# Build app
RUN VERSION="version=$(git describe --tag --always 2> /dev/null)" \
&& DATETIME="dateTime=$(date -u +%Y%m%d%H%M%S)" \
&& REPOSITORY="repository=$(git config --get remote.origin.url)" \
&& REVISION="revision=$(git rev-parse HEAD)" \
&& BUILDER="builder=$(go version)" \
&& LDFLAGS="-X '"${BUILDINFO_PACKAGE}$VERSION"' -X '"${BUILDINFO_PACKAGE}$DATETIME"' -X '"${BUILDINFO_PACKAGE}$REPOSITORY"' -X '"${BUILDINFO_PACKAGE}$REVISION"' -X '"${BUILDINFO_PACKAGE}$BUILDER"'" \
&& CGO_ENABLED=0 go build -a -o /artifacts/${PROJECT} -ldflags="${LDFLAGS}" \
&& CGO_ENABLED=0 go build -mod=readonly -a -o /artifacts/${PROJECT} -ldflags="${LDFLAGS}" ./cmd/${PROJECT} \
&& echo "Build flags: ${LDFLAGS}"

# Multi-stage build - copy only the certs and the binary into the image
FROM scratch
WORKDIR /
COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=0 /artifacts/* /

# Copy things specific for this service
COPY ./runtime/referenceSchema.json /
## Copy things specific for this service
#COPY configs /configs
MiroslavGatsanoga marked this conversation as resolved.
Show resolved Hide resolved

CMD [ "/content-rw-elasticsearch" ]
238 changes: 0 additions & 238 deletions Gopkg.lock

This file was deleted.

Loading