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

Make sure version is properly set on CI #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ RUN adduser -u 9000 -D app

WORKDIR /usr/src/app

COPY engine.json /engine.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, so trying to understand how this worked before - i think the idea was that this layer would control the caching, meaning if this file did not change, it wouldn't re-run the below steps and actually pull in a different go lint version.

running update could potentially change this file (which happened at the beginning of the image command), and break this cache layer, causing the below steps to run and actually pull in that sha. i think this is what we do in api for example with the dockerfile-version file.

what was the problem with how this was working before?

COPY codeclimate-golint.go /usr/src/app/codeclimate-golint.go
COPY engine.json codeclimate-golint.go ./

RUN apk add --no-cache --virtual .dev-deps musl-dev go git && \
RUN apk add --no-cache --virtual .dev-deps musl-dev go git jq && \
export GOPATH=/tmp/go GOBIN=/usr/local/bin && \
go get -d -t -v . && \
export LIBRARY_PATH=/usr/lib32:$LIBRARY_PATH && \
go install codeclimate-golint.go && \
export golint_version=$(cd "${GOPATH}/src/github.com/golang/lint/" && git rev-parse HEAD 2>/dev/null) && \
cat engine.json | jq '.version = .version + "/" + env.golint_version' > /engine.json && \
apk del .dev-deps && \
rm -rf "$GOPATH"

Expand Down
10 changes: 1 addition & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,5 @@

IMAGE_NAME ?= codeclimate/codeclimate-golint

update:
docker run \
--rm --interactive \
-v $(PWD)/engine.json:/engine.json \
-v $(PWD)/bin/update:/usr/local/bin/update \
alpine:edge \
/usr/local/bin/update

image: update
image:
docker build --rm -t $(IMAGE_NAME) .
15 changes: 0 additions & 15 deletions bin/update

This file was deleted.

2 changes: 1 addition & 1 deletion engine.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"languages": [
"Go"
],
"version": "1.0.0/6aaf7c34af0f4c36a57e0c429bace4d706d8e931",
"version": "1.0.0",
"spec_version": "0.3.1"
}