Skip to content

Commit

Permalink
Merge pull request #1115 from jfrog/add-values-to-go-remote-repo-vcs-…
Browse files Browse the repository at this point in the history
…git-provider-attribute

Add values to go remote repo 'vcs_git_provider' attribute
  • Loading branch information
alexhung authored Nov 4, 2024
2 parents ccb56a1 + c398eff commit 977aff4
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 12.4.0 (November 4, 2024). Tested on Artifactory 7.98.7 with Terraform 1.9.8 and OpenTofu 1.8.5

IMPROVEMENTS:

* resource/artifactory_remote_go_repository: Update list of valid values for attribute `vcs_git_provider`. PR: [#1115](https://github.com/jfrog/terraform-provider-artifactory/pull/1115)

## 12.3.3 (November 1, 2024). Tested on Artifactory 7.98.7 with Terraform 1.9.8 and OpenTofu 1.8.4

BUG FIXES:
Expand Down
10 changes: 6 additions & 4 deletions docs/resources/remote_go_repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,32 @@ subcategory: "Remote Repositories"
# Artifactory Remote Go Repository Resource

Creates a remote Go repository.

Official documentation can be found [here](https://www.jfrog.com/confluence/display/JFROG/Go+Registry).


## Example Usage

```hcl
resource "artifactory_remote_go_repository" "my-remote-go" {
key = "my-remote-go"
url = "https://proxy.golang.org/"
vcs_git_provider = "ARTIFACTORY"
key = "my-remote-go"
url = "https://proxy.golang.org/"
vcs_git_provider = "ARTIFACTORY"
}
```

## Argument Reference

Arguments have a one to one mapping with the [JFrog API](https://www.jfrog.com/confluence/display/RTF/Repository+Configuration+JSON).

The following arguments are supported, along with the [common list of arguments for the remote repositories](remote.md):

* `key` - (Required) A mandatory identifier for the repository that must be unique. It cannot begin with a number or
contain spaces or special characters.
* `description` - (Optional)
* `notes` - (Optional)
* `url` - (Required) The remote repo URL.
* `vcs_git_provider` - (Optional) Artifactory supports proxying the following Git providers out-of-the-box: GitHub or a remote Artifactory instance. Default value is `ARTIFACTORY`.
* `vcs_git_provider` - (Optional) Artifactory supports proxying the following Git providers out-of-the-box: GitHub (`GITHUB`), GitHub Enterprise (`GITHUBENTERPRISE`), BitBucket Cloud (`BITBUCKET`), BitBucket Server (`STASH`), GitLab (`GITLAB`), or a remote Artifactory instance (`ARTIFACTORY`). Default value is `ARTIFACTORY`.
* `curated` - (Optional, Default: `false`) Enable repository to be protected by the Curation service.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ type GoRemoteRepo struct {
VcsGitProvider string `json:"vcsGitProvider"`
}

var SupportedGoVCSGitProviders = []string{
"ARTIFACTORY",
"BITBUCKET",
"GITHUB",
"GITHUBENTERPRISE",
"GITLAB",
"STASH",
}

var GoSchema = lo.Assign(
baseSchema,
CurationRemoteRepoSchema,
Expand All @@ -23,8 +32,8 @@ var GoSchema = lo.Assign(
Type: schema.TypeString,
Optional: true,
Default: "ARTIFACTORY",
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"GITHUB", "ARTIFACTORY"}, false)),
Description: `Artifactory supports proxying the following Git providers out-of-the-box: GitHub or a remote Artifactory instance. Default value is "ARTIFACTORY".`,
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice(SupportedGoVCSGitProviders, false)),
Description: "Artifactory supports proxying the following Git providers out-of-the-box: GitHub (`GITHUB`), GitHub Enterprise (`GITHUBENTERPRISE`), BitBucket Cloud (`BITBUCKET`), BitBucket Server (`STASH`), GitLab (`GITLAB`), or a remote Artifactory instance (`ARTIFACTORY`). Default value is `ARTIFACTORY`.",
},
},
repository.RepoLayoutRefSchema(Rclass, repository.GoPackageType),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ func ResourceArtifactoryRemoteMavenRepository() *schema.Resource {
)
}

var resourceMavenV1 = &schema.Resource{
Schema: mavenSchemaV1,
}

func mkResourceSchemaMaven(skeemas map[int16]map[string]*schema.Schema, packer packer.PackFunc, unpack unpacker.UnpackFunc, constructor repository.Constructor) *schema.Resource {
var reader = repository.MkRepoRead(packer, constructor)
return &schema.Resource{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,16 @@ func TestAccRemoteAllRepository(t *testing.T) {

func TestAccRemoteGoRepository(t *testing.T) {
const packageType = "go"
resource.Test(mkNewRemoteTestCase(packageType, t, map[string]interface{}{
"url": "https://proxy.golang.org/",
"vcs_git_provider": "ARTIFACTORY",
"missed_cache_period_seconds": 1800,
}))

for _, vcsGitProvider := range remote.SupportedGoVCSGitProviders {
t.Run(vcsGitProvider, func(t *testing.T) {
resource.Test(mkNewRemoteTestCase(packageType, t, map[string]interface{}{
"url": "https://proxy.golang.org/",
"vcs_git_provider": vcsGitProvider,
"missed_cache_period_seconds": 1800,
}))
})
}
}

func TestAccRemoteVcsRepository(t *testing.T) {
Expand Down

0 comments on commit 977aff4

Please sign in to comment.