Skip to content

Commit

Permalink
OCM-7828 | chore: update release process to goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
ciaranRoche committed May 20, 2024
1 parent 3596c43 commit f6b2777
Show file tree
Hide file tree
Showing 24 changed files with 910 additions and 213 deletions.
6 changes: 6 additions & 0 deletions .bingo/Variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ $(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
@echo "(re)installing $(GOBIN)/golangci-lint-v1.55.2"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.55.2 "github.com/golangci/golangci-lint/cmd/golangci-lint"

GORELEASER := $(GOBIN)/goreleaser-v1.25.1
$(GORELEASER): $(BINGO_DIR)/goreleaser.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/goreleaser-v1.25.1"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=goreleaser.mod -o=$(GOBIN)/goreleaser-v1.25.1 "github.com/goreleaser/goreleaser"

MOCKGEN := $(GOBIN)/mockgen-v0.4.0
$(MOCKGEN): $(BINGO_DIR)/mockgen.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
Expand Down
5 changes: 5 additions & 0 deletions .bingo/goreleaser.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.21.3

require github.com/goreleaser/goreleaser v1.25.1
737 changes: 737 additions & 0 deletions .bingo/goreleaser.sum

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .bingo/variables.env
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ GO_BINDATA="${GOBIN}/go-bindata-v3.1.2+incompatible"

GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.55.2"

GORELEASER="${GOBIN}/goreleaser-v1.25.1"

MOCKGEN="${GOBIN}/mockgen-v0.4.0"

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ docs/
.envrc
.env
cover.out
/temp
/temp
dist/
43 changes: 43 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: 1

before:
hooks:
- go generate ./...

builds:
- main: ./cmd/rosa
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
format_overrides:
- goos: windows
format: zip

release:
prerelease: auto
mode: append

changelog:
sort: asc
groups:
- title: Features
regexp: '^.*?(?:[a-zA-Z]+-\d+ \| )?feat(?:\([[:word:]]+\))??!?:.+'
order: 0
- title: "Bug fixes"
regexp: '^.*?(?:[a-zA-Z]+-\d+ \| )?fix(?:\([[:word:]]+\))??!?:.+'
order: 1
- title: Others
order: 999
54 changes: 44 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,23 @@ clean:
$(NULL)

.PHONY: generate
generate: $(GO_BINDATA)
generate: $(GO_BINDATA) mocks
$(GO_BINDATA) -nometadata -nocompress -pkg assets -o ./assets/bindata.go ./templates/...
go generate ./...

.PHONY: codecov
codecov: coverage
@./hack/codecov.sh

mocks: $(MOCKGEN)
$(MOCKGEN) --build_flags=--mod=mod -package mocks -destination=cmd/create/idp/mocks/identityprovider.go -source=cmd/create/idp/cmd.go IdentityProvider
$(MOCKGEN) -source=pkg/aws/api_interface/iam_api_client.go -package=mocks -destination=pkg/aws/mocks/mock_iam_api_client.go
$(MOCKGEN) -source=pkg/aws/api_interface/organizations_api_client.go -package=mocks -destination=pkg/aws/mocks/mock_organizations_api_client.go
$(MOCKGEN) -source=pkg/aws/api_interface/sts_api_client.go -package=mocks -destination=pkg/aws/mocks/mock_sts_api_client.go
$(MOCKGEN) -source=pkg/aws/api_interface/cloudformation_api_client.go -package=mocks -destination=pkg/aws/mocks/mock_cloudformation_api_client.go
$(MOCKGEN) -source=pkg/aws/api_interface/servicequotas_api_client.go -package=mocks -destination=pkg/aws/mocks/mock_servicequotas_api_client.go
$(MOCKGEN) -source=pkg/aws/api_interface/ec2_api_client.go -package=mocks -destination=pkg/aws/mocks/mock_ec2_api_client.go
$(MOCKGEN) -source=pkg/aws/api_interface/s3_api_client.go -package=mocks -destination=pkg/aws/mocks/mock_s3_api_client.go
$(MOCKGEN) -source=pkg/aws/api_interface/secretsmanager_api_client.go -package=mocks -destination=pkg/aws/mocks/mock_secretsmanager_api_client.go
$(MOCKGEN) -source=pkg/aws/api_interface/iam_api_client.go -package=mocks -destination=pkg/aws/mocks/iam_api_client_mock.go
$(MOCKGEN) -source=pkg/aws/api_interface/organizations_api_client.go -package=mocks -destination=pkg/aws/mocks/organizations_api_client_mock.go
$(MOCKGEN) -source=pkg/aws/api_interface/sts_api_client.go -package=mocks -destination=pkg/aws/mocks/sts_api_client_mock.go
$(MOCKGEN) -source=pkg/aws/api_interface/cloudformation_api_client.go -package=mocks -destination=pkg/aws/mocks/cloudformation_api_client_mock.go
$(MOCKGEN) -source=pkg/aws/api_interface/servicequotas_api_client.go -package=mocks -destination=pkg/aws/mocks/servicequotas_api_client_mock.go
$(MOCKGEN) -source=pkg/aws/api_interface/ec2_api_client.go -package=mocks -destination=pkg/aws/mocks/ec2_api_client_mock.go
$(MOCKGEN) -source=pkg/aws/api_interface/s3_api_client.go -package=mocks -destination=pkg/aws/mocks/s3_api_client_mock.go
$(MOCKGEN) -source=pkg/aws/api_interface/secretsmanager_api_client.go -package=mocks -destination=pkg/aws/mocks/secretsmanager_api_client_mock.go


.PHONY: e2e_test
Expand All @@ -111,3 +111,37 @@ e2e_test: install
-r \
--focus-file tests/e2e/.* \
$(NULL)

# verifies changes to .goreleaser.yaml
.PHONY: check-release-config
check-release-config:
$(GORELEASER) check

# builds a snap shot release in /dist
.PHONY: local-release
local-release:
$(GORELEASER) release --snapshot --clean

# builds and publishes a pre-release of changes from the last release tag
.PHONY: pre-release
prerelease:
$(GORELEASER) release --clean

# builds and publishes a latest release from tag set as env-ver GORELEASER_PREVIOUS_TAG
# leave GORELEASER_PREVIOUS_TAG empty to build from last release tag
.PHONY: release
release:
@if [ -n "$(GORELEASER_PREVIOUS_TAG)" ]; then \
read -p "GORELEASER_PREVIOUS_TAG is set to '$(GORELEASER_PREVIOUS_TAG)'. Is this the correct tag for the last release? (y/N) " confirm; \
if [ "$$confirm" != "y" ]; then \
echo "Aborting release."; \
exit 1; \
fi \
else \
read -p "GORELEASER_PREVIOUS_TAG is not set. Do you want to proceed with building and publishing the release from the last release tag? (y/N) " confirm; \
if [ "$$confirm" != "y" ]; then \
echo "Aborting release."; \
exit 1; \
fi \
fi; \
$(GORELEASER) release --snapshot --clean
1 change: 1 addition & 0 deletions cmd/create/idp/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (

const HTPasswdIDPName = "htpasswd"

//go:generate mockgen -source=cmd.go -package=mocks -destination=./mocks/identityprovider.go
type IdentityProvider interface {
Name() string
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 1 addition & 27 deletions hack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ These scripts help in the process of releasing new versions of `rosa`. For
full details on how to use these scripts in our release process, refer to our
[wiki](https://source.redhat.com/groups/public/ocm_team/ocm_wiki/rosa_release_process)

## release-build.sh

./hack/release-build.sh

This will build the binary versions of ROSA to be distributed as part of the release. The binaries built by this
script will be attached to the release in GitHub.

## release-list-jiras.sh

./hack/release-list-jiras.sh $release-version
Expand All @@ -27,24 +20,5 @@ Required parameters:
Example usage:

```shell
./hack/release-list-jiras.sh v1.2.35
./hack/release-list-jiras.sh v1.2.35 v1.2.34
```

## release-generate-changelog.sh

./hack/release-generate-changelog.sh $release_label $previous-version

**Note**: This script has a dependency on the [Jira CLI](https://github.com/ankitpokhrel/jira-cli/releases)

This script will generate a changelog that can be included in the release notes for the GitHub release.

Required parameters for this script are:

* `current-version`: The version of the current release used to fetch the fix version in JIRA
* `previous-version`: The previous version of ROSA released

Example usage:

```shell
./hack/release-generate-changelog.sh 1.2.35 1.2.34
```
71 changes: 0 additions & 71 deletions hack/release-build.sh

This file was deleted.

90 changes: 0 additions & 90 deletions hack/release-generate-changelog.sh

This file was deleted.

4 changes: 2 additions & 2 deletions pkg/aws/mock_client.go → pkg/aws/client_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f6b2777

Please sign in to comment.