Skip to content

Commit

Permalink
Upgrade to Go 1.17 (grafana#1278)
Browse files Browse the repository at this point in the history
* Upgrade to 1.17.6 in go.mod and Dockerfiles

* Update CHANGELOG.md to mention the update

* Update Go version in drone/actions pipelines

* Update go.mod, go.sum files via

* Re-sign drone.yml

* Remove leading newline causing drone build to fail

* Bump golangci-lint image to a version using Go 1.17

* Re-attempt to solve linter issue with new golangci-lint image

* Remove suffix of exclude rules

* Clean previous Go version before unpacking Go 1.17

* Also clean up previous Go versions in other steps
  • Loading branch information
tpaschalis committed Jan 18, 2022
1 parent 9e83ecd commit ca628c2
Show file tree
Hide file tree
Showing 14 changed files with 302 additions and 166 deletions.
25 changes: 14 additions & 11 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trigger:

steps:
- name: lint
image: golangci/golangci-lint:v1.37.1
image: golangci/golangci-lint:v1.43
commands:
- apt-get update -y && apt-get install -y libsystemd-dev
- make lint
Expand Down Expand Up @@ -47,10 +47,11 @@ steps:
commands:
- apt-get update && apt-get install -y rubygems rpm nsis apt-transport-https ca-certificates curl gnupg lsb-release
- gem install --no-document fpm
- rm -r /usr/local/go
- mkdir -p /usr/local/go/bin
- wget -q https://golang.org/dl/go1.16.5.linux-amd64.tar.gz
- tar -C /usr/local -xzf go1.16.5.linux-amd64.tar.gz
- rm go1.16.5.linux-amd64.tar.gz
- wget -q https://golang.org/dl/go1.17.6.linux-amd64.tar.gz
- tar -C /usr/local -xzf go1.17.6.linux-amd64.tar.gz
- rm go1.17.6.linux-amd64.tar.gz
- export PATH=$PATH:/usr/local/go/bin
- make cmd/agent/agent cmd/agentctl/agentctl cmd/agent-operator/agent-operator cmd/grafana-agent-crow/grafana-agent-crow
- make K8S_USE_DOCKER_NETWORK=1 DRONE=true BUILD_IN_CONTAINER=false test
Expand Down Expand Up @@ -79,10 +80,11 @@ steps:
commands:
- apt-get update && apt-get install -y rubygems rpm nsis
- gem install --no-document fpm
- rm -r /usr/local/go
- mkdir -p /usr/local/go/bin
- wget -q https://golang.org/dl/go1.16.5.linux-amd64.tar.gz
- tar -C /usr/local -xzf go1.16.5.linux-amd64.tar.gz
- rm go1.16.5.linux-amd64.tar.gz
- wget -q https://golang.org/dl/go1.17.6.linux-amd64.tar.gz
- tar -C /usr/local -xzf go1.17.6.linux-amd64.tar.gz
- rm go1.17.6.linux-amd64.tar.gz
- export PATH=$PATH:/usr/local/go/bin
- make DRONE=true BUILD_IN_CONTAINER=false dist
depends_on:
Expand Down Expand Up @@ -216,10 +218,11 @@ steps:
- apt-get update && apt-get install -y rubygems rpm nsis docker-ce docker-ce-cli containerd.io gettext
- docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
- gem install --no-document fpm
- rm -r /usr/local/go
- mkdir -p /usr/local/go/bin
- wget -q https://golang.org/dl/go1.16.5.linux-amd64.tar.gz
- tar -C /usr/local -xzf go1.16.5.linux-amd64.tar.gz
- rm go1.16.5.linux-amd64.tar.gz
- wget -q https://golang.org/dl/go1.17.6.linux-amd64.tar.gz
- tar -C /usr/local -xzf go1.17.6.linux-amd64.tar.gz
- rm go1.17.6.linux-amd64.tar.gz
- export PATH=$PATH:/usr/local/go/bin
- GO111MODULE=on go get -u github.com/mitchellh/gox github.com/tcnksm/ghr
- export PATH="$(go env GOPATH)/bin:$PATH"
Expand Down Expand Up @@ -249,6 +252,6 @@ get:
name: pat
---
kind: signature
hmac: c980a6def666f0ed942b1603eb75e30750cb9d67403ebd4dfd48e0960cc46a79
hmac: 87a9a23731884dac8e0b5c3ee0fa2b5cef9d7fa490fcad649f7783f6ea9d2d32

...
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
platform: [macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go 1.16
- name: Set up Go 1.17
uses: actions/setup-go@v1
with:
go-version: 1.16
go-version: 1.17.6
id: go
- name: Checkout code
uses: actions/checkout@v2
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Main (unreleased)

- [ENHANCEMENT] Go 1.17 is now used for all builds of the Agent. (@tpaschalis)

# v0.22.0 (2022-01-13)

This release has deprecations. Please read [DEPRECATION] entries and consult
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent-operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16-buster as build
FROM golang:1.17.6-buster as build
COPY . /src/agent
WORKDIR /src/agent
ARG RELEASE_BUILD=false
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16-buster as build
FROM golang:1.17.6-buster as build
COPY . /src/agent
WORKDIR /src/agent
ARG RELEASE_BUILD=true
Expand Down
4 changes: 2 additions & 2 deletions cmd/agent/Dockerfile.buildx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM

# Use custom Go version instead of one prepacked in seego
ENV GOLANG_VERSION 1.16
ENV GOLANG_VERSION 1.17.6
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA256 013a489ebb3e24ef3d915abe5b94c3286c070dfe0818d5bca8108f1d6e8440d2
ENV GOLANG_DOWNLOAD_SHA256 231654bbf2dab3d86c1619ce799e77b03d96f9b50770297c8f4dff8836fc8ca2
RUN rm -rf /usr/local/go \
&& curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
Expand Down
2 changes: 1 addition & 1 deletion cmd/agentctl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16-buster as build
FROM golang:1.17.6-buster as build
COPY . /src/agent
WORKDIR /src/agent
ARG RELEASE_BUILD=false
Expand Down
4 changes: 2 additions & 2 deletions cmd/agentctl/Dockerfile.buildx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM

# Use custom Go version instead of one prepacked in seego
ENV GOLANG_VERSION 1.16
ENV GOLANG_VERSION 1.17.6
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA256 013a489ebb3e24ef3d915abe5b94c3286c070dfe0818d5bca8108f1d6e8440d2
ENV GOLANG_DOWNLOAD_SHA256 231654bbf2dab3d86c1619ce799e77b03d96f9b50770297c8f4dff8836fc8ca2
RUN rm -rf /usr/local/go \
&& curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
Expand Down
2 changes: 1 addition & 1 deletion cmd/grafana-agent-crow/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16-buster as build
FROM golang:1.17.6-buster as build
COPY . /src/agent
WORKDIR /src/agent
ARG RELEASE_BUILD=true
Expand Down
4 changes: 2 additions & 2 deletions cmd/grafana-agent-crow/Dockerfile.buildx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM

# Use custom Go version instead of one prepacked in seego
ENV GOLANG_VERSION 1.16
ENV GOLANG_VERSION 1.17.6
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA256 013a489ebb3e24ef3d915abe5b94c3286c070dfe0818d5bca8108f1d6e8440d2
ENV GOLANG_DOWNLOAD_SHA256 231654bbf2dab3d86c1619ce799e77b03d96f9b50770297c8f4dff8836fc8ca2
RUN rm -rf /usr/local/go \
&& curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
Expand Down
Loading

0 comments on commit ca628c2

Please sign in to comment.