diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index bfaff56..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,18 +0,0 @@ -# Dependencies - - - -# What Is Changing - - - -# Test Steps - -- [ ] Have you updated the `docs/` folder to match your change? -- [ ] Have you exercised your change using the `examples/` docker compose setup? - -```sh -make testacc -``` - - diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 603f653..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,11 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" - - - package-ecosystem: "gomod" - directory: "/" - schedule: - interval: "weekly" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index d1d8642..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,42 +0,0 @@ -# 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 (paultyng/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.18 - - name: Import GPG key - id: import_gpg - uses: paultyng/ghaction-import-gpg@v2.1.0 - env: - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - PASSPHRASE: ${{ secrets.PASSPHRASE }} - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v3 - with: - version: latest - args: release --rm-dist - env: - GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 0613e91..0000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Mark stale issues and pull requests - -on: - schedule: - - cron: '24 9 * * *' - -jobs: - stale: - - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - - steps: - - uses: actions/stale@v5 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'Stale issue message' - stale-pr-message: 'Stale pull request message' - stale-issue-label: 'no-issue-activity' - stale-pr-label: 'no-pr-activity' - days-before-stale: 180 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 8818b8d..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: test - -on: [pull_request] - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: ^1.18 - - - name: golangci-lint - uses: golangci/golangci-lint-action@v3.2.0 - - unit: - runs-on: ubuntu-latest - steps: - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: ^1.18 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v3 - - - run: go mod download - - - name: Test - run: go test -race -covermode=atomic -coverprofile=coverage.txt ./... - - - uses: actions/upload-artifact@v3 - with: - name: unit-coverage - path: coverage.txt - - acceptance: - runs-on: ubuntu-latest - steps: - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: ^1.18 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v3 - - - run: go mod download - - - name: Set up services - env: - COMPOSE_FILE: ./example/docker-compose.yml - run: | - docker-compose build - docker-compose up -d --force-recreate jenkins - while [ "$(docker inspect jenkins-provider-acc --format '{{ .State.Health.Status }}')" != "healthy" ]; do echo "Waiting for Jenkins to start..."; sleep 3; done - - - name: Run Acceptance Tests - env: - TF_ACC: "1" - JENKINS_URL: "http://localhost:8080" - JENKINS_USERNAME: "admin" - JENKINS_PASSWORD: "admin" - run: go test -v -covermode=atomic -coverprofile=coverage.txt ./... - - - uses: actions/upload-artifact@v3 - with: - name: acceptance-coverage - path: coverage.txt diff --git a/.gitignore b/.gitignore index a31042d..f1b455b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ terraform.tfstate* vendor dist/ coverage.txt +.vscode/ diff --git a/.goreleaser.yml b/.goreleaser.yml index 6512241..f0261c8 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -2,7 +2,6 @@ # behavior. before: hooks: - # this is just an example and not a requirement for provider building/publishing - go mod tidy builds: - env: @@ -10,35 +9,37 @@ builds: # usage by users in CI/CD systems like Terraform Cloud where # they are unable to install libraries. - CGO_ENABLED=0 - mod_timestamp: "{{ .CommitTimestamp }}" + mod_timestamp: '{{ .CommitTimestamp }}' flags: - -trimpath ldflags: - - "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}" + - '-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 }}" + - goos: windows + goarch: arm64 + - goos: linux + goarch: arm64 + binary: '{{ .ProjectName }}_v{{ .Version }}' archives: - format: zip - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' checksum: - name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS" + 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 is a GitHub action or some other automated pipeline, you + # 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" @@ -48,4 +49,10 @@ signs: - "--detach-sign" - "${artifact}" release: - draft: false + 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 +snapshot: + name_template: '{{ .Env.BRANCH_NAME }}_b{{ .Env.BUILD_NUMBER }}_{{ time "2006-01-02" }}' diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..0e01508 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,46 @@ +#!/usr/bin/env groovy + +pipeline { + agent { + label 'os:linux && terraform' + } + options { + skipDefaultCheckout() + disableConcurrentBuilds() + ansiColor('xterm') + } + parameters { + string(name: 'RELEASE_VERSION', + defaultValue: '', + description: 'The version of the terraform provider. (MAJOR.MINOR.PATCH, e.g. 0.0.1). If the version is left empty, release stage will be skipped.', + trim:true) + } + stages { + stage("Checkout") { + steps { + checkout scm + } + } + stage("Build") { + when { + expression { + params.RELEASE_VERSION == '' + } + } + steps { + goreleaser snapshot: true + archiveArtifacts artifacts: 'dist/*.zip', fingerprint: true + } + } + stage("Release") { + when { + expression { + params.RELEASE_VERSION != '' + } + } + steps { + goreleaser releaseVersion: params.RELEASE_VERSION + } + } + } +} diff --git a/README.md b/README.md index c9b4426..f8b9312 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ # Terraform Provider -![Unit Tests](https://github.com/taiidani/terraform-provider-jenkins/workflows/Unit%20Tests/badge.svg) -![Acceptance Tests](https://github.com/taiidani/terraform-provider-jenkins/workflows/Acceptance%20Tests/badge.svg) - - Website: https://www.terraform.io - [![Gitter chat](https://badges.gitter.im/hashicorp-terraform/Lobby.png)](https://gitter.im/hashicorp-terraform/Lobby) - Mailing list: [Google Groups](http://groups.google.com/group/terraform-tool) @@ -11,13 +8,13 @@ This is a community provider and is not supported by Hashicorp. ## Installation -This provider has been published to the Terraform Registry at https://registry.terraform.io/providers/taiidani/jenkins. Please visit the registry for documentation and installation instructions. +This provider has been published to the Terraform Registry at https://registry.terraform.io/providers/kingsoftgames/jenkins. Please visit the registry for documentation and installation instructions. ## Contributors This repository is actively maintained as free time allows for me to work on it. I am accepting Issues and Pull Requests and if you are interested in helping as a maintainer I am open to the possibility. Please allow for 2-3 weeks of turnaround time on your contributions. -The scope of the provider covers the entire (extendable) Jenkins API provided that the https://github.com/bndr/gojenkins client library supports it. I accept submissions for functionality outside of Jenkins Core but expect that the plugin(s) required are _clearly stated_ in the documentation. See [jenkins_credential_vault_approle](https://registry.terraform.io/providers/taiidani/jenkins/latest/docs/resources/credential_vault_approle) for an example of this. I can only support these extensions as much as my own ability to test them allows -- Your Mileage May Vary. +The scope of the provider covers the entire (extendable) Jenkins API provided that the https://github.com/bndr/gojenkins client library supports it. I accept submissions for functionality outside of Jenkins Core but expect that the plugin(s) required are _clearly stated_ in the documentation. See [jenkins_credential_vault_approle](https://registry.terraform.io/providers/kingsoftgames/jenkins/latest/docs/resources/credential_vault_approle) for an example of this. I can only support these extensions as much as my own ability to test them allows -- Your Mileage May Vary. ## Developing the Provider diff --git a/docs/resources/job.md b/docs/resources/job.md index e6a0290..5444d66 100644 --- a/docs/resources/job.md +++ b/docs/resources/job.md @@ -31,7 +31,7 @@ And in `job.xml`: 2 - https://github.com/taiidani/terraform-provider-jenkins.git + https://github.com/kingsoftgames/terraform-provider-jenkins.git github diff --git a/example/pipeline.xml b/example/pipeline.xml index 5c342b0..615f0f4 100644 --- a/example/pipeline.xml +++ b/example/pipeline.xml @@ -8,7 +8,7 @@ 2 - https://github.com/taiidani/terraform-provider-jenkins.git + https://github.com/kingsoftgames/terraform-provider-jenkins.git github diff --git a/example/providers.tf b/example/providers.tf index 668ad6c..b6a71f5 100644 --- a/example/providers.tf +++ b/example/providers.tf @@ -10,7 +10,7 @@ provider "jenkins" { terraform { required_providers { jenkins = { - source = "taiidani/jenkins" + source = "kingsoftgames/jenkins" version = ">= 0.5.0" } } diff --git a/go.mod b/go.mod index d50e1d8..f31495c 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/taiidani/terraform-provider-jenkins +module github.com/kingsoftgames/terraform-provider-jenkins go 1.18 diff --git a/jenkins/resource_jenkins_job_test.xml b/jenkins/resource_jenkins_job_test.xml index 2ed1b24..297d997 100644 --- a/jenkins/resource_jenkins_job_test.xml +++ b/jenkins/resource_jenkins_job_test.xml @@ -8,7 +8,7 @@ 2 - https://github.com/taiidani/terraform-provider-jenkins.git + https://github.com/kingsoftgames/terraform-provider-jenkins.git github diff --git a/jenkins/resource_jenkins_job_test_parameterized.xml b/jenkins/resource_jenkins_job_test_parameterized.xml index a8da4de..f04c703 100644 --- a/jenkins/resource_jenkins_job_test_parameterized.xml +++ b/jenkins/resource_jenkins_job_test_parameterized.xml @@ -8,7 +8,7 @@ 2 - https://github.com/taiidani/terraform-provider-jenkins.git + https://github.com/kingsoftgames/terraform-provider-jenkins.git github diff --git a/jenkins/resource_jenkins_job_test_want.xml b/jenkins/resource_jenkins_job_test_want.xml index fe52276..374c864 100644 --- a/jenkins/resource_jenkins_job_test_want.xml +++ b/jenkins/resource_jenkins_job_test_want.xml @@ -8,7 +8,7 @@ 2 - https://github.com/taiidani/terraform-provider-jenkins.git + https://github.com/kingsoftgames/terraform-provider-jenkins.git github diff --git a/main.go b/main.go index 007198d..005d031 100644 --- a/main.go +++ b/main.go @@ -2,13 +2,13 @@ // // This file and the folder structure within the `jenkins/` subfolder conform to the Terraform provider expectations and // best practices at https://www.terraform.io/docs/extend/. Please see the generated documentation at -// https://registry.terraform.io/providers/taiidani/jenkins for how to use the provider within Terraform itself. +// https://registry.terraform.io/providers/kingsoftgames/jenkins for how to use the provider within Terraform itself. package main import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/plugin" - "github.com/taiidani/terraform-provider-jenkins/jenkins" + "github.com/kingsoftgames/terraform-provider-jenkins/jenkins" ) func main() { diff --git a/makefile b/makefile index 0b9936b..da8a2c7 100644 --- a/makefile +++ b/makefile @@ -10,7 +10,7 @@ build: @echo "In order to have Terraform pick this up you will need to add the following to your $$HOME/.terraformrc file:" @echo " provider_installation {" @echo " dev_overrides {" - @echo " \"taiidani/jenkins\" = \"$(shell go env GOPATH)/bin\"" + @echo " \"kingsoftgames/jenkins\" = \"$(shell go env GOPATH)/bin\"" @echo " }" @echo " direct {}" @echo " }" diff --git a/terraform-registry-manifest.json b/terraform-registry-manifest.json new file mode 100644 index 0000000..1931b0e --- /dev/null +++ b/terraform-registry-manifest.json @@ -0,0 +1,6 @@ +{ + "version": 1, + "metadata": { + "protocol_versions": ["5.0"] + } +}