jenkins: Stop docker container after 18m (#2358)

* remove unnecessary argument

* remove kademlia lookup short circuiting

* fix ident

* add timeout to docker container

* add comments to dockerfile
This commit is contained in:
Egon Elbre 2019-06-27 19:09:37 +03:00 committed by JT Olio
parent 2128b460b4
commit 27c92ffc10
4 changed files with 21 additions and 17 deletions

View File

@ -1,5 +1,7 @@
FROM golang:1.12 FROM golang:1.12
# Postgres
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
@ -14,6 +16,8 @@ RUN rm /etc/postgresql/11/main/pg_hba.conf; \
RUN echo 'max_connections = 1000' >> /etc/postgresql/11/main/conf.d/connectionlimits.conf RUN echo 'max_connections = 1000' >> /etc/postgresql/11/main/conf.d/connectionlimits.conf
# Tooling
COPY ./scripts/install-awscli.sh /tmp/install-awscli.sh COPY ./scripts/install-awscli.sh /tmp/install-awscli.sh
RUN bash /tmp/install-awscli.sh RUN bash /tmp/install-awscli.sh
ENV PATH "$PATH:/root/bin" ENV PATH "$PATH:/root/bin"
@ -21,15 +25,20 @@ ENV PATH "$PATH:/root/bin"
RUN curl -L https://github.com/google/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip -o /tmp/protoc.zip RUN curl -L https://github.com/google/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip -o /tmp/protoc.zip
RUN unzip /tmp/protoc.zip -d "$HOME"/protoc RUN unzip /tmp/protoc.zip -d "$HOME"/protoc
# Linters
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b ${GOPATH}/bin v1.17.1 RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b ${GOPATH}/bin v1.17.1
RUN go get github.com/ckaznocha/protoc-gen-lint RUN go get github.com/ckaznocha/protoc-gen-lint
RUN go get github.com/nilslice/protolock/cmd/protolock RUN go get github.com/nilslice/protolock/cmd/protolock
RUN go get github.com/mfridman/tparse
RUN go get github.com/josephspurrier/goversioninfo RUN go get github.com/josephspurrier/goversioninfo
RUN go get github.com/loov/leakcheck
# Output formatters
RUN go get github.com/mfridman/tparse
RUN go get github.com/axw/gocov/gocov RUN go get github.com/axw/gocov/gocov
RUN go get github.com/AlekSi/gocov-xml RUN go get github.com/AlekSi/gocov-xml
RUN go get -v -u github.com/loov/leakcheck # Set our entrypoint to close after 18 minutes, and forcefully close at 20 minutes.
# This is to prevent Jenkins collecting cats.
RUN go version ENTRYPOINT ["timeout", "-k20m", "18m"]

View File

@ -2,7 +2,7 @@ pipeline {
agent { agent {
dockerfile { dockerfile {
filename 'Dockerfile.jenkins' filename 'Dockerfile.jenkins'
args '-u root:root --stop-timeout 1200 --cap-add SYS_PTRACE -v "/tmp/gomod":/go/pkg/mod' args '-u root:root --cap-add SYS_PTRACE -v "/tmp/gomod":/go/pkg/mod'
label 'gerrit' label 'gerrit'
} }
} }
@ -11,17 +11,17 @@ pipeline {
} }
stages { stages {
stage('Start') { stage('Start') {
steps { steps {
gerritReview message: 'Building' gerritReview message: 'Building'
sh 'python ./scripts/gerrit-cla.py' sh 'python ./scripts/gerrit-cla.py'
} }
} }
stage('Build') { stage('Build') {
steps { steps {
checkout scm checkout scm
sh 'mkdir .build' sh 'mkdir -p .build'
// make a backup of the mod file in case, for later linting // make a backup of the mod file in case, for later linting
sh 'cp go.mod .build/go.mod.orig' sh 'cp go.mod .build/go.mod.orig'

View File

@ -2,7 +2,7 @@ pipeline {
agent { agent {
dockerfile { dockerfile {
filename 'Dockerfile.jenkins' filename 'Dockerfile.jenkins'
args '-u root:root --stop-timeout 1200 --cap-add SYS_PTRACE -v "/tmp/gomod":/go/pkg/mod' args '-u root:root --cap-add SYS_PTRACE -v "/tmp/gomod":/go/pkg/mod'
label 'main' label 'main'
} }
} }
@ -14,7 +14,7 @@ pipeline {
steps { steps {
checkout scm checkout scm
sh 'mkdir .build' sh 'mkdir -p .build'
// make a backup of the mod file in case, for later linting // make a backup of the mod file in case, for later linting
sh 'cp go.mod .build/go.mod.orig' sh 'cp go.mod .build/go.mod.orig'

View File

@ -96,11 +96,6 @@ func (lookup *peerDiscovery) Run(ctx context.Context) (_ []*pb.Node, err error)
) )
} }
} else { } else {
if next.Id == lookup.target {
lookup.cond.L.Lock()
allDone = true
lookup.cond.L.Unlock()
}
lookup.queue.QuerySuccess(next, neighbors...) lookup.queue.QuerySuccess(next, neighbors...)
} }