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
# Postgres
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
@ -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
# Tooling
COPY ./scripts/install-awscli.sh /tmp/install-awscli.sh
RUN bash /tmp/install-awscli.sh
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 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 go get github.com/ckaznocha/protoc-gen-lint
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/loov/leakcheck
# Output formatters
RUN go get github.com/mfridman/tparse
RUN go get github.com/axw/gocov/gocov
RUN go get github.com/AlekSi/gocov-xml
RUN go get -v -u github.com/loov/leakcheck
RUN go version
# Set our entrypoint to close after 18 minutes, and forcefully close at 20 minutes.
# This is to prevent Jenkins collecting cats.
ENTRYPOINT ["timeout", "-k20m", "18m"]

View File

@ -2,7 +2,7 @@ pipeline {
agent {
dockerfile {
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'
}
}
@ -11,17 +11,17 @@ pipeline {
}
stages {
stage('Start') {
steps {
gerritReview message: 'Building'
sh 'python ./scripts/gerrit-cla.py'
}
steps {
gerritReview message: 'Building'
sh 'python ./scripts/gerrit-cla.py'
}
}
stage('Build') {
steps {
checkout scm
sh 'mkdir .build'
sh 'mkdir -p .build'
// make a backup of the mod file in case, for later linting
sh 'cp go.mod .build/go.mod.orig'

View File

@ -2,7 +2,7 @@ pipeline {
agent {
dockerfile {
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'
}
}
@ -14,7 +14,7 @@ pipeline {
steps {
checkout scm
sh 'mkdir .build'
sh 'mkdir -p .build'
// make a backup of the mod file in case, for later linting
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 {
if next.Id == lookup.target {
lookup.cond.L.Lock()
allDone = true
lookup.cond.L.Unlock()
}
lookup.queue.QuerySuccess(next, neighbors...)
}