Skip to content

Commit

Permalink
Merge pull request #1161 from jfrog/add-federated-huggingfaceml-repo
Browse files Browse the repository at this point in the history
Add 'artifactory_federated_huggingfaceml_repository' resource
  • Loading branch information
alexhung authored Jan 7, 2025
2 parents 3669053 + 47379b2 commit b1cdb98
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## 12.8.0 (January 6, 2025). Tested on Artifactory 7.98.13 with Terraform 1.10.3 and OpenTofu 1.8.8
## 12.8.0 (January 7, 2025). Tested on Artifactory 7.98.13 with Terraform 1.10.3 and OpenTofu 1.8.8

FEATURES:

**New Resource:** `artifactory_federated_huggingfaceml_repository` to support federated HuggingFace ML repository. PR: [#1161](https://github.com/jfrog/terraform-provider-artifactory/pull/1161)

IMPROVEMENTS:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ See the [contribution guide](CONTRIBUTIONS.md).

## License

Copyright (c) 2024 JFrog.
Copyright (c) 2025 JFrog.

Apache 2.0 licensed, see [LICENSE][LICENSE] file.

Expand Down
48 changes: 48 additions & 0 deletions docs/resources/federated_huggingfaceml_repository.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
subcategory: "Federated Repositories"
---
# Artifactory Federated Hugging Face ML Repository Resource

Creates a federated Hugging Face ML repository.

## Example Usage

```terraform
resource "artifactory_federated_huggingfaceml_repository" "my-huggingfaceml-federated" {
key = "my-huggingfaceml-federated"
member {
url = "http://tempurl.org/artifactory/my-huggingfaceml-federated"
enabled = true
}
member {
url = "http://tempurl2.org/artifactory/my-huggingfaceml-federated-2"
enabled = true
}
}
```

## Argument Reference

The following attributes are supported, along with the [list of attributes from the local HuggingFace ML repository](local_huggingfaceml_repository.md):

* `key` - (Required) the identity key of the repo.
* `member` - (Required) The list of Federated members and must contain this repository URL (configured base URL
`/artifactory/` + repo `key`). Note that each of the federated members will need to have a base URL set.
Please follow the [instruction](https://www.jfrog.com/confluence/display/JFROG/Working+with+Federated+Repositories#WorkingwithFederatedRepositories-SettingUpaFederatedRepository)
to set up Federated repositories correctly.
* `url` - (Required) Full URL to ending with the repository name.
* `enabled` - (Required) Represents the active state of the federated member. It is supported to change the enabled status of my own member. The config will be updated on the other federated members automatically.
* `access_token` - (Optional) Admin access token for this member Artifactory instance. Used in conjunction with `cleanup_on_delete` attribute when Access Federation for access tokens is not enabled.
* `cleanup_on_delete` - (Optional) Delete all federated members on `terraform destroy` if set to `true`. Default is `false`. This attribute is added to match Terrform logic, so all the resources, created by the provider, must be removed on cleanup. Artifactory's behavior for the federated repositories is different, all the federated repositories stay after the user deletes the initial federated repository. **Caution**: if set to `true` all the repositories in the federation will be deleted, including repositories on other Artifactory instances in the "Circle of trust". This operation can not be reversed.
* `proxy` - (Optional) Proxy key from Artifactory Proxies settings. Default is empty field. Can't be set if `disable_proxy = true`.
* `disable_proxy` - (Optional, Default: `false`) When set to `true`, the proxy is disabled, and not returned in the API response body. If there is a default proxy set for the Artifactory instance, it will be ignored, too.

## Import

Federated repositories can be imported using their name, e.g.

```sh
terraform import artifactory_federated_huggingfaceml_repository.my-huggingfaceml-federated my-huggingfaceml-federated
```
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ var defaultRepoLayoutMap = map[string]SupportedRepoClasses{
"local": true,
"remote": true,
"virtual": false,
"federated": false,
"federated": true,
},
},
IvyPackageType: {
Expand Down
1 change: 1 addition & 0 deletions pkg/artifactory/resource/repository/federated/federated.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var PackageTypesLikeGeneric = []string{
repository.GitLFSPackageType,
repository.GoPackageType,
repository.HelmPackageType,
repository.HuggingFacePackageType,
repository.NPMPackageType,
repository.OpkgPackageType,
repository.PuppetPackageType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func skipFederatedRepo() (bool, string) {
// https://github.com/jfrog/terraform-provider-artifactory/wiki/Testing#enable-acceptance-tests
func TestAccFederatedRepoWithMembers(t *testing.T) {
if skip, reason := skipFederatedRepo(); skip {
t.Skipf(reason)
t.Skip(reason)
}

name := fmt.Sprintf("federated-generic-%d-full", rand.Int())
Expand Down

0 comments on commit b1cdb98

Please sign in to comment.