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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump github.com/spf13/viper from 1.16.0 to 1.18.1 #52

Merged
merged 3 commits into from
Dec 13, 2023
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: 1.18
go-version: 1.19

- name: Lint
run: |
Expand Down
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@
ARG GO_VERSION
ARG SLE_VERSION
FROM artifactory.algol60.net/csm-docker/stable/csm-docker-sle-go:${GO_VERSION} as builder
ARG GOARCH
ARG GOOS
WORKDIR /workspace
COPY . ./

RUN CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64 \
GOOS=$GOOS \
GOARCH=$GOARCH \
GO111MODULE=on \
make build
make bin/basecamp

FROM artifactory.algol60.net/csm-docker/stable/docker.io/library/alpine:3.15
WORKDIR /app
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile.github
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pipeline {

steps {
runLibraryScript("addRpmMetaData.sh", "${env.NAME}.spec")
sh "make prepare"
sh "make rpm_prepare"
sh "git update-index --assume-unchanged ${env.NAME}.spec"
}
}
Expand Down
65 changes: 35 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,31 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
SHELL := /bin/bash -o pipefail
lc =$(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))

ifeq ($(NAME),)
NAME := $(shell basename $(shell pwd))
export NAME := $(shell basename $(shell pwd))
endif

ifeq ($(IMAGE_VERSION),)
IMAGE_VERSION := $(shell git describe --tags | tr -s '-' '_' | sed 's/^v//')
ifeq ($(ARCH),)
export ARCH := $(shell uname -m)
endif

ifeq ($(VERSION),)
VERSION := $(shell git describe --tags | tr -s '-' '~' | sed 's/^v//')
export VERSION := $(shell git describe --tags | tr -s '-' '~' | tr -d '^v')
endif

ifeq ($(GO_VERSION),)
GO_VERSION := $(shell awk -v replace="'" '/goVersion/{gsub(replace,"", $$NF); print $$NF; exit}' Jenkinsfile.github)
# By default, if these are not set then set them to match the host.
ifeq ($(GOOS),)
OS := $(shell uname)
export GOOS := $(call lc,$(OS))
endif

ifeq ($(SLE_VERSION),)
SLE_VERSION := $(shell awk -v replace="'" '/mainSleVersion/{gsub(replace,"", $$NF); print $$NF; exit}' Jenkinsfile.github)
ifeq ($(GOARCH),)
ifeq "$(ARCH)" "aarch64"
export GOARCH=arm64
else ifeq "$(ARCH)" "x86_64"
export GOARCH=amd64
endif
endif

GO_FILES?=$$(find . -name '*.go' |grep -v vendor)
Expand All @@ -51,12 +57,11 @@ TAG?=latest
.BUILDTIME=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
CHANGELOG_VERSION_ORIG=$(grep -m1 \## CHANGELOG.MD | sed -e "s/\].*\$//" |sed -e "s/^.*\[//")
CHANGELOG_VERSION=$(shell grep -m1 \ \[[0-9]*.[0-9]*.[0-9]*\] CHANGELOG.MD | sed -e "s/\].*$$//" |sed -e "s/^.*\[//")
TEST_OUTPUT_DIR ?= $(CURDIR)/build/results
BUILD_DIR ?= $(PWD)/dist/rpmbuild
SPEC_FILE := ${NAME}.spec
SOURCE_NAME := ${NAME}-${VERSION}

BUILD_DIR ?= $(PWD)/dist/rpmbuild
SOURCE_PATH := ${BUILD_DIR}/SOURCES/${SOURCE_NAME}.tar.bz2
TEST_OUTPUT_DIR ?= $(CURDIR)/build/results


# if we're an automated build, use .GIT_COMMIT_AND_BRANCH as-is, else add '-dirty'
Expand All @@ -79,14 +84,14 @@ endif
fmt \
tidy \
env \
build \
rpm \
doc \
version
version \
image

all: fmt lint build
all: bin/basecamp

rpm: prepare rpm_package_source rpm_build_source rpm_build
rpm: rpm_prepare rpm_package_source rpm_build_source rpm_build

help:
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
Expand All @@ -106,16 +111,19 @@ help:
@echo ' rpm Build a YUM/SUSE RPM.'
@echo ' doc Start Go documentation server on port 8080.'
@echo ' version Display Go version.'
@echo ' image Build Docker image.'
@echo ''

clean:
go clean -i ./...
rm -vf \
$(CURDIR)/build/results/coverage/* \
$(CURDIR)/build/results/coverage/* \
$(CURDIR)/build/results/unittest/* \
$(RM) -rf $(BUILD_DIR)
$(RM) -rf \
bin \
$(BUILD_DIR)

test: build
test: tools
mkdir -pv $(TEST_OUTPUT_DIR)/unittest $(TEST_OUTPUT_DIR)/coverage
go test ./cmd/... ./internal/... -v -coverprofile $(TEST_OUTPUT_DIR)/coverage.out -covermode count | tee "$(TEST_OUTPUT_DIR)/testing.out"
cat "$(TEST_OUTPUT_DIR)/testing.out" | go-junit-report | tee "$(TEST_OUTPUT_DIR)/unittest/testing.xml" | tee "$(TEST_OUTPUT_DIR)/unittest/testing.xml"
Expand All @@ -130,7 +138,7 @@ tools:
vet: version
go vet -v ./...

lint:
lint: tools
golint -set_exit_status ./cmd/...
golint -set_exit_status ./internal/...

Expand All @@ -143,25 +151,22 @@ env:
tidy:
go mod tidy

build: fmt vet
go build -o bin/basecamp ./cmd/main.go
bin/basecamp:
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o bin/basecamp ./cmd/main.go

prepare:
rpm_prepare:
rm -rf $(BUILD_DIR)
mkdir -p $(BUILD_DIR)/SPECS $(BUILD_DIR)/SOURCES
cp $(SPEC_FILE) $(BUILD_DIR)/SPECS/

# touch the archive before creating it to prevent 'tar: .: file changed as we read it' errors
rpm_package_source:
touch $(SOURCE_PATH)
tar --transform 'flags=r;s,^,/$(SOURCE_NAME)/,' --exclude .nox --exclude dist/rpmbuild --exclude ${SOURCE_NAME}.tar.bz2 -cvjf $(SOURCE_PATH) .
tar --transform 'flags=r;s,^,/$(SOURCE_NAME)/,' --exclude .git --exclude dist -cvjf $(SOURCE_PATH) .

rpm_build_source:
rpmbuild -bs $(BUILD_DIR)/SPECS/$(SPEC_FILE) --target ${ARCH} --define "_topdir $(BUILD_DIR)"
rpmbuild --nodeps --target $(ARCH) -ts $(SOURCE_PATH) --define "_topdir $(BUILD_DIR)"

rpm_build:
rpmbuild -ba $(BUILD_DIR)/SPECS/$(SPEC_FILE) --target ${ARCH} --define "_topdir $(BUILD_DIR)"

rpmbuild --nodeps --target $(ARCH) -ba $(SPEC_FILE) --define "_topdir $(BUILD_DIR)"

doc:
godoc -http=:8080 -index
Expand All @@ -170,4 +175,4 @@ version:
@go version

image:
docker build --pull ${DOCKER_ARGS} --build-arg SLE_VERSION='${SLE_VERSION}' --build-arg GO_VERSION='${GO_VERSION}' --tag '${NAME}:${IMAGE_VERSION}' .
docker build --pull ${DOCKER_ARGS} --build-arg SLE_VERSION='${SLE_VERSION}' --build-arg GO_VERSION='${GO_VERSION}' --build-arg GOARCH='${GOARCH}' --build-arg GOOS='${GOOS}' --tag '${NAME}:${IMAGE_VERSION}' .
29 changes: 17 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ require (
github.com/gin-gonic/gin v1.9.1
github.com/mostlygeek/arp v0.0.0-20170424181311-541a2129847a
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.16.0
github.com/spf13/viper v1.18.1
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/bytedance/sonic v1.9.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
Expand All @@ -27,19 +27,24 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Expand Down
Loading