From 4fc14c08c681451faea876f6f0fc052d06bdb5d2 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Sun, 23 Jul 2017 08:09:03 -0700 Subject: [PATCH] handle nodejs. --- ci/Dockerfile.node | 42 ++++++++++++++++++++++++++++++++- circle.yml | 48 +++++++++++++++++++++++++++----------- cmd/capsulecd/capsulecd.go | 7 ++++++ 3 files changed, 82 insertions(+), 15 deletions(-) diff --git a/ci/Dockerfile.node b/ci/Dockerfile.node index 5da161e..05266ff 100644 --- a/ci/Dockerfile.node +++ b/ci/Dockerfile.node @@ -3,4 +3,44 @@ ## Node ## ################################################## -FROM analogj/libgit2-crossbuild:linux-amd64 AS base \ No newline at end of file +FROM analogj/libgit2-crossbuild:linux-amd64 AS base +FROM node AS node +MAINTAINER Jason Kulatunga + +RUN apt-get update && apt-get install -y --no-install-recommends \ + apt-transport-https \ + ca-certificates \ + git \ + curl \ + gcc \ + g++ \ + && rm -rf /var/lib/apt/lists/* \ + && npm install -g eslint \ + && npm install -g nsp + +# Install GOLANG +ENV GO_VERSION 1.8.3 +RUN curl -fsSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" \ + | tar -xzC /usr/local + +ENV PATH="/go/bin:/usr/local/go/bin:${PATH}" \ + GOPATH="/go" + +ENV PKG_CONFIG_PATH="/usr/lib/pkgconfig/:/usr/local/lib/pkgconfig/:/usr/local/lib/libgit2/lib/pkgconfig:/usr/local/lib/openssl/lib/pkgconfig:/usr/local/lib/libssh2" +RUN go get github.com/Masterminds/glide +COPY --from=base /usr/local/lib/libgit2/ /usr/local/lib/libgit2/ +COPY --from=base /usr/local/lib/libssh2/ /usr/local/lib/libssh2/ +COPY --from=base /usr/local/lib/openssl/ /usr/local/lib/openssl/ + +WORKDIR /go/src/capsulecd + +COPY . . + +## download glide deps & move libgit2 library into expected location. +RUN glide install \ + && mkdir -p /go/src/capsulecd/vendor/gopkg.in/libgit2/git2go.v25/vendor/libgit2/build \ + && cp -r /usr/local/lib/libgit2/lib/pkgconfig/. /go/src/capsulecd/vendor/gopkg.in/libgit2/git2go.v25/vendor/libgit2/build/ + +ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt + +CMD ci/coverage.sh \ No newline at end of file diff --git a/circle.yml b/circle.yml index 8754219..7ebfa3d 100644 --- a/circle.yml +++ b/circle.yml @@ -20,6 +20,8 @@ jobs: add go build-base bash curl \ && rm -rf /var/cache/apk/* + mkdir -p /coverage + # Configure Go mkdir -p ${GOPATH}/src ${GOPATH}/bin @@ -32,31 +34,50 @@ jobs: docker build -f ci/Dockerfile.base --tag analogj/capsulecd-build:base . docker build -f ci/Dockerfile.chef --tag analogj/capsulecd-build:chef . # docker build -f ci/Dockerfile.golang --tag analogj/capsulecd-build:golang . -# docker build -f ci/Dockerfile.node --tag analogj/capsulecd-build:node . + docker build -f ci/Dockerfile.node --tag analogj/capsulecd-build:node . # docker build -f ci/Dockerfile.python --tag analogj/capsulecd-build:python . # docker build -f ci/Dockerfile.ruby --tag analogj/capsulecd-build:ruby . - run: - name: Run Docker containers with coverage + name: Run Base Docker containers with coverage shell: bash command: | - mkdir -p /coverage - - echo "#################################################### BASE" + CAPSULECD_ENV=base + echo "#################################################### $CAPSULECD_ENV" docker run -e "CI=true" \ --name base \ - analogj/capsulecd-build:base \ - ./ci/coverage.sh base + analogj/capsulecd-build:$CAPSULECD_ENV \ + ./ci/coverage.sh $CAPSULECD_ENV - docker cp base:/coverage/coverage-base.txt /coverage + docker cp base:/coverage/coverage-$CAPSULECD_ENV.txt /coverage + - run: + name: Run Chef Docker containers with coverage + shell: bash + command: | + CAPSULECD_ENV=chef + echo "#################################################### $CAPSULECD_ENV" + docker run -e "CI=true" \ + --name base \ + analogj/capsulecd-build:$CAPSULECD_ENV \ + ./ci/coverage.sh $CAPSULECD_ENV - echo "#################################################### CHEF" + docker cp base:/coverage/coverage-$CAPSULECD_ENV.txt /coverage + - run: + name: Run Node Docker containers with coverage + shell: bash + command: | + CAPSULECD_ENV=node + echo "#################################################### $CAPSULECD_ENV" docker run -e "CI=true" \ - --name chef \ - analogj/capsulecd-build:chef \ - ./ci/coverage.sh chef + --name base \ + analogj/capsulecd-build:$CAPSULECD_ENV \ + ./ci/coverage.sh $CAPSULECD_ENV - docker cp chef:/coverage/coverage-chef.txt /coverage + docker cp base:/coverage/coverage-$CAPSULECD_ENV.txt /coverage + - run: + name: Merge coverage reports and submit + shell: bash + command: | ls -alt /coverage # upload to codecov. @@ -64,7 +85,6 @@ jobs: # docker run -e "CI=true" -v /coverage:/tmp/coverage analogj/capsulecd-build:golang -# docker run -e "CI=true" -v /coverage:/tmp/coverage analogj/capsulecd-build:node # docker run -e "CI=true" -v /coverage:/tmp/coverage analogj/capsulecd-build:python # docker run -e "CI=true" -v /coverage:/tmp/coverage analogj/capsulecd-build:ruby diff --git a/cmd/capsulecd/capsulecd.go b/cmd/capsulecd/capsulecd.go index 4d546ae..55ed673 100644 --- a/cmd/capsulecd/capsulecd.go +++ b/cmd/capsulecd/capsulecd.go @@ -31,6 +31,13 @@ func main() { Usage: "Start a new CapsuleCD package pipeline", Action: func(c *cli.Context) error { + fmt.Println(` + ___ __ ____ ____ _ _ __ ____ ___ ____ + / __) / _\ ( _ \/ ___)/ )( \( ) ( __)/ __)( \ +( (__ / \ ) __/\___ \) \/ (/ (_/\ ) _)( (__ ) D ( + \___)\_/\_/(__) (____/\____/\____/(____)\___)(____/`) + + config, _ := config.Create() config.Set("scm", c.String("scm")) config.Set("package_type", c.String("package_type"))