Skip to content

chore: upgrade and cleanup #108

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

Merged
merged 1 commit into from
Jan 15, 2025
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
21 changes: 5 additions & 16 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,63 @@
version: 2
env:
- GO111MODULE=on
- CGO_ENABLED=0
before:
hooks:
- go mod download

builds:
- id: jx-build-controller
# Path to main.go file or main package.
# Default is `.`.
main: ./cmd/main.go

# Binary name.
# Can be a path (e.g. `bin/app`) to wrap the binary in a directory.
# Default is the name of the project directory.
binary: jx-build-controller

# Custom ldflags templates.
# Default is `-s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} -X main.builtBy=goreleaser`.
ldflags:
- -X "github.com/jenkins-x-plugins/jx-build-controller/pkg/version.Version={{.Env.VERSION}}" -X "{{.Env.ROOTPACKAGE}}/pkg/version.Version={{.Env.VERSION}}" -X "{{.Env.ROOTPACKAGE}}/pkg/version.Revision={{.Env.REV}}" -X "{{.Env.ROOTPACKAGE}}/pkg/version.Branch={{.Env.BRANCH}}" -X "{{.Env.ROOTPACKAGE}}/pkg/version.BuildDate={{.Env.BUILDDATE}}" -X "{{.Env.ROOTPACKAGE}}/pkg/version.GoVersion={{.Env.GOVERSION}}"

# GOOS list to build for.
# For more info refer to: https://golang.org/doc/install/source#environment
# Defaults are darwin and linux.
goos:
- windows
- darwin
- linux

# GOARCH to build for.
# For more info refer to: https://golang.org/doc/install/source#environment
# Defaults are 386 and amd64.
goarch:
- amd64
- arm
- arm64

ignore:
- goos: windows
goarch: arm64
archives:
- name_template: "jx-build-controller-{{ .Os }}-{{ .Arch }}"
format_overrides:
- goos: windows
format: zip

checksum:
# You can change the name of the checksums file.
# Default is `jx-build-controller_{{ .Version }}_checksums.txt`.
name_template: "jx-build-controller-checksums.txt"

# Algorithm to be used.
# Accepted options are sha256, sha512, sha1, crc32, md5, sha224 and sha384.
# Default is sha256.
algorithm: sha256

changelog:
# set it to true if you wish to skip the changelog generation
skip: true

disable: true
release:
# If set to true, will not auto-publish the release.
# Default is false.
draft: false

# If set to auto, will mark the release as not ready for production
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
# If set to true, will mark the release as not ready for production.
# Default is false.
prerelease: false

# You can change the name of the GitHub release.
# Default is `{{.Tag}}`
name_template: "{{.Env.VERSION}}"

15 changes: 2 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ ROOT_PACKAGE := github.com/$(ORG_REPO)
# This does not reflect the go binary version which was used to build the jx binary, and also does not reflect the version in the catalog.
# The sole purpose of this variable is to build a new binary if we ever need to build a new jx binary with a new go version with no code change.
# If you notice that this version is not the same as the catalog version, please open a PR, the maintainers are happy to review it.
DUMMY_GO_VERSION := 1.18.6

GO_VERSION := $(shell $(GO) version | sed -e 's/^[^0-9.]*\([0-9.]*\).*/\1/')
DUMMY_GO_VERSION := 1.23.3

GO_DEPENDENCIES := $(call rwildcard,pkg/,*.go) $(call rwildcard,cmd/j,*.go)

Expand All @@ -40,13 +38,7 @@ VERSION ?= $(shell echo "$$(git for-each-ref refs/tags/ --count=1 --sort=-versio
#BUILD_TIME_CONFIG_FLAGS ?= ""

# Full build flags used when building binaries. Not used for test compilation/execution.
BUILDFLAGS := -ldflags \
" -X $(ROOT_PACKAGE)/pkg/version.Version=$(VERSION)\
-X $(ROOT_PACKAGE)/pkg/version.Revision='$(REV)'\
-X $(ROOT_PACKAGE)/pkg/version.Branch='$(BRANCH)'\
-X $(ROOT_PACKAGE)/pkg/version.BuildDate='$(BUILD_DATE)'\
-X $(ROOT_PACKAGE)/pkg/version.GoVersion='$(GO_VERSION)'\
$(BUILD_TIME_CONFIG_FLAGS)"
BUILDFLAGS := -ldflags "$(BUILD_TIME_CONFIG_FLAGS)"

# Some tests expect default values for version.*, so just use the config package values there.
TEST_BUILDFLAGS := -ldflags "$(BUILD_TIME_CONFIG_FLAGS)"
Expand Down Expand Up @@ -140,9 +132,6 @@ release: clean linux test

release-all: release linux win darwin

.PHONY: goreleaser
goreleaser:
step-go-releaser --organisation=$(ORG) --revision=$(REV) --branch=$(BRANCH) --build-date=$(BUILD_DATE) --go-version=$(GO_VERSION) --root-package=$(ROOT_PACKAGE) --version=$(VERSION)

.PHONY: clean
clean: ## Clean the generated artifacts
Expand Down
10 changes: 0 additions & 10 deletions charts/jx-build-controller/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,3 @@ clean:
rm -rf charts
rm -rf ${NAME}*.tgz

release: clean
sed -i -e "s/version:.*/version: $(VERSION)/" Chart.yaml
sed -i -e "s/tag:.*/tag: $(VERSION)/" values.yaml

helm dependency build
helm lint
helm package .
helm repo add jx $(CHART_REPO)
helm gcs push ${NAME}*.tgz jx --public
rm -rf ${NAME}*.tgz%
1 change: 1 addition & 0 deletions cmd/app/main-win.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build windows
// +build windows

package app
Expand Down
1 change: 1 addition & 0 deletions cmd/app/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows

package app
Expand Down
2 changes: 1 addition & 1 deletion cmd/docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion cmd/docs/md_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
Loading