Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump go and modules #34

Merged
merged 4 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ on:
jobs:
check-style:
runs-on: ubuntu-latest
env:
GOFLAGS: "-buildvcs=false"
container:
image: golang:1.20.0-bullseye
image: golang:1.22.2-bookworm
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
Expand All @@ -23,7 +25,7 @@ jobs:
test:
runs-on: ubuntu-latest
container:
image: golang:1.20.0-bullseye
image: golang:1.22.2-bookworm
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
Expand Down
50 changes: 42 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
################################################################################

## Docker Build Versions
DOCKER_BUILD_IMAGE = golang:1.20
DOCKER_BUILD_IMAGE = golang:1.22
DOCKER_BASE_IMAGE = alpine:3.19

################################################################################
Expand All @@ -25,6 +25,10 @@ LOGRUS_VERSION := $(shell find go.mod -type f -exec cat {} + | grep ${LOGRUS_URL

LOGRUS_PATH := $(GOPATH)/pkg/mod/${LOGRUS_URL}\@${LOGRUS_VERSION}

# Tools
GOLANGCILINT_VER := v1.57.2
GOLANGCILINT := $(TOOLS_BIN_DIR)/$(GOLANGCILINT_BIN)

export GO111MODULE=on

all: check-style dist
Expand All @@ -35,12 +39,14 @@ check-style: govet lint
@echo Checking for style guide compliance

## Runs lint against all packages.
.PHONY: lint
lint:
@echo Running lint
env GO111MODULE=off $(GO) get -u golang.org/x/lint/golint
golint -set_exit_status ./...
@echo lint success
lint: $(GOPATH)/bin/golangci-lint
@echo Running golangci-lint
golangci-lint run ./...

## Runs lint against all packages for changes only
lint-changes: $(GOPATH)/bin/golangci-lint
@echo Running golangci-lint over changes only
golangci-lint run -n

## Runs govet against all packages.
.PHONY: vet
Expand Down Expand Up @@ -75,7 +81,7 @@ build: ## Build the elrond
echo "Unknown architecture $(ARCH)"; \
exit 1; \
fi; \
GOOS=linux CGO_ENABLED=0 $(GO) build -ldflags '$(LDFLAGS)' -gcflags all=-trimpath=$(PWD) -asmflags all=-trimpath=$(PWD) -a -installsuffix cgo -o ./build/_output/bin/elrond ./cmd/$(APP)
GOOS=linux CGO_ENABLED=0 $(GO) build -buildvcs=false -ldflags '$(LDFLAGS)' -gcflags all=-trimpath=$(PWD) -asmflags all=-trimpath=$(PWD) -a -installsuffix cgo -o ./build/_output/bin/elrond ./cmd/$(APP)

.PHONY: build-image
build-image: ## Build the docker image for Elrond
Expand Down Expand Up @@ -109,6 +115,26 @@ build-image-with-tag: ## Build the docker image for elrond
. -f build/Dockerfile -t $(ELROND_IMAGE) -t $(ELROND_IMAGE_REPO):${TAG} \
--push

.PHONY: build-image-locally
build-image-locally: ## Build the docker image for Elrond
@echo Building Elrond Docker Image
@if [ -z "$(DOCKER_USERNAME)" ] || [ -z "$(DOCKER_PASSWORD)" ]; then \
echo "DOCKER_USERNAME and/or DOCKER_PASSWORD not set. Skipping Docker login."; \
else \
echo $(DOCKER_PASSWORD) | docker login --username $(DOCKER_USERNAME) --password-stdin; \
fi
docker buildx build \
--platform linux/arm64 \
--build-arg DOCKER_BUILD_IMAGE=$(DOCKER_BUILD_IMAGE) \
--build-arg DOCKER_BASE_IMAGE=$(DOCKER_BASE_IMAGE) \
. -f build/Dockerfile -t $(ELROND_IMAGE) \
--no-cache \
--load

.PHONY: scan
scan:
docker scout cves $(ELROND_IMAGE)

.PHONY: push-image-pr
push-image-pr:
@echo Push Image PR
Expand Down Expand Up @@ -136,3 +162,11 @@ deps:
.PHONY: unittest
unittest:
$(GO) test ./... -v -covermode=count -coverprofile=coverage.out


## --------------------------------------
## Tooling Binaries
## --------------------------------------

$(GOPATH)/bin/golangci-lint: ## Install golangci-lint
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCILINT_VER)
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the Mattermost Elrond
ARG DOCKER_BUILD_IMAGE=golang:1.20
ARG DOCKER_BUILD_IMAGE=golang:1.22
ARG DOCKER_BASE_IMAGE=alpine:3.19

FROM --platform=${TARGETPLATFORM} ${DOCKER_BUILD_IMAGE} AS build
Expand Down
11 changes: 5 additions & 6 deletions cmd/elrond/ring_installation_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@ func init() {
ringInstallationGroupRegisterCmd.Flags().String("ring", "", "The id of the ring to register the installation groups.")
ringInstallationGroupRegisterCmd.Flags().String("provisioner-group-id", "", "The id of the provisioner group that will have 1to1 relationship with the elrond installation group.")
ringInstallationGroupRegisterCmd.Flags().Int("soak-time", 0, "The soak time to consider an installation group release stable.")
ringInstallationGroupRegisterCmd.MarkFlagRequired("ring")
ringInstallationGroupRegisterCmd.MarkFlagRequired("installation-group-name")
ringInstallationGroupRegisterCmd.MarkFlagRequired("provisioner-group-id")
_ = ringInstallationGroupRegisterCmd.MarkFlagRequired("ring")
_ = ringInstallationGroupRegisterCmd.MarkFlagRequired("installation-group-name")
_ = ringInstallationGroupRegisterCmd.MarkFlagRequired("provisioner-group-id")

ringInstallationGroupUpdateCmd.Flags().String("installation-group", "", "The id of the installation group to update.")
ringInstallationGroupUpdateCmd.Flags().String("name", "", "The name to set to the installation group.")
ringInstallationGroupUpdateCmd.Flags().String("provisioner-group-id", "", "The id of the provisioner group that will have 1to1 relationship with the elrond installation group.")
ringInstallationGroupUpdateCmd.Flags().Int("soak-time", 0, "The soak time to set to the installation group.")
ringInstallationGroupUpdateCmd.MarkFlagRequired("installation-group")

ringInstallationGroupDeleteCmd.Flags().String("installation-group", "", "ID of the installation group to be removed from the ring.")
ringInstallationGroupDeleteCmd.Flags().String("ring", "", "The id of the ring from which installation group should be removed.")
ringInstallationGroupDeleteCmd.MarkFlagRequired("ring")
ringInstallationGroupDeleteCmd.MarkFlagRequired("installation-group")
_ = ringInstallationGroupDeleteCmd.MarkFlagRequired("ring")
_ = ringInstallationGroupDeleteCmd.MarkFlagRequired("installation-group")

ringInstallationGroupCmd.AddCommand(ringInstallationGroupRegisterCmd)
ringInstallationGroupCmd.AddCommand(ringInstallationGroupUpdateCmd)
Expand Down
84 changes: 43 additions & 41 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
module github.com/mattermost/elrond

go 1.20
go 1.22

exclude github.com/mattn/go-sqlite3 v2.0.3+incompatible

require (
github.com/Masterminds/squirrel v1.5.4
github.com/blang/semver v3.5.1+incompatible
github.com/golang/mock v1.6.0
github.com/gorilla/mux v1.8.0
github.com/grafana/grafana-api-golang-client v0.23.0
github.com/gorilla/mux v1.8.1
github.com/grafana/grafana-api-golang-client v0.27.0
github.com/jmoiron/sqlx v1.3.5
github.com/lib/pq v1.10.9
github.com/mattermost/mattermost-cloud v0.48.0
github.com/mattn/go-sqlite3 v1.14.6
github.com/mattermost/mattermost-cloud v0.83.0
github.com/mattn/go-sqlite3 v1.14.22
github.com/olekukonko/tablewriter v0.0.5
github.com/pborman/uuid v1.2.1
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.15.1
github.com/prometheus/common v0.42.0
github.com/sirupsen/logrus v1.9.2
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
github.com/prometheus/client_golang v1.19.0
github.com/prometheus/common v0.52.3
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.9.0
)

replace (
Expand All @@ -31,20 +31,21 @@ replace (
)

require (
github.com/aws/aws-sdk-go v1.44.274 // indirect
github.com/aws/aws-sdk-go v1.51.22 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic v0.7.0 // indirect
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand All @@ -54,35 +55,36 @@ require (
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattermost/mattermost-operator v1.21.0-rc.1 // indirect
github.com/mattermost/mattermost-operator v1.21.0 // indirect
github.com/mattermost/rotator v0.2.1-0.20230830064954-61490ed26761 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/oauth2 v0.19.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.27.2 // indirect
k8s.io/apimachinery v0.27.2 // indirect
k8s.io/client-go v0.27.2 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230524182850-78281498afbb // indirect
k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect
sigs.k8s.io/controller-runtime v0.14.6 // indirect
k8s.io/api v0.29.4 // indirect
k8s.io/apimachinery v0.29.4 // indirect
k8s.io/client-go v1.5.2 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/kube-openapi v0.0.0-20240411171206-dc4e619f62f3 // indirect
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 // indirect
sigs.k8s.io/controller-runtime v0.17.3 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading
Loading