mirror of
https://github.com/ysoftdevs/terraform-provider-bitbucketserver.git
synced 2026-06-12 17:34:36 +02:00
* Re-enabled ND tests
* Reverted changes to README.md since there is another PR to update it.
This commit is contained in:
committed by
Emily Li
parent
b3ee8fd46c
commit
a38a9f4d15
@@ -45,22 +45,45 @@ See [User Guide](https://gavinbunney.github.io/terraform-provider-bitbucketserve
|
|||||||
- [Terraform](https://www.terraform.io/downloads.html) 0.12.x
|
- [Terraform](https://www.terraform.io/downloads.html) 0.12.x
|
||||||
- [Go](https://golang.org/doc/install) 1.11 (to build the provider plugin)
|
- [Go](https://golang.org/doc/install) 1.11 (to build the provider plugin)
|
||||||
|
|
||||||
|
### Building The Provider
|
||||||
|
|
||||||
|
Clone repository to: `$GOPATH/src/github.com/gavinbunney/terraform-provider-bitbucketserver`
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ mkdir -p $GOPATH/src/github.com/terraform-providers; cd $GOPATH/src/github.com/terraform-providers
|
||||||
|
$ git clone git@github.com:gavinbunney/terraform-provider-bitbucketserver
|
||||||
|
```
|
||||||
|
|
||||||
|
Enter the provider directory and build the provider
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ cd $GOPATH/src/github.com/gavinbunney/terraform-provider-bitbucketserver
|
||||||
|
$ make build
|
||||||
|
```
|
||||||
|
|
||||||
### Developing the Provider
|
### Developing the Provider
|
||||||
|
|
||||||
If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.11+ is *required*). You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`.
|
If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.11+ is *required*). You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`.
|
||||||
|
|
||||||
Then clone the repository [Terraform provider bitbucket](https://github.com/gavinbunney/terraform-provider-bitbucketserver)
|
|
||||||
|
|
||||||
To compile the provider, run `make build`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.
|
To compile the provider, run `make build`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ make bin
|
||||||
|
...
|
||||||
|
$ $GOPATH/bin/terraform-provider-bitbucketserver
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
In order to test the provider, you can simply run `make test`.
|
In order to test the provider, you can simply run `make test`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ make test
|
$ make test
|
||||||
```
|
```
|
||||||
|
|
||||||
In order to run the full suite of Acceptance tests, run `make testacc-bitbucket`. Alternatively, you can run the
|
In order to run the full suite of Acceptance tests, run `make testacc`.
|
||||||
`scripts/start-docker-compose.sh` to start the Bitbucket docker container, run `make testacc` and then call
|
|
||||||
`scripts/stop-docker-compose.sh` when done running tests.
|
|
||||||
|
|
||||||
*Note:* Acceptance tests create real resources, and often cost money to run if not running locally.
|
*Note:* Acceptance tests create real resources, and often cost money to run.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ make testacc
|
||||||
|
```
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestAccBitbucketDataPlugin_notifyer(t *testing.T) {
|
func TestAccBitbucketDataPlugin_notifyer(t *testing.T) {
|
||||||
t.Skip("Skipping testing in CI environment")
|
|
||||||
config := `
|
config := `
|
||||||
resource "bitbucketserver_plugin" "test" {
|
resource "bitbucketserver_plugin" "test" {
|
||||||
key = "nl.stefankohler.stash.stash-notification-plugin"
|
key = "nl.stefankohler.stash.stash-notification-plugin"
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ package bitbucket
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/helper/schema"
|
"github.com/hashicorp/terraform/helper/schema"
|
||||||
|
"net/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
func resourceGroup() *schema.Resource {
|
func resourceGroup() *schema.Resource {
|
||||||
@@ -39,9 +37,9 @@ func resourceGroupCreate(d *schema.ResourceData, m interface{}) error {
|
|||||||
groupName := d.Get("name").(string)
|
groupName := d.Get("name").(string)
|
||||||
importIfExists := d.Get("import_if_exists").(bool)
|
importIfExists := d.Get("import_if_exists").(bool)
|
||||||
var newResource = true
|
var newResource = true
|
||||||
_, err := client.Post(fmt.Sprintf("/rest/api/1.0/admin/groups?name=%s", url.QueryEscape(groupName)), nil)
|
response, err := client.Post(fmt.Sprintf("/rest/api/1.0/admin/groups?name=%s", url.QueryEscape(groupName)), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if importIfExists && strings.Contains(err.Error(), "API Error: 409") {
|
if importIfExists && response.StatusCode == 409 {
|
||||||
newResource = false
|
newResource = false
|
||||||
} else {
|
} else {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestAccBitbucketPluginConfig(t *testing.T) {
|
func TestAccBitbucketPluginConfig(t *testing.T) {
|
||||||
t.Skip("Skipping testing in CI environment")
|
|
||||||
config := `
|
config := `
|
||||||
resource "bitbucketserver_plugin" "test" {
|
resource "bitbucketserver_plugin" "test" {
|
||||||
key = "de.codecentric.atlassian.oidc.bitbucket-oidc-plugin"
|
key = "de.codecentric.atlassian.oidc.bitbucket-oidc-plugin"
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestAccBitbucketPlugin_install(t *testing.T) {
|
func TestAccBitbucketPlugin_install(t *testing.T) {
|
||||||
t.Skip("Skipping testing in CI environment")
|
|
||||||
config := `
|
config := `
|
||||||
resource "bitbucketserver_plugin" "test" {
|
resource "bitbucketserver_plugin" "test" {
|
||||||
key = "com.plugin.commitgraph.commitgraph"
|
key = "com.plugin.commitgraph.commitgraph"
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ resource "bitbucketserver_group" "browncoats" {
|
|||||||
## Argument Reference
|
## Argument Reference
|
||||||
|
|
||||||
* `name` - Required. Group to create.
|
* `name` - Required. Group to create.
|
||||||
|
* `import_if_exists` - Optional. Import groups that already exist in bitbucket into the terraform state file.
|
||||||
|
|
||||||
## Import
|
## Import
|
||||||
|
|
||||||
|
|||||||
-10
@@ -1,10 +0,0 @@
|
|||||||
#We use semantic versioning:
|
|
||||||
#version x.y.z
|
|
||||||
#x is an api version and if breaking api changes are introduced this should change, otherwise it remains constant
|
|
||||||
#y is a new feature version and this only changes if new features are changed but bugs are not fixed
|
|
||||||
#z is a patch version that changes if a bug is fixed for a previous feature version.
|
|
||||||
# See https://semver.org/ for more information
|
|
||||||
|
|
||||||
#To use this file call `source version.env` from a bash terminal
|
|
||||||
|
|
||||||
export BITBUCKET_PROVIDER_VERSION=1.4.0
|
|
||||||
Reference in New Issue
Block a user