Skip to content

Commit

Permalink
Update Go to 1.20
Browse files Browse the repository at this point in the history
Also update golangci-lint and go-junit-report.

Closes #877.
  • Loading branch information
michaelsauter committed May 5, 2023
1 parent 9173808 commit c3fb79d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
15 changes: 8 additions & 7 deletions common/jenkins-agents/golang/docker/Dockerfile.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@ LABEL maintainer="Michael Sauter <michael.sauter@boehringer-ingelheim.com>"

ARG goDistributionUrl

ENV PATH $PATH:/usr/local/go/bin
ENV GOBIN /usr/local/bin

RUN yum install -y gcc gcc-c++

RUN cd /tmp && \
curl -LfSso /tmp/go.tar.gz $goDistributionUrl && \
tar -C /usr/local -xzf go.tar.gz && \
rm -f /tmp/go.tar.gz && \
cd - && \
mkdir /go
mkdir /go && \
go version

ENV PATH $PATH:/usr/local/go/bin
ENV GOBIN /usr/local/bin
WORKDIR /go

COPY install-golangci-lint.sh /tmp/install-golangci-lint.sh
RUN /tmp/install-golangci-lint.sh -b /usr/local/bin v1.25.0 && \
RUN /tmp/install-golangci-lint.sh -b /usr/local/bin v1.52.2 && \
rm -f /tmp/install-golangci-lint.sh

RUN go get -u github.com/jstemmer/go-junit-report
RUN go install github.com/jstemmer/go-junit-report/v2@v2.0.0

RUN mkdir -p /home/jenkins/go && chmod g+w /home/jenkins/go

WORKDIR /go
20 changes: 14 additions & 6 deletions common/jenkins-agents/golang/docker/install-golangci-lint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh
set -e
# Code generated by godownloader. DO NOT EDIT.
#

usage() {
this=$1
Expand Down Expand Up @@ -88,6 +86,12 @@ get_binaries() {
linux/mips64le) BINARIES="golangci-lint" ;;
linux/ppc64le) BINARIES="golangci-lint" ;;
linux/s390x) BINARIES="golangci-lint" ;;
linux/riscv64) BINARIES="golangci-lint" ;;
linux/loong64) BINARIES="golangci-lint" ;;
netbsd/386) BINARIES="golangci-lint" ;;
netbsd/amd64) BINARIES="golangci-lint" ;;
netbsd/armv6) BINARIES="golangci-lint" ;;
netbsd/armv7) BINARIES="golangci-lint" ;;
windows/386) BINARIES="golangci-lint" ;;
windows/amd64) BINARIES="golangci-lint" ;;
windows/arm64) BINARIES="golangci-lint" ;;
Expand Down Expand Up @@ -194,9 +198,10 @@ log_crit() {
uname_os() {
os=$(uname -s | tr '[:upper:]' '[:lower:]')
case "$os" in
cygwin_nt*) os="windows" ;;
msys*) os="windows" ;;
mingw*) os="windows" ;;
msys_nt*) os="windows" ;;
cygwin*) os="windows" ;;
win*) os="windows" ;;
esac
echo "$os"
}
Expand All @@ -211,6 +216,7 @@ uname_arch() {
armv5*) arch="armv5" ;;
armv6*) arch="armv6" ;;
armv7*) arch="armv7" ;;
loongarch64) arch="loong64" ;;
esac
echo ${arch}
}
Expand All @@ -229,7 +235,7 @@ uname_os_check() {
solaris) return 0 ;;
windows) return 0 ;;
esac
log_crit "uname_os_check '$(uname -s)' got converted to '$os' which is not a GOOS value. Please file bug at https://github.com/client9/shlib"
log_crit "uname_os_check '$(uname -s)' got converted to '$os' which is not a GOOS value."
return 1
}
uname_arch_check() {
Expand All @@ -248,9 +254,11 @@ uname_arch_check() {
mips64) return 0 ;;
mips64le) return 0 ;;
s390x) return 0 ;;
riscv64) return 0 ;;
amd64p32) return 0 ;;
loong64) return 0 ;;
esac
log_crit "uname_arch_check '$(uname -m)' got converted to '$arch' which is not a GOARCH value. Please file bug report at https://github.com/client9/shlib"
log_crit "uname_arch_check '$(uname -m)' got converted to '$arch' which is not a GOARCH value."
return 1
}
untar() {
Expand Down
2 changes: 1 addition & 1 deletion common/jenkins-agents/golang/ocp-config/bc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ parameters:
value: Dockerfile.ubi8
description: Dockerfile variant to use
- name: GO_DISTRIBUTION_URL
value: https://golang.org/dl/go1.14.2.linux-amd64.tar.gz
value: https://go.dev/dl/go1.20.4.linux-amd64.tar.gz
description: URL pointing to go binary
objects:
- apiVersion: v1
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/jenkins-agents/pages/golang.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ The image is built in the global `ods` project and is named `jenkins-agent-golan
It can be referenced in a `Jenkinsfile` with e.g. `ods/jenkins-agent-golang:latest`.

== Features
1. Go 1.14.2
2. golangci-lint 1.25.0
1. Go 1.20.x
2. golangci-lint 1.52.x

== Known limitations
Not (yet) Nexus package manager aware and no special HTTP Proxy configuration.

0 comments on commit c3fb79d

Please sign in to comment.