Skip to content

Commit

Permalink
Merge pull request #1047 from cloudflare/cbroglie/modules
Browse files Browse the repository at this point in the history
Migrate to Go modules
  • Loading branch information
cbroglie authored Oct 30, 2019
2 parents 40f4f51 + 9f1008d commit 2318616
Show file tree
Hide file tree
Showing 251 changed files with 9,778 additions and 120,480 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
dist/*
cli/serve/static.rice-box.go
.coverprofile
coverprofile.txt
gopath
coverage.txt
profile.out
bin
44 changes: 10 additions & 34 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@ language: go

matrix:
include:
- go: 1.12.7
- go: master
os: osx
env: BUILD_TAGS=
allow_failures:
- go: master
- go: 1.12.x
- go: 1.13.x

# Install g++-4.8 to support std=c++11 for github.com/google/certificate-transparency/go/merkletree
addons:
Expand All @@ -24,14 +20,6 @@ install:
services:
- mysql
- postgresql
before_install:
# CFSSL consists of multiple Go packages, which refer to each other by
# their absolute GitHub path, e.g. github.com/cloudflare/crypto/pkcs7.
# That means, by default, if someone forks the repo and makes changes across
# multiple packages within CFSSL, Travis won't pass for the branch on their
# own repo. To fix that, we move the directory
- mkdir -p $TRAVIS_BUILD_DIR $GOPATH/src/github.com/cloudflare
- test ! -d $GOPATH/src/github.com/cloudflare/cfssl && mv $TRAVIS_BUILD_DIR $GOPATH/src/github.com/cloudflare/cfssl || true

# Only build pull requests, pushes to the master branch, and branches
# starting with `test-`. This is a convenient way to push branches to
Expand All @@ -44,41 +32,29 @@ branches:
- /^test-.*$/

before_script:
- go install ./vendor/golang.org/x/lint/golint
- go install ./vendor/github.com/GeertJohan/fgt
- make bin/golint
# Setup DBs + run migrations
- go install ./vendor/bitbucket.org/liamstask/goose/cmd/goose
# The sql_mode adjustment is to remove a sql_mode that was added in MySQL 5.7, this mode applies a rule that does:
# > The NO_ZERO_DATE mode affects whether the server permits '0000-00-00' as a valid date.
# https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_zero_date
- if [[ $(uname -s) == 'Linux' ]]; then
make bin/goose;
psql -c 'create database certdb_development;' -U postgres;
goose -path $GOPATH/src/github.com/cloudflare/cfssl/certdb/pg up;
./bin/goose -path certdb/pg up;
mysql -e 'create database certdb_development;' -u root;
mysql -e 'SET global sql_mode = 0;' -u root;
goose -path $GOPATH/src/github.com/cloudflare/cfssl/certdb/mysql up;
./bin/goose -path certdb/mysql up;
fi

script:
- ./test.sh
notifications:
email:
recipients:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
on_success: never
on_failure: change

env:
global:
- secure: "OmaaZ3jhU9VQ/0SYpenUJEfnmKy/MwExkefFRpDbkRSu/hTQpxxALAZV5WEHo7gxLRMRI0pytLo7w+lAd2FlX1CNcyY62MUicta/8P2twsxp+lR3v1bJ7dwk6qsDbO7Nvv3BKPCDQCHUkggbAEJaHEQGdLk4ursNEB1aGimuCEc="
- GO15VENDOREXPERIMENT=1
- GO111MODULE=on
matrix:
- BUILD_TAGS="postgresql mysql"

after_success:
- bash <(curl -s https://codecov.io/bash) -f coverprofile.txt
- bash <(curl -s https://codecov.io/bash)
18 changes: 7 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
FROM golang:1.12.7
FROM golang:1.13.3@sha256:6a693fbaba7dd8d816f6afce049fb92b280c588e0a677c4c8db26645e613fc15

ENV USER root
WORKDIR /workdir
COPY . /workdir

WORKDIR /go/src/github.com/cloudflare/cfssl
COPY . .

# restore all deps and build
RUN go get github.com/cloudflare/cfssl_trust/... && \
go get github.com/GeertJohan/go.rice/rice && \
rice embed-go -i=./cli/serve && \
cp -R /go/src/github.com/cloudflare/cfssl_trust /etc/cfssl && \
go install ./cmd/...
RUN git clone https://github.com/cloudflare/cfssl_trust.git /etc/cfssl && \
make clean && \
make bin/rice && ./bin/rice embed-go -i=./cli/serve && \
make all && cp bin/* /usr/bin/

EXPOSE 8888

Expand Down
21 changes: 21 additions & 0 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM golang:1.13.3-alpine3.10@sha256:40278d43a27b6e0563fcc4dd52c991a25741b1a775402aea342ab9a80158e69e as builder

WORKDIR /workdir
COPY . /workdir

RUN set -x && \
apk --no-cache add git gcc libc-dev make

RUN git clone https://github.com/cloudflare/cfssl_trust.git /etc/cfssl && \
make clean && \
make bin/rice && ./bin/rice embed-go -i=./cli/serve && \
make all

FROM alpine:3.10
COPY --from=builder /etc/cfssl /etc/cfssl
COPY --from=builder /workdir/bin/ /usr/bin

EXPOSE 8888

ENTRYPOINT ["cfssl"]
CMD ["--help"]
11 changes: 0 additions & 11 deletions Dockerfile.build

This file was deleted.

30 changes: 0 additions & 30 deletions Dockerfile.minimal

This file was deleted.

Loading

0 comments on commit 2318616

Please sign in to comment.