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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ go.work.sum
# build output
dist/
_output/
bin/

# Editors
.vscode/
Expand Down
56 changes: 56 additions & 0 deletions .goreleaser.ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# GoReleaser v2 configuration for CI environments
# This configuration is optimized for CI builds without full Git history
version: 2

project_name: hypershift-oadp-plugin

# Git configuration for CI environments
git:
tag_sort: -version:refname

before:
hooks:
- go mod tidy
- go mod vendor

builds:
- id: default
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- amd64
- arm64
binary: hypershift-oadp-plugin-{{ .Os }}-{{ .Arch }}
main: ./main.go
ldflags:
- -s -w -extldflags "-static"
- -X github.com/openshift/hypershift-oadp-plugin/pkg/version.Version={{.Version}}
- -X github.com/openshift/hypershift-oadp-plugin/pkg/version.Commit={{.Commit}}
- -X github.com/openshift/hypershift-oadp-plugin/pkg/version.Date={{.Date}}

archives:
- id: default
name_template: "{{ .ProjectName }}_{{ .Version }}"
files:
- LICENSE
- README.md
- none*

checksum:
name_template: 'checksums.txt'
algorithm: sha256

# Skip changelog generation in CI to avoid Git history dependencies
changelog:
disable: true

# Configure snapshot mode for CI builds
snapshot:
version_template: "{{ incpatch .Version }}-snapshot"

# Skip release creation in CI
release:
disable: true
9 changes: 7 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# GoReleaser v2 configuration
version: 2

project_name: hypershift-oadp-plugin

before:
Expand All @@ -6,7 +9,8 @@ before:
- go mod vendor

builds:
- env:
- id: default
env:
- CGO_ENABLED=0
goos:
- linux
Expand All @@ -23,7 +27,8 @@ builds:
- -X github.com/openshift/hypershift-oadp-plugin/pkg/version.Date={{.Date}}

archives:
- name_template: "{{ .ProjectName }}_{{ .Version }}"
- id: default
name_template: "{{ .ProjectName }}_{{ .Version }}"
files:
- LICENSE
- README.md
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM registry.ci.openshift.org/openshift/release:rhel-9-release-golang-1.23-openshift-4.19 AS build
FROM registry.ci.openshift.org/openshift/release:rhel-9-release-golang-1.24-openshift-4.20 AS build
WORKDIR /go/src/github.com/openshift/hypershift-oadp-plugin
COPY . .
RUN CGO_ENABLED=0 go build -o /go/bin/hypershift-oadp-plugin .

FROM registry.access.redhat.com/ubi9-minimal
FROM registry.access.redhat.com/ubi9-minimal
RUN mkdir /plugins
COPY --from=build /go/bin/hypershift-oadp-plugin /plugins/
USER 65532:65532
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.oadp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#@follow_tag(registry-proxy.engineering.redhat.com/rh-osbs/openshift-golang-builder:rhel_9_golang_1.23)
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_golang_1.23 AS builder
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_golang_1.24 AS builder

COPY . /workspace
WORKDIR /workspace/
Expand Down
37 changes: 27 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,27 @@ GO=GO111MODULE=on GOWORK=off GOFLAGS=-mod=vendor go

.PHONY: install-goreleaser
install-goreleaser:
## Latest version of goreleaser v1. V2 requires go 1.24+
@echo "Installing goreleaser..."
@GOFLAGS= go install github.com/goreleaser/[email protected]
## Using goreleaser v2 compatible with go 1.24
@echo "Installing goreleaser v2..."
@mkdir -p ./bin
@GOBIN=$(PWD)/bin GOFLAGS= go install github.com/goreleaser/goreleaser/v2@latest
@echo "Goreleaser installed successfully!"

.PHONY: local
local: verify install-goreleaser build-dirs
goreleaser build --snapshot --clean
./bin/goreleaser build --snapshot --clean
@mkdir -p dist/$(BIN)_$(VERSION)
@mv dist/$(BIN)_*/* dist/$(BIN)_$(VERSION)/
@rm -rf dist/$(BIN)_darwin_* dist/$(BIN)_linux_*
@find dist/default_*/ -name "$(BIN)-*" -exec cp {} dist/$(BIN)_$(VERSION)/ \;
@echo "Binaries copied to dist/$(BIN)_$(VERSION)/"
@ls -la dist/$(BIN)_$(VERSION)/

.PHONY: release
release: verify install-goreleaser
goreleaser release --clean
./bin/goreleaser release --clean

.PHONY: release-local
release-local: verify install-goreleaser build-dirs
GORELEASER_CURRENT_TAG=$(VERSION) goreleaser build --clean
GORELEASER_CURRENT_TAG=$(VERSION) ./bin/goreleaser build --clean

.PHONY: tests
test:
Expand All @@ -56,8 +58,23 @@ cover:
deps:
$(GO) mod tidy && $(GO) mod vendor

.PHONY: update-deps
update-deps:
@echo "Running dependency update script..."
$(GO) run scripts/update-dependencies.go

.PHONY: verify
verify: verify-modules test
verify: verify-modules test verify-goreleaser

.PHONY: verify-goreleaser
verify-goreleaser: install-goreleaser
@echo "Verifying GoReleaser CI configuration..."
./bin/goreleaser check --config .goreleaser.ci.yaml

.PHONY: verify-goreleaser-dev
verify-goreleaser-dev: install-goreleaser
@echo "Verifying GoReleaser development configuration..."
./bin/goreleaser check

.PHONY: docker-build
docker-build:
Expand All @@ -82,4 +99,4 @@ build-dirs:
.PHONY: clean
clean:
@echo "cleaning"
rm -rf _output dist
rm -rf _output dist bin
60 changes: 59 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,62 @@ For detailed technical documentation and implementation guides, please refer to
- **[AWS Examples](./examples/AWS/)** - Complete examples for AWS platform including backup, restore, and configuration files
- **[BareMetal Examples](./examples/BareMetal/)** - Examples for bare metal deployments
- **[KubeVirt Examples](./examples/kubevirt/)** - Examples for KubeVirt platform
- **[OpenStack Examples](./examples/Openstack/)** - Examples for OpenStack platform
- **[OpenStack Examples](./examples/Openstack/)** - Examples for OpenStack platform

## Development

### Dependency Management

This project includes automated dependency validation to ensure compatibility with upstream dependencies. The validation is performed through integration tests located in `tests/integration/dependencies/`.

#### Dependency Validation Test

The dependency validation test (`dependencies_test.go`) automatically checks that watched dependencies are up-to-date with their respective upstream main branches. This helps prevent:
- Schema-related compatibility issues
- API version mismatches
- Runtime errors due to outdated dependencies

Currently watched dependencies:
- `github.com/openshift/hypershift/api` - Core HyperShift API definitions

#### Updating Dependencies

If the dependency validation test fails, you can update all watched dependencies automatically using:

```bash
make update-deps
```

This command will:
1. Parse the watched dependencies from the test file
2. Update each dependency to the latest commit from the main branch
3. Run `go mod tidy` and `go mod vendor` to clean up the dependency tree
4. Provide detailed output about which dependencies were updated

#### Manual Dependency Updates

For manual dependency updates, you can also run:

```bash
# Update a specific dependency
go get github.com/openshift/hypershift/api@main

# Clean up and vendor dependencies
go mod tidy && go mod vendor
```

#### Adding New Watched Dependencies

To add a new dependency to the validation process:

1. Add the dependency to the `watchedDependencies` map in `tests/integration/dependencies/dependencies_test.go`
2. The format is: `"module-path": "upstream-repo-url"`
3. The update script will automatically discover and update the new dependency

Example:
```go
var watchedDependencies = map[string]string{
"github.com/openshift/hypershift/api": "https://github.com/openshift/hypershift",
"github.com/example/new-module": "https://github.com/example/repo",
}
```
74 changes: 37 additions & 37 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
module github.com/openshift/hypershift-oadp-plugin

go 1.23.0

toolchain go1.23.6
go 1.24.4

require (
github.com/kubernetes-csi/external-snapshotter/client/v8 v8.2.0
github.com/onsi/gomega v1.35.1
github.com/onsi/gomega v1.38.0
github.com/openshift/hive/apis v0.0.0-20241220022629-3f49f26197ff
github.com/openshift/hypershift/api v0.0.0-20250108163049-830af0531d12
github.com/openshift/hypershift/api v0.0.0-20251027193323-9e76b0a736a8
github.com/sirupsen/logrus v1.9.3
github.com/vmware-tanzu/velero v1.14.0
k8s.io/api v0.32.3
k8s.io/apiextensions-apiserver v0.31.3
sigs.k8s.io/controller-runtime v0.19.3
k8s.io/apiextensions-apiserver v0.32.3
sigs.k8s.io/controller-runtime v0.20.4
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/gnostic-models v0.6.9 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/kubernetes-csi/external-snapshotter/client/v7 v7.0.0 // indirect
github.com/openshift/api v0.0.0-20250418132733-f636181788a9 // indirect
github.com/openshift/api v0.0.0-20250609083529-2b129d95495e // indirect
github.com/openshift/custom-resource-status v1.1.3-0.20220503160415-f2fdb4999d87 // indirect
github.com/prometheus/client_golang v1.20.5 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/prometheus/client_golang v1.22.0 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.65.0 // indirect
github.com/prometheus/procfs v0.16.1 // indirect
github.com/x448/float16 v0.8.4 // indirect
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
golang.org/x/sync v0.16.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
)

require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.2 // indirect
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.20.4 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-openapi/jsonpointer v0.21.1 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.1 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
Expand All @@ -56,7 +56,7 @@ require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mailru/easyjson v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
Expand All @@ -65,26 +65,26 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace // indirect
golang.org/x/net v0.38.0 // indirect
golang.org/x/oauth2 v0.27.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/term v0.30.0 // indirect
golang.org/x/text v0.23.0 // indirect
golang.org/x/time v0.9.0 // indirect
github.com/spf13/cobra v1.9.1 // indirect
github.com/spf13/pflag v1.0.7 // indirect
golang.org/x/net v0.42.0 // indirect
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/term v0.34.0 // indirect
golang.org/x/text v0.28.0 // indirect
golang.org/x/time v0.11.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect
google.golang.org/grpc v1.69.4 // indirect
google.golang.org/protobuf v1.36.3 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apimachinery v0.32.3
k8s.io/client-go v0.32.3
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
k8s.io/utils v0.0.0-20250321185631-1f6e0b77f77e
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

Expand Down
Loading