Skip to content

Commit

Permalink
Merge pull request #46 from m1so/no-fork
Browse files Browse the repository at this point in the history
Update provider to no-fork architecture
  • Loading branch information
sergenyalcin authored Dec 11, 2024
2 parents f6c7b1d + 5c9ccc9 commit 34a38bf
Show file tree
Hide file tree
Showing 793 changed files with 84,523 additions and 44,849 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ on:

env:
# Common versions
GO_VERSION: '1.20'
GOLANGCI_VERSION: 'v1.53.3'
GO_VERSION: '1.21'
GOLANGCI_VERSION: 'v1.61.0'
DOCKER_BUILDX_VERSION: 'v0.8.2'

# Common users. We can't run a step 'if secrets.XXX != ""' but we can run a
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
e2e:
uses: upbound/uptest/.github/workflows/pr-comment-trigger.yml@main
with:
go-version: '1.20'
go-version: '1.21'
secrets:
UPTEST_CLOUD_CREDENTIALS: "not used"
UPTEST_DATASOURCE: ${{ secrets.UPTEST_DATASOURCE }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
kubeconfig
vault-auto-unseal-keys.yaml

/.cache
/.work
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "build"]
path = build
url = https://github.com/upbound/build
url = https://github.com/crossplane/build
9 changes: 4 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@

run:
timeout: 60m
show-stats: true
concurrency: 3

output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: colored-line-number
print-linter-name: true
show-stats: true

linters-settings:
errcheck:
Expand Down Expand Up @@ -108,11 +106,12 @@ linters-settings:

linters:
enable:
- megacheck
- gosimple
- staticcheck
- unused
- govet
- gocyclo
- gocritic
- interfacer
- goconst
- goimports
- gofmt # We enable this as well as goimports for its simplify mode.
Expand Down
41 changes: 15 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export TERRAFORM_VERSION := 1.5.5

export TERRAFORM_PROVIDER_SOURCE ?= hashicorp/vault
export TERRAFORM_PROVIDER_REPO ?= https://github.com/hashicorp/terraform-provider-vault
export TERRAFORM_PROVIDER_VERSION ?= 3.25.0
export TERRAFORM_PROVIDER_VERSION ?= 4.4.0
export TERRAFORM_PROVIDER_DOWNLOAD_NAME ?= terraform-provider-vault
export TERRAFORM_DOCS_PATH ?= website/docs/r

Expand Down Expand Up @@ -37,7 +37,8 @@ NPROCS ?= 1
# to half the number of CPU cores.
GO_TEST_PARALLEL := $(shell echo $$(( $(NPROCS) / 2 )))

GO_REQUIRED_VERSION ?= 1.20
GO_REQUIRED_VERSION ?= 1.21
GOLANGCILINT_VERSION ?= 1.61.0
GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/provider $(GO_PROJECT)/cmd/generator
GO_LDFLAGS += -X $(GO_PROJECT)/internal/version.Version=$(VERSION)
GO_SUBDIRS += cmd internal apis
Expand Down Expand Up @@ -93,27 +94,7 @@ fallthrough: submodules
@make

# ====================================================================================
# Setup Terraform for fetching provider schema
TERRAFORM := $(TOOLS_HOST_DIR)/terraform-$(TERRAFORM_VERSION)
TERRAFORM_WORKDIR := $(WORK_DIR)/terraform
TERRAFORM_PROVIDER_SCHEMA := config/schema.json

$(TERRAFORM):
@$(INFO) installing terraform $(HOSTOS)-$(HOSTARCH)
@mkdir -p $(TOOLS_HOST_DIR)/tmp-terraform
@curl -fsSL https://releases.hashicorp.com/terraform/$(TERRAFORM_VERSION)/terraform_$(TERRAFORM_VERSION)_$(SAFEHOST_PLATFORM).zip -o $(TOOLS_HOST_DIR)/tmp-terraform/terraform.zip
@unzip $(TOOLS_HOST_DIR)/tmp-terraform/terraform.zip -d $(TOOLS_HOST_DIR)/tmp-terraform
@mv $(TOOLS_HOST_DIR)/tmp-terraform/terraform $(TERRAFORM)
@rm -fr $(TOOLS_HOST_DIR)/tmp-terraform
@$(OK) installing terraform $(HOSTOS)-$(HOSTARCH)

$(TERRAFORM_PROVIDER_SCHEMA): $(TERRAFORM)
@$(INFO) generating provider schema for $(TERRAFORM_PROVIDER_SOURCE) $(TERRAFORM_PROVIDER_VERSION)
@mkdir -p $(TERRAFORM_WORKDIR)
@echo '{"terraform":[{"required_providers":[{"provider":{"source":"'"$(TERRAFORM_PROVIDER_SOURCE)"'","version":"'"$(TERRAFORM_PROVIDER_VERSION)"'"}}],"required_version":"'"$(TERRAFORM_VERSION)"'"}]}' > $(TERRAFORM_WORKDIR)/main.tf.json
@$(TERRAFORM) -chdir=$(TERRAFORM_WORKDIR) init > $(TERRAFORM_WORKDIR)/terraform-logs.txt 2>&1
@$(TERRAFORM) -chdir=$(TERRAFORM_WORKDIR) providers schema -json=true > $(TERRAFORM_PROVIDER_SCHEMA) 2>> $(TERRAFORM_WORKDIR)/terraform-logs.txt
@$(OK) generating provider schema for $(TERRAFORM_PROVIDER_SOURCE) $(TERRAFORM_PROVIDER_VERSION)
# Download provider's documentation

pull-docs:
@if [ ! -d "$(WORK_DIR)/$(TERRAFORM_PROVIDER_SOURCE)" ]; then \
Expand All @@ -122,9 +103,9 @@ pull-docs:
fi
@git -C "$(WORK_DIR)/$(TERRAFORM_PROVIDER_SOURCE)" sparse-checkout set "$(TERRAFORM_DOCS_PATH)"

generate.init: $(TERRAFORM_PROVIDER_SCHEMA) pull-docs
generate.init: pull-docs

.PHONY: $(TERRAFORM_PROVIDER_SCHEMA) pull-docs
.PHONY: pull-docs
# ====================================================================================
# Targets

Expand Down Expand Up @@ -161,6 +142,7 @@ run: go.build
# End to End Testing
CROSSPLANE_NAMESPACE = upbound-system
-include build/makelib/local.xpkg.mk
-include build/makelib/local.mk
-include build/makelib/controlplane.mk

# This target requires the following environment
Expand All @@ -181,7 +163,14 @@ local-deploy: build controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME)

e2e: build controlplane.up local-deploy uptest

.PHONY: uptest e2e cobertura submodules fallthrough run crds.clean
vault.uninstall:
@$(INFO) uninstalling vault
helm uninstall vault -n vault
@$(KUBECTL) delete pvc -n vault --all
@$(KUBECTL) delete secret vault-auto-unseal-keys --ignore-not-found
@$(OK) uninstalled vault

.PHONY: uptest e2e cobertura submodules fallthrough run crds.clean vault.uninstall

# ====================================================================================
# Special Targets
Expand Down
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Provider Vault

`provider-vault` is a [Crossplane](https://crossplane.io/) provider that
is built using [Upjet](https://github.com/upbound/upjet) code
is built using [Upjet](https://github.com/crossplane/upjet) code
generation tools and exposes XRM-conformant managed resources for the
Vault API.

Expand Down Expand Up @@ -111,27 +111,34 @@ You can see the API reference [here](https://doc.crds.dev/github.com/upbound/pro

## Developing

Initialize the repository with
```bash
make submodules
```

Run code-generation pipeline:
```console
go run cmd/generator/main.go "$PWD"
```bash
make generate
```

Run against a Kubernetes cluster:

```console
```bash
make run
```

Build, push, and install:

```console
```bash
make all
```

Build binary:
Build binary, image and Crossplane package (xpkg):

```console
```bash
make build
# to build all architectures / platforms, use:
make -j2 build.all
```

## Report a Bug
Expand Down
13 changes: 13 additions & 0 deletions apis/ad/v1alpha1/zz_generated.conversion_hubs.go

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

62 changes: 31 additions & 31 deletions apis/ad/v1alpha1/zz_generated.deepcopy.go

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

Loading

0 comments on commit 34a38bf

Please sign in to comment.