Merge pull request #3 from megakoresh/develop

Yuhuuu
This commit is contained in:
Pedro el banquero 2020-02-09 20:23:15 -06:00 committed by GitHub
commit 8c25ca1a7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 61 additions and 71 deletions

View File

@ -1,7 +1,6 @@
dry-run: null
hookfiles: ./.dredd/compiled_hooks
language: go
sandbox: false
#server: context=dev task dc:up
server-wait: 240
init: false
@ -17,9 +16,7 @@ inline-errors: false
details: false
method: []
color: true
level: info
timestamp: false
silent: false
loglevel: debug
path: []
hooks-worker-timeout: 5000
hooks-worker-connect-timeout: 1500
@ -31,4 +28,4 @@ hooks-worker-handler-host: 0.0.0.0
hooks-worker-handler-port: 61321
config: ./.dredd/dredd.yml
blueprint: api-docs.yml
endpoint: 'http://0.0.0.0:3000'
endpoint: 'http://semaphore_ci:3000'

View File

@ -1,7 +1,6 @@
dry-run: null
hookfiles: ./.dredd/compiled_hooks
language: go
sandbox: false
#server: context=dev task dc:up
server-wait: 240
init: false
@ -17,9 +16,7 @@ inline-errors: false
details: false
method: []
color: true
level: info
timestamp: false
silent: false
loglevel: debug
path: []
hooks-worker-timeout: 5000
hooks-worker-connect-timeout: 1500

View File

@ -58,10 +58,10 @@ tasks:
- go install github.com/haya14busa/goverage
- go install github.com/snikch/goodman/cmd/goodman
- go install github.com/go-swagger/go-swagger/cmd/swagger
- '{{ if ne OS "windows" }} bash -c "curl -L https://github.com/goreleaser/goreleaser/releases/download/v{{ .GORELEASER_VERSION }}/goreleaser_$(uname -s)_$(uname -m).tar.gz | tar -xz -C $(go env GOPATH)/bin goreleaser"{{ else }} {{ end }}'
- '{{ if ne OS "windows" }} sh -c "curl -L https://github.com/goreleaser/goreleaser/releases/download/v{{ .GORELEASER_VERSION }}/goreleaser_$(uname -s)_$(uname -m).tar.gz | tar -xz -C $(go env GOPATH)/bin goreleaser"{{ else }} {{ end }}'
- '{{ if ne OS "windows" }} chmod +x $(go env GOPATH)/bin/goreleaser{{ else }} {{ end }}'
- '{{ if eq OS "windows" }} echo "NOTICE: You must download goreleaser manually to build this application https://github.com/goreleaser/goreleaser/releases "{{ else }}:{{ end }}'
- '{{ if ne OS "windows" }} bash -c "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v{{ .GOLINTER_VERSION }}"{{ else }}{{ end }}'
- '{{ if ne OS "windows" }} sh -c "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v{{ .GOLINTER_VERSION }}"{{ else }}{{ end }}'
- '{{ if eq OS "windows" }} echo "NOTICE: You need to install golangci-lint manually to build this application https://github.com/golangci/golangci-lint#install"{{ else }}{{ end }}'
compile:

View File

@ -1,8 +1,5 @@
# Golang testing image with some tools already installed
FROM golang:1.13-alpine
LABEL maintainer="Tom Whiston <tom.whiston@gmail.com>"
ENV SEMAPHORE_VERSION="development" SEMAPHORE_ARCH="linux_amd64" \
SEMAPHORE_CONFIG_PATH="${SEMAPHORE_CONFIG_PATH:-/etc/semaphore}" \
APP_ROOT="/go/src/github.com/ansible-semaphore/semaphore/"

View File

@ -1,6 +1,5 @@
#!/usr/bin/env bash
echo "--> Turn off StrictKeyChecking"
cat > /etc/ssh/ssh_config <<EOF
Host *

View File

@ -1,23 +1,21 @@
# hadolint ignore=DL3006
FROM tomwhiston/dredd:latest
FROM apiaryio/dredd:13.0.0
ENV TASK_VERSION=v2.0.1 \
GOPATH=/home/developer/go \
SEMAPHORE_SERVICE=semaphore_ci \
ENV SEMAPHORE_SERVICE=semaphore_ci \
SEMAPHORE_PORT=3000 \
MYSQL_SERVICE=mysql \
MYSQL_PORT=3306
# We need the source and task to compile the hooks
USER 0
RUN dnf install -y nc
COPY deployment/docker/ci/dredd/entrypoint /usr/local/bin
COPY . /home/developer/go/src/github.com/ansible-semaphore/semaphore
RUN (cd $(go env GOPATH) && curl -sL https://taskfile.dev/install.sh | sh) &&\
chown -R developer /home/developer/go
RUN apk add --no-cache bash curl git go
RUN (cd /usr && curl -sL https://taskfile.dev/install.sh | sh)
# We need the source and task to compile the hooks
COPY . /semaphore/
WORKDIR /semaphore
# Get tools and do compile
WORKDIR /home/developer/go/src/github.com/ansible-semaphore/semaphore
RUN task deps:tools && task deps:be && task compile:be && task compile:api:hooks
COPY deployment/docker/ci/dredd/entrypoint /usr/local/bin
ENTRYPOINT ["/usr/local/bin/entrypoint"]

View File

@ -3,7 +3,7 @@
set -e
echo "---> Add Config"
cat > ./.dredd/config.json <<EOF
cat > /semaphore/.dredd/config.json <<EOF
{
"mysql": {
"host": "${MYSQL_SERVICE}:${MYSQL_PORT}",
@ -22,4 +22,4 @@ done
echo "---> Run Dredd"
# We do this because otherwise it can fail out
sleep 5
/home/developer/node_modules/.bin/dredd $@
dredd $@

View File

@ -1,10 +1,10 @@
# Golang testing image with some tools already installed
FROM golang:1.13-alpine
ENV SEMAPHORE_VERSION="development" SEMAPHORE_ARCH="linux_amd64" \
SEMAPHORE_CONFIG_PATH="${SEMAPHORE_CONFIG_PATH:-/etc/semaphore}" \
APP_ROOT="/go/src/github.com/ansible-semaphore/semaphore/"
# hadolint ignore=DL3013
RUN apk add --no-cache git mysql-client python py-pip py-openssl openssl ca-certificates curl curl-dev openssh-client tini nodejs nodejs-npm bash rsync && \
apk --update add --virtual build-dependencies python-dev libffi-dev openssl-dev build-base &&\
rm -rf /var/cache/apk/*
@ -28,9 +28,9 @@ RUN cd $(go env GOPATH) && curl -sL https://taskfile.dev/install.sh | sh
# Copy in app source
WORKDIR ${APP_ROOT}
COPY . ${APP_ROOT}
RUN deployment/docker/dev/bin/install
RUN deployment/docker/ci/bin/install
USER 1000
USER semaphore
EXPOSE 3000
CMD ["task", "watch"]
ENTRYPOINT ["/usr/local/bin/semaphore-wrapper"]
CMD ["./bin/semaphore", "--config", "/etc/semaphore/config.json"]

View File

@ -1,23 +1,27 @@
# hadolint ignore=DL3006
FROM tomwhiston/dredd:latest
FROM golang:1.13-alpine as golang
ENV TASK_VERSION=v2.0.1 \
GOPATH=/home/developer/go \
SEMAPHORE_SERVICE=semaphore_ci \
RUN apk add --no-cache curl git
# We need the source and task to compile the hooks
COPY . /semaphore/
RUN (cd /usr && curl -sL https://taskfile.dev/install.sh | sh)
WORKDIR /semaphore
RUN task deps:tools && task deps:be && task compile:be && task compile:api:hooks
FROM apiaryio/dredd:13.0.0 as dredd
RUN apk add --no-cache bash
COPY --from=golang /semaphore /semaphore
WORKDIR /semaphore
COPY deployment/docker/ci/dredd/entrypoint /usr/local/bin
ENV SEMAPHORE_SERVICE=semaphore_ci \
SEMAPHORE_PORT=3000 \
MYSQL_SERVICE=mysql \
MYSQL_PORT=3306
# We need the source and task to compile the hooks
USER 0
RUN dnf install -y nc
COPY deployment/docker/ci/dredd/entrypoint /usr/local/bin
COPY . /home/developer/go/src/github.com/ansible-semaphore/semaphore
RUN (cd $(go env GOPATH) && curl -sL https://taskfile.dev/install.sh | sh) &&\
chown -R developer /home/developer/go
# Get tools and do compile
WORKDIR /home/developer/go/src/github.com/ansible-semaphore/semaphore
RUN task deps:tools && task deps:be && task compile:be && task compile:api:hooks
ENTRYPOINT ["/usr/local/bin/entrypoint"]

View File

@ -1,26 +1,30 @@
# ansible-semaphore production image
#
# Uses frolvlad alpine so we have access to glibc which is needed for golang
# and when deploying in openshift
FROM frolvlad/alpine-glibc:alpine-3.7
FROM golang:1.13-alpine3.10 as builder
LABEL maintainer="Tom Whiston <tom.whiston@gmail.com>"
RUN apk add --no-cache git ansible mysql-client curl openssh-client tini && \
COPY ./ /go/src/github.com/ansible-semaphore/semaphore
WORKDIR /go/src/github.com/ansible-semaphore/semaphore
RUN apk add --no-cache -U libc-dev curl nodejs npm git && \
./deployment/docker/prod/bin/install
# Uses frolvlad alpine so we have access to glibc which is needed for golang
# and when deploying in openshift
FROM frolvlad/alpine-glibc:alpine-3.10 as runner
RUN apk add --no-cache git curl ansible mysql-client openssh-client tini && \
adduser -D -u 1001 -G root semaphore && \
mkdir -p /tmp/semaphore && \
mkdir -p /etc/semaphore && \
chown -R semaphore:0 /tmp/semaphore && \
chown -R semaphore:0 /etc/semaphore
COPY ./ /go/src/github.com/ansible-semaphore/semaphore
WORKDIR /go/src/github.com/ansible-semaphore/semaphore
COPY --from=builder /usr/local/bin/semaphore-wrapper /usr/local/bin/
COPY --from=builder /usr/local/bin/semaphore /usr/local/bin/
RUN apk add --no-cache -U libc-dev go nodejs && \
./deployment/docker/prod/bin/install && \
apk del libc-dev go nodejs && \
rm -rf /go/* && \
rm -rf /var/cache/apk/*
RUN chown -R semaphore:0 /usr/local/bin/semaphore-wrapper &&\
chown -R semaphore:0 /usr/local/bin/semaphore
WORKDIR /home/semaphore
USER 1001

View File

@ -2,12 +2,6 @@
set -e
# Go build environment
export GOROOT=/usr/lib/go
export GOPATH=/go
export GOBIN=/go/bin
export PATH="${PATH}:${GOBIN}"
# Get prerequisites for building the app
(cd $(go env GOPATH) && curl -sL https://taskfile.dev/install.sh | sh)