Skip to content

Commit

Permalink
chore: upgrade Go to 1.13.16
Browse files Browse the repository at this point in the history
Addresses some issues in net/http, scavenger potential panics, etc.

Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
smira committed Jan 13, 2020
1 parent 6ca79b2 commit b1b5672
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 98 deletions.
47 changes: 41 additions & 6 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
---
kind: secret
name: kubeconfig

get:
path: buildx
name: kubeconfig

---
kind: pipeline
name: default

services:
- name: docker
image: docker:19.03-dind
image: docker:19.03.3-dind
entrypoint:
- dockerd
command:
Expand All @@ -18,12 +26,29 @@ services:
path: /var/run

steps:
- name: setup-ci
image: autonomy/build-container:latest
commands:
- git fetch --tags
- apk add coreutils
- echo -e "$BUILDX_KUBECONFIG" > /root/.kube/config
- docker buildx create --driver kubernetes --driver-opt replicas=2 --driver-opt namespace=ci --driver-opt image=moby/buildkit:v0.6.2 --name ci --buildkitd-flags="--allow-insecure-entitlement security.insecure" --use
- docker buildx inspect --bootstrap
environment:
BUILDX_KUBECONFIG:
from_secret: kubeconfig
privileged: true
volumes:
- name: docker-socket
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube

- name: build-pull-request
image: autonomy/build-container:latest
pull: always
environment:
BINDIR: /usr/local/bin
BUILDKIT_HOST: ${BUILDKIT_HOST=tcp://buildkitd.ci.svc:1234}
commands:
- make
when:
Expand All @@ -33,6 +58,10 @@ steps:
volumes:
- name: docker-socket
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube

- name: build-and-publish
image: autonomy/build-container:latest
Expand All @@ -42,8 +71,6 @@ steps:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
BINDIR: /usr/local/bin
BUILDKIT_HOST: ${BUILDKIT_HOST=tcp://buildkitd.ci.svc:1234}
commands:
- docker login --username "$${DOCKER_USERNAME}" --password "$${DOCKER_PASSWORD}"
- make PUSH=true
Expand All @@ -54,10 +81,18 @@ steps:
volumes:
- name: docker-socket
path: /var/run
- name: docker
path: /root/.docker/buildx
- name: kube
path: /root/.kube

volumes:
- name: docker-socket
temp: {}
- name: docker
temp: {}
- name: kube
temp: {}
---
kind: pipeline
name: notify
Expand Down
124 changes: 35 additions & 89 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,92 +1,38 @@
BINDIR ?= ./bin

BUILDKIT_VERSION ?= v0.6.0
BUILDKIT_IMAGE ?= moby/buildkit:$(BUILDKIT_VERSION)
BUILDKIT_HOST ?= tcp://0.0.0.0:1234
BUILDKIT_CONTAINER_NAME ?= talos-buildkit
BUILDKIT_CONTAINER_STOPPED := $(shell docker ps --filter name=$(BUILDKIT_CONTAINER_NAME) --filter status=exited --format='{{.Names}}' 2>/dev/null)
BUILDKIT_CONTAINER_RUNNING := $(shell docker ps --filter name=$(BUILDKIT_CONTAINER_NAME) --filter status=running --format='{{.Names}}' 2>/dev/null)

UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
BUILDCTL_ARCHIVE := https://github.com/moby/buildkit/releases/download/$(BUILDKIT_VERSION)/buildkit-$(BUILDKIT_VERSION).linux-amd64.tar.gz
endif
ifeq ($(UNAME_S),Darwin)
BUILDCTL_ARCHIVE := https://github.com/moby/buildkit/releases/download/$(BUILDKIT_VERSION)/buildkit-$(BUILDKIT_VERSION).darwin-amd64.tar.gz
endif

ifeq ($(UNAME_S),Linux)
GITMETA := https://github.com/talos-systems/gitmeta/releases/download/v0.1.0-alpha.2/gitmeta-linux-amd64
endif
ifeq ($(UNAME_S),Darwin)
GITMETA := https://github.com/talos-systems/gitmeta/releases/download/v0.1.0-alpha.2/gitmeta-darwin-amd64
endif


COMMON_ARGS = --progress=auto
COMMON_ARGS += --frontend=dockerfile.v0
COMMON_ARGS += --local context=.
COMMON_ARGS += --local dockerfile=.
COMMON_ARGS += --opt filename=Pkgfile

ifeq ($(PUSH),true)
PUSH_ARGS = ,push=true
else
PUSH_ARGS =
endif

TAG ?= $(shell $(BINDIR)/gitmeta image tag)

all: ci tools

.PHONY: ci
ci: builddeps buildkitd

.PHONY: builddeps
builddeps: gitmeta buildctl

gitmeta: $(BINDIR)/gitmeta

$(BINDIR)/gitmeta:
@mkdir -p $(BINDIR)
@curl -L $(GITMETA) -o $(BINDIR)/gitmeta
@chmod +x $(BINDIR)/gitmeta

buildctl: $(BINDIR)/buildctl

$(BINDIR)/buildctl:
@mkdir -p $(BINDIR)
@curl -L $(BUILDCTL_ARCHIVE) | tar -zxf - -C $(BINDIR) --strip-components 1 bin/buildctl

.PHONY: buildkitd
buildkitd:
ifeq (tcp://0.0.0.0:1234,$(findstring tcp://0.0.0.0:1234,$(BUILDKIT_HOST)))
ifeq ($(BUILDKIT_CONTAINER_STOPPED),$(BUILDKIT_CONTAINER_NAME))
@echo "Removing exited talos-buildkit container"
@docker rm $(BUILDKIT_CONTAINER_NAME)
endif
ifneq ($(BUILDKIT_CONTAINER_RUNNING),$(BUILDKIT_CONTAINER_NAME))
@echo "Starting talos-buildkit container"
@docker run \
--name $(BUILDKIT_CONTAINER_NAME) \
-d \
--privileged \
-p 1234:1234 \
$(BUILDKIT_IMAGE) \
--addr $(BUILDKIT_HOST)
@echo "Wait for buildkitd to become available"
@sleep 5
endif
endif


.PHONY: tools
tools: buildkitd gitmeta
@$(BINDIR)/buildctl --addr $(BUILDKIT_HOST) \
build \
--opt target=$@ \
--output type=image,name=docker.io/autonomy/$@:$(TAG)$(PUSH_ARGS) \
$(COMMON_ARGS)
REGISTRY ?= docker.io
USERNAME ?= autonomy
SHA ?= $(shell git describe --match=none --always --abbrev=8 --dirty)
TAG ?= $(shell git describe --tag --always --dirty)
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
REGISTRY_AND_USERNAME := $(REGISTRY)/$(USERNAME)

BUILD := docker buildx build
PLATFORM ?= linux/amd64
PROGRESS ?= auto
PUSH ?= false
COMMON_ARGS := --file=Pkgfile
COMMON_ARGS += --progress=$(PROGRESS)
COMMON_ARGS += --platform=$(PLATFORM)

TARGETS = tools

all: $(TARGETS) ## Builds all known pkgs.

.PHONY: help
help: ## This help menu.
@grep -E '^[a-zA-Z%_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

target-%: ## Builds the specified target defined in the Dockerfile. The build result will only remain in the build cache.
@$(BUILD) \
--target=$* \
$(COMMON_ARGS) \
$(TARGET_ARGS) .

docker-%: ## Builds the specified target defined in the Dockerfile using the docker output type. The build result will be loaded into docker.
@$(MAKE) target-$* TARGET_ARGS="$(TARGET_ARGS)"

.PHONY: $(TARGETS)
$(TARGETS):
@$(MAKE) docker-$@ TARGET_ARGS="--tag=${REGISTRY}/${USERNAME}/$@:$(TAG) --push=$(PUSH)"

.PHONY: deps.png
deps.png:
Expand Down
6 changes: 3 additions & 3 deletions golang/golang/pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ dependencies:
- stage: golang-bootstrap
steps:
- sources:
- url: https://dl.google.com/go/go1.13.3.src.tar.gz
- url: https://dl.google.com/go/go1.13.6.src.tar.gz
destination: go.src.tar.gz
sha256: 4f7123044375d5c404280737fbd2d0b17064b66182a65919ffe20ffe8620e3df
sha512: 0999876f995a3d9189640ce15b496ab72a6273649d27acdc190c1d50b88ab8b7facaabfc832334911d178f0b9a645ea4169716ed5c593a7540b075e6901d51f2
sha256: aae5be954bdc40bcf8006eb77e8d8a5dde412722bc8effcdaf9772620d06420c
sha512: dffb6e06eea0b1541901dfbed8d28e8cc1eac3184dc40a19ed3637737df796a67a2e7170b228e1003d36b14e6f0f13bb8be9d2a702834a9c06228d1821659528

env:
GOROOT_BOOTSTRAP: '{{ .TOOLCHAIN }}/go_bootstrap'
Expand Down

0 comments on commit b1b5672

Please sign in to comment.