Skip to content
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ARG OS
# Build the preflight binary
COPY . /go/src/preflight-trigger
WORKDIR /go/src/preflight-trigger
RUN make build
RUN make build RELEASE_TAG=${release_tag}


FROM registry.access.redhat.com/ubi9/ubi-micro:latest
Expand Down
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ export CONTAINER_ENGINE ?= podman
export BIN_NAME
export REGISTRY ?= quay.io
export REGISTRY_NAMESPACE ?= opdev
VERSION=$(shell git rev-parse HEAD)
export RELEASE_TAG ?= "0.0.0"


.PHONY: binary-build
binary-build:
$(CONTAINER_ENGINE) run --rm -v $(PWD):/usr/src/$(BIN_NAME) -w /usr/src/$(BIN_NAME) -e GOOS=linux -e GOARCH=amd64 docker.io/library/golang:alpine go build -o $(BIN_NAME)
$(CONTAINER_ENGINE) run --rm -v $(PWD):/usr/src/$(BIN_NAME) -w /usr/src/$(BIN_NAME) -e GOOS=linux -e GOARCH=amd64 docker.io/library/golang:alpine go build -ldflags "-X github.com/redhat-openshift-ecosystem/preflight-trigger/version.commit=$(VERSION) -X github.com/redhat-openshift-ecosystem/preflight-trigger/version.version=$(RELEASE_TAG)" -o $(BIN_NAME)

.PHONY: image-build
image-build:
Expand All @@ -25,7 +26,7 @@ image-push:

.PHONY: build
build:
CGO_ENABLED=0 go build -o $(BIN_NAME) main.go
CGO_ENABLED=0 go build -ldflags "-X github.com/redhat-openshift-ecosystem/preflight-trigger/version.commit=$(VERSION) -X github.com/redhat-openshift-ecosystem/preflight-trigger/version.version=$(RELEASE_TAG)" -o $(BIN_NAME) main.go
@ls | grep -e '^preflight-trigger$$' &> /dev/null

.PHONY: vet
Expand All @@ -46,12 +47,18 @@ fmt: gofumpt
lint: golangci-lint ## Run golangci-lint linter checks.
$(GOLANGCI_LINT) run

.PHONY: test
test:
go test -v $$(go list ./...) \
-ldflags "-X github.com/redhat-openshift-ecosystem/preflight-trigger/version.commit=bar -X github.com/redhat-openshift-ecosystem/preflight-trigger/version.version=foo"

.PHONY: cover
cover:
go test -v \
$$(go list ./...) \
-race \
-cover -coverprofile=coverage.out
$$(go list ./...) \
-ldflags "-X github.com/redhat-openshift-ecosystem/preflight-trigger/version.commit=bar -X github.com/redhat-openshift-ecosystem/preflight-trigger/version.version=foo" \
-race \
-cover -coverprofile=coverage.out

GOFUMPT = $(shell pwd)/bin/gofumpt
gofumpt: ## Download envtest-setup locally if necessary.
Expand Down
9 changes: 6 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (

"github.com/spf13/cobra"
configflagutil "sigs.k8s.io/prow/pkg/flagutil/config"

"github.com/redhat-openshift-ecosystem/preflight-trigger/version"
)

type FlagsData struct {
Expand Down Expand Up @@ -58,9 +60,10 @@ var CommandFlags FlagsData

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "preflight-trigger",
Short: "Create on-demand preflight jobs in openshift-ci system",
Long: ``,
Use: "preflight-trigger",
Short: "Create on-demand preflight jobs in openshift-ci system",
Long: ``,
Version: version.Version.String(),
}

// Execute adds all child commands to the root command and sets flags appropriately.
Expand Down
25 changes: 15 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ require (
github.com/ghodss/yaml v1.0.0
github.com/gobuffalo/envy v1.10.2
github.com/google/go-github/v56 v56.0.0
github.com/onsi/ginkgo/v2 v2.27.2
github.com/onsi/gomega v1.38.2
github.com/openshift/api v0.0.0-20251015135203-5d856d3e8354
github.com/spf13/afero v1.15.0
github.com/spf13/cobra v1.10.1
Expand All @@ -32,6 +34,7 @@ require (
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.48.1 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.1 // indirect
github.com/GoogleCloudPlatform/testgrid v0.0.123 // indirect
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/ProtonMail/go-crypto v1.3.0 // indirect
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f // indirect
github.com/andygrunwald/go-jira v1.17.0 // indirect
Expand Down Expand Up @@ -84,11 +87,12 @@ require (
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
Expand All @@ -99,7 +103,7 @@ require (
github.com/google/gnostic-models v0.7.0 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
github.com/google/s2a-go v0.1.9 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/google/wire v0.6.0 // indirect
Expand Down Expand Up @@ -156,24 +160,25 @@ require (
go.yaml.in/yaml/v3 v3.0.4 // indirect
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
gocloud.dev v0.40.0 // indirect
golang.org/x/crypto v0.39.0 // indirect
golang.org/x/crypto v0.45.0 // indirect
golang.org/x/exp v0.0.0-20250207012021-f9890c6ad9f3 // indirect
golang.org/x/mod v0.26.0 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/mod v0.29.0 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/oauth2 v0.27.0 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/term v0.32.0 // indirect
golang.org/x/text v0.28.0 // indirect
golang.org/x/sync v0.18.0 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/term v0.37.0 // indirect
golang.org/x/text v0.31.0 // indirect
golang.org/x/time v0.10.0 // indirect
golang.org/x/tools v0.38.0 // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/api v0.223.0 // indirect
google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/grpc v1.72.1 // indirect
google.golang.org/protobuf v1.36.6 // indirect
google.golang.org/protobuf v1.36.7 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand Down
Loading