Skip to content

Commit

Permalink
Merge pull request #1 from enthought/initial-pr
Browse files Browse the repository at this point in the history
Initial PR
  • Loading branch information
ddebeau authored Aug 5, 2024
2 parents 18b6f67 + 61d62e1 commit a22a137
Show file tree
Hide file tree
Showing 197 changed files with 73,497 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Modifications copyright (c) Enthought, Inc.
# SPDX-License-Identifier: BSD-3-Clause

# See GitHub's documentation for more information on this file:
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Modifications copyright (c) Enthought, Inc.
# SPDX-License-Identifier: BSD-3-Clause

# Terraform Provider release workflow.
name: Release

# This GitHub action creates a release when a tag that matches the pattern
# "v*" (e.g. v0.1.0) is created.
on:
push:
tags:
- 'v*'

# Releases need permissions to read and write the repository contents.
# GitHub considers creating releases and uploading assets as writing contents.
permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
args: release --clean
env:
# GitHub sets the GITHUB_TOKEN secret automatically.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
41 changes: 41 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Modifications copyright (c) Enthought, Inc.
# SPDX-License-Identifier: BSD-3-Clause

# Terraform Provider testing workflow.
name: Tests

# This GitHub action runs your tests for each pull request and push.
# Optionally, you can turn it on using a schedule for regular testing.
on:
pull_request:
paths-ignore:
- 'README.md'
push:
paths-ignore:
- 'README.md'

# Testing only needs permissions to read the repository contents.
permissions:
contents: read

jobs:
# Ensure project builds before running testing matrix
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
with:
version: latest
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
**/terraform.tfstate
**/terraform.tfstate.*
33 changes: 33 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Modifications copyright (c) Enthought, Inc.
# SPDX-License-Identifier: BSD-3-Clause

# Visit https://golangci-lint.run/ for usage documentation
# and information on other useful linters
issues:
max-issues-per-linter: 0
max-same-issues: 0

linters:
disable-all: true
enable:
- durationcheck
- errcheck
- exportloopref
- forcetypeassert
- godot
- gofmt
- gosimple
- ineffassign
- makezero
- misspell
- nilerr
- predeclared
- staticcheck
- tenv
- unconvert
- unparam
- unused
- govet
67 changes: 67 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Modifications copyright (c) Enthought, Inc.
# SPDX-License-Identifier: BSD-3-Clause

# Visit https://goreleaser.com for documentation on how to customize this
# behavior.
version: 2
before:
hooks:
# this is just an example and not a requirement for provider building/publishing
- go mod tidy
builds:
- env:
# goreleaser does not work with CGO, it could also complicate
# usage by users in CI/CD systems like HCP Terraform 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:
disable: true
20 changes: 20 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Modifications copyright (c) Enthought, Inc.
# SPDX-License-Identifier: BSD-3-Clause

default: testacc

# Run acceptance tests
.PHONY: testacc
testacc:
TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m

# Generate Quay API
.PHONY: generate-quay-api
generate-quay-api:
openapi-generator generate --generator-name go --git-user-id enthought --git-repo-id terraform-provider-quay --additional-properties=packageName=quay_api,isGoSubmodule=true --skip-validate-spec --input-spec code_generator/quay_api.json --output quay_api && \
gofmt -w quay_api && \
cd quay_api && \
go mod tidy
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# terraform-provider-quay
Terraform provider for the [Quay Project](https://github.com/quay/quay).

Please visit the Terraform registry site for instructions on how to use the provider:

https://registry.terraform.io/providers/enthought/quay/latest/docs

## Developer Instructions
### Build Documentation
The documentation should be updated every time the provider code is changed.
```bash
go generate .
```

### Run Tests
```bash
export QUAY_URL="https://quay.example.com"
export QUAY_TOKEN=""
make testacc
```

### Generate Quay API
```bash
make generate-quay-api
```
19 changes: 19 additions & 0 deletions code_generator/generator_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
provider:
name: quay
resources:
organization:
create:
path: /api/v1/organization/
method: POST
read:
path: /api/v1/organization/{orgname}
method: GET
schema:
attributes:
aliases:
orgname: name
overrides:
name:
description: Organization name
ignores:
- recaptcha_response
52 changes: 52 additions & 0 deletions code_generator/provider_code_spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"provider": {
"name": "quay"
},
"resources": [
{
"name": "organization",
"schema": {
"attributes": [
{
"name": "email",
"string": {
"computed_optional_required": "required",
"description": "Organization contact email"
}
},
{
"name": "name",
"string": {
"computed_optional_required": "required",
"description": "Organization name"
}
}
]
}
}
],
"datasources": [
{
"name": "organization",
"schema": {
"attributes": [
{
"name": "email",
"string": {
"computed_optional_required": "computed",
"description": "Organization contact email"
}
},
{
"name": "name",
"string": {
"computed_optional_required": "required",
"description": "Organization name"
}
}
]
}
}
],
"version": "0.1"
}
Loading

0 comments on commit a22a137

Please sign in to comment.