-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLOUDDEV-354: revert v2 changes from main
Revert "(CLOUDDEV-354): v2 init" This reverts commit f8a9b3d. Revert "(CLOUDDEV-354): floating ips" This reverts commit ee27f75. Revert "(CLOUDDEV-354): volumes" This reverts commit 2a25d09. Revert "(CLOUDDEV-354): instances" This reverts commit 504b32e. Revert "(CLOUDDEV-354): instances" This reverts commit ffa57bd. Revert "(CLOUDDEV-354): instances (refactor)" This reverts commit 9df89cb. Revert "(CLOUDDEV-354): loadbalancers" This reverts commit 5216655. Revert "(CLOUDDEV-354): listeners" This reverts commit 9bc209d. Revert "(CLOUDDEV-354): lb pools" This reverts commit c4f80a9. Revert "(CLOUDDEV-354): lb pool members" This reverts commit d7e162f. Revert "(CLOUDDEV-354): docs and examples" This reverts commit 252f540. Revert "(CLOUDDEV-354): fmt" This reverts commit 5d84d62. Revert "(CLOUDDEV-354): docs and examples" This reverts commit b3c3af0.
- Loading branch information
Aleksei Marashov
committed
Dec 18, 2023
1 parent
fdd756f
commit ed2f012
Showing
308 changed files
with
32,540 additions
and
5,683 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,34 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
branches: [ master, main ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.21.3 | ||
go-version: 1.20.2 | ||
|
||
- name: Linters | ||
run: make lint | ||
run: make linters | ||
|
||
- name: Tests | ||
run: make test | ||
- name: Build | ||
run: go build -v ./... | ||
|
||
- name: Tests data_source | ||
env: | ||
EC_USERNAME: ${{ secrets.EC_USERNAME }} | ||
EC_PASSWORD: ${{ secrets.EC_PASSWORD }} | ||
run: make test_cloud_data_source | ||
|
||
- name: Tests resource | ||
env: | ||
EC_USERNAME: ${{ secrets.EC_USERNAME }} | ||
EC_PASSWORD: ${{ secrets.EC_PASSWORD }} | ||
run: make test_cloud_resource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# This GitHub action can publish assets for release when a tag is created. | ||
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0). | ||
# | ||
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your | ||
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE` | ||
# secret. If you would rather own your own GPG handling, please fork this action | ||
# or use an alternative one for key handling. | ||
# | ||
# You will need to pass the `--batch` flag to `gpg` in your signing step | ||
# in `goreleaser` to indicate this is being used in a non-interactive mode. | ||
# | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Unshallow | ||
run: git fetch --prune --unshallow | ||
- | ||
name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.20.2 | ||
- | ||
name: Import GPG key | ||
id: import_gpg | ||
uses: crazy-max/ghaction-import-gpg@v5 | ||
with: | ||
# These secrets will need to be configured for the repository: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.PASSPHRASE }} | ||
- | ||
name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | ||
# # GitHub sets this automatically | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,60 @@ | ||
# Visit https://goreleaser.com for documentation on how to customize this | ||
# behavior. | ||
before: | ||
hooks: | ||
# this is just an example and not a requirement for provider building/publishing | ||
- go mod tidy | ||
builds: | ||
- skip: true | ||
- env: | ||
# goreleaser does not work with CGO, it could also complicate | ||
# usage by users in CI/CD systems like Terraform Cloud where | ||
# they are unable to install libraries. | ||
- CGO_ENABLED=0 | ||
mod_timestamp: '{{ .CommitTimestamp }}' | ||
flags: | ||
- -trimpath | ||
ldflags: | ||
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' | ||
goos: | ||
- freebsd | ||
- windows | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- '386' | ||
- arm | ||
- arm64 | ||
ignore: | ||
- goos: darwin | ||
goarch: '386' | ||
binary: '{{ .ProjectName }}_v{{ .Version }}' | ||
archives: | ||
- format: zip | ||
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' | ||
checksum: | ||
extra_files: | ||
- glob: 'terraform-registry-manifest.json' | ||
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' | ||
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' | ||
algorithm: sha256 | ||
signs: | ||
- artifacts: checksum | ||
args: | ||
# if you are using this in a GitHub action or some other automated pipeline, you | ||
# need to pass the batch flag to indicate its not interactive. | ||
- "--batch" | ||
- "--local-user" | ||
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key | ||
- "--output" | ||
- "${signature}" | ||
- "--detach-sign" | ||
- "${artifact}" | ||
release: | ||
extra_files: | ||
- glob: 'terraform-registry-manifest.json' | ||
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' | ||
# If you want to manually examine the release before its live, uncomment this line: | ||
# draft: true | ||
changelog: | ||
skip: true | ||
skip: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,98 @@ | ||
PROJECT_DIR=$(shell pwd) | ||
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor) | ||
BIN_DIR=$(PROJECT_DIR)/bin | ||
# ENVS | ||
ifeq ($(OS),Windows_NT) | ||
PROJECT_DIR = $(shell cd) | ||
OS := windows | ||
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64) | ||
ARCH := amd64 | ||
endif | ||
ifeq ($(PROCESSOR_ARCHITECTURE),x86) | ||
ARCH := 386 | ||
endif | ||
else | ||
PROJECT_DIR = $(shell pwd) | ||
OS := $(shell uname | tr '[:upper:]' '[:lower:]') | ||
ARCH := $(shell uname -m) | ||
endif | ||
BIN_DIR = $(PROJECT_DIR)/bin | ||
TEST_DIR = $(PROJECT_DIR)/edgecenter/test | ||
ENV_TESTS_FILE = $(TEST_DIR)/.env | ||
|
||
# BINARY | ||
BINARY_NAME=terraform-provider-edgecenter | ||
TAG_PREFIX="v" | ||
TAG=$(shell git describe --tags) | ||
VERSION=$(shell git describe --tags $(LAST_TAG_COMMIT) | sed "s/^$(TAG_PREFIX)//") | ||
PLUGIN_PATH=~/.terraform.d/plugins/local.edgecenter.ru/repo/edgecenter/$(VERSION)/$(OS)_$(ARCH) | ||
BINARY_NAME = terraform-provider-edgecenter | ||
TAG_PREFIX = "v" | ||
TAG = $(shell git describe --tags) | ||
VERSION = $(shell git describe --tags $(LAST_TAG_COMMIT) | sed "s/^$(TAG_PREFIX)//") | ||
PLUGIN_PATH = ~/.terraform.d/plugins/local.edgecenter.ru/repo/edgecenter/$(VERSION)/$(OS)_$(ARCH) | ||
|
||
.PHONY: tidy | ||
tidy: | ||
go mod tidy | ||
|
||
.PHONY: build | ||
build: fmtcheck | ||
# BUILD | ||
build: tidy | ||
mkdir -p $(PLUGIN_PATH) | ||
go build -o $(PLUGIN_PATH)/$(BINARY_NAME)_v$(VERSION) | ||
go build -o bin/$(BINARY_NAME) | ||
|
||
.PHONY: lint | ||
lint: | ||
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
@golangci-lint run -v ./... | ||
build_debug: tidy | ||
mkdir -p $(PLUGIN_PATH) | ||
go build -o $(PLUGIN_PATH)/$(BINARY_NAME)_v$(VERSION) -gcflags '-N -l' | ||
go build -o bin/$(BINARY_NAME) -gcflags '-N -l' | ||
|
||
# CHECKS | ||
err_check: | ||
@sh -c "'$(PROJECT_DIR)/scripts/errcheck.sh'" | ||
|
||
linters: | ||
@test -f $(BIN_DIR)/golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.54.2 | ||
@$(BIN_DIR)/golangci-lint run | ||
|
||
linters_docker: # for windows | ||
docker run --rm -v $(PROJECT_DIR):/app -w /app golangci/golangci-lint:v1.54.2 golangci-lint run -v | ||
|
||
# TESTS | ||
envs_reader: | ||
go install github.com/joho/godotenv/cmd/godotenv@latest | ||
|
||
test_cloud_data_source: envs_reader | ||
godotenv -f $(ENV_TESTS_FILE) go test $(TEST_DIR) -tags cloud_data_source -short -timeout=20m | ||
|
||
.PHONY: test | ||
test: | ||
go test -v -timeout=2m | ||
test_cloud_resource: envs_reader | ||
godotenv -f $(ENV_TESTS_FILE) go test $(TEST_DIR) -tags cloud_resource -short -timeout=20m | ||
|
||
fmt: | ||
gofmt -s -w $(GOFMT_FILES) | ||
test_not_cloud: envs_reader | ||
godotenv -f $(ENV_TESTS_FILE) go test $(TEST_DIR) -tags dns storage cdn -v -timeout=5m | ||
|
||
.PHONY: fmtcheck | ||
fmtcheck: | ||
@sh -c "'$(PROJECT_DIR)/scripts/gofmtcheck.sh'" | ||
# local test run (need to export VAULT_TOKEN env) | ||
install_jq: | ||
if test "$(OS)" = "linux"; then \ | ||
curl -L -o $(BIN_DIR)/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64; \ | ||
else \ | ||
curl -L -o $(BIN_DIR)/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64; \ | ||
fi | ||
chmod +x $(BIN_DIR)/jq | ||
|
||
install_vault: | ||
curl -L -o vault.zip https://releases.hashicorp.com/vault/1.13.3/vault_1.13.3_$(OS)_$(ARCH).zip | ||
unzip vault.zip && rm -f vault.zip && chmod +x vault | ||
mv vault $(BIN_DIR)/ | ||
|
||
download_env_file: envs_reader | ||
godotenv -f $(ENV_TESTS_FILE) $(BIN_DIR)/vault login -method=token $(VAULT_TOKEN) | ||
godotenv -f $(ENV_TESTS_FILE) $(BIN_DIR)/vault kv get -format=json --field data /CLOUD/terraform | $(BIN_DIR)/jq -r 'to_entries|map("\(.key)=\(.value)")|.[]' >> $(ENV_TESTS_FILE) | ||
|
||
test_local_data_source: envs_reader | ||
godotenv -f .local.env go test $(TEST_DIR) -tags cloud_data_source -short -timeout=5m -v | ||
|
||
test_local_resource: envs_reader | ||
godotenv -f .local.env go test $(TEST_DIR) -tags cloud_resource -short -timeout=10m -v | ||
|
||
# DOCS | ||
.PHONY: docs_fmt | ||
docs_fmt: | ||
terraform fmt -recursive ./examples/ | ||
|
||
.PHONY: docs | ||
docs: docs_fmt | ||
go get github.com/hashicorp/terraform-plugin-docs/cmd/[email protected] | ||
make tidy | ||
tfplugindocs --tf-version=1.6.5 --provider-name=edgecenter | ||
tfplugindocs --tf-version=1.5.0 --provider-name=edgecenter | ||
|
||
.PHONY: tidy build build_debug err_check linters linters_docker envs_reader test_cloud_data_source test_cloud_resource test_not_cloud install_jq install_vault download_env_file test_local_data_source test_local_resource docs_fmt docs |
Oops, something went wrong.