Chore: Update Go version (#47914)

* Remove makefile (it's not used anymore)

* Directly download and install nodejs package

The Packages file for deb.nodesource.com/node_16.x doesn't list older
versions, so only the most recent version of nodejs is available. We
don't want to require every update to the build container to have to
update nodejs if a never version is available, so I manually download
the deb and install it with dpkg.

* Update Go version

* Update lib.star

* Generate new .drone.yml
This commit is contained in:
Emil Tullstedt 2022-04-20 09:14:12 +02:00 committed by GitHub
parent aa98123e72
commit 24038d9985
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 233 additions and 298 deletions

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ COPY emails emails
ENV NODE_ENV production
RUN yarn build
FROM golang:1.17.8-alpine3.15 as go-builder
FROM golang:1.17.9-alpine3.15 as go-builder
RUN apk add --no-cache gcc g++ make

View File

@ -21,7 +21,7 @@ COPY emails emails
ENV NODE_ENV production
RUN yarn build
FROM golang:1.17.8 AS go-builder
FROM golang:1.17.9 AS go-builder
WORKDIR /src/grafana

View File

@ -110,7 +110,7 @@ RUN rm dockerize-linux-amd64-v${DOCKERIZE_VERSION}.tar.gz
# Use old Debian (this has support into 2022) in order to ensure binary compatibility with older glibc's.
FROM debian:stretch-20210208
ENV GOVERSION=1.17.8 \
ENV GOVERSION=1.17.9 \
PATH=/usr/local/go/bin:$PATH \
GOPATH=/go \
NODEVERSION=16.14.0-1nodesource1 \
@ -147,8 +147,10 @@ RUN apt-get update && \
unzip && \
gem install -N fpm && \
ln -s /usr/bin/llvm-dsymutil-6.0 /usr/bin/dsymutil && \
curl -fsL https://deb.nodesource.com/setup_16.x | bash - && \
apt-get update && apt-get install -yq nodejs=${NODEVERSION} && \
curl -fsS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
curl -O https://deb.nodesource.com/node_16.x/pool/main/n/nodejs/nodejs_${NODEVERSION}_amd64.deb &&\
dpkg -i nodejs_${NODEVERSION}_amd64.deb &&\
rm nodejs_${NODEVERSION}_amd64.deb &&\
curl -fsS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -yq yarn=${YARNVERSION} && \

View File

@ -1,54 +0,0 @@
VERSION = dev
TAG = grafana/build-container
USER_ID = $(shell id -u)
GROUP_ID = $(shell id -g)
all: build deploy
build:
docker build -t "${TAG}:${VERSION}" .
deploy:
docker push "${TAG}:${VERSION}"
run:
docker run -ti \
-e "CIRCLE_BRANCH=local" \
-e "CIRCLE_BUILD_NUM=472" \
${TAG}:${VERSION} \
bash
run-with-local-source-live:
docker run -d \
-e "CIRCLE_BRANCH=local" \
-e "CIRCLE_BUILD_NUM=472" \
-w "/go/src/github.com/grafana/grafana" \
--name grafana-build \
-v "${GOPATH}/src/github.com/grafana/grafana:/go/src/github.com/grafana/grafana" \
${TAG}:${VERSION} \
bash -c "/tmp/bootstrap.sh; mkdir /.cache; chown "${USER_ID}:${GROUP_ID}" /.cache; tail -f /dev/null"
docker exec -ti --user "${USER_ID}:${GROUP_ID}" grafana-build bash
run-with-local-source-copy:
docker run -d \
-e "CIRCLE_BRANCH=local" \
-e "CIRCLE_BUILD_NUM=472" \
-w "/go/src/github.com/grafana/grafana" \
--name grafana-build \
${TAG}:${VERSION} \
bash -c "/tmp/bootstrap.sh; tail -f /dev/null"
docker cp "${GOPATH}/src/github.com/grafana/grafana" grafana-build:/go/src/github.com/grafana/
docker exec -ti grafana-build bash
update-source:
docker cp "${GOPATH}/src/github.com/grafana/grafana" grafana-build:/go/src/github.com/grafana/
attach:
docker exec -ti grafana-build bash
attach-live:
docker exec -ti --user "${USER_ID}:${GROUP_ID}" grafana-build bash
stop:
docker kill grafana-build
docker rm grafana-build

View File

@ -5,19 +5,6 @@ is in Dockerfile, but there are supporting scripts such as the Makefile, for bui
The image is based on Debian Stretch, since we want an older Linux distribution (Stretch has long-term support into 2022) to build binaries that are as portable as possible.
## Makefile targets
- `make run-with-local-source-copy`
- Starts the container locally and copies your local sources into the container
- `make run-with-local-source-live`
- Starts the container (as your user) locally and maps your Grafana project dir into the container
- `make update-source`
- Updates the sources in the container from your local sources
- `make stop`
- Kills the container
- `make attach`
- Opens bash within the running container
## Build/Publish Docker Image
In order to build and publish the Grafana build Docker image, execute the following:

View File

@ -1,7 +1,7 @@
load('scripts/drone/vault.star', 'from_secret', 'github_token', 'pull_secret', 'drone_token', 'prerelease_bucket')
grabpl_version = 'v2.9.37'
build_image = 'grafana/build-container:1.5.3'
grabpl_version = 'v2.9.41'
build_image = 'grafana/build-container:1.5.4'
publish_image = 'grafana/grafana-ci-deploy:1.3.1'
deploy_docker_image = 'us.gcr.io/kubernetes-dev/drone/plugins/deploy-image'
alpine_image = 'alpine:3.15'