Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual repository must include only repositories from the same project it was created with #1170

Open
oallauddin opened this issue Jan 10, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@oallauddin
Copy link

oallauddin commented Jan 10, 2025

Describe the bug
Encountering this error when modifying an existing virtual repository.
Virtual repository must include only repositories from the same project it was created with.
JFrog says that this occurs when the repositories are not shared.
I am not aware of a way to share repositories using the provider.

Requirements for and issue

  • Artifactory version 7.90.13
  • Terraform 1.6.2
  • Artifactory provider 11.9.2

Expected behavior
Not encountering the error when modifying an existing virtual repository.

Additional context
In troubleshooting I have found that a destroy and create of the virtual repository resolves the error.
Here is an example of fixing the problem.
The repositories variable contains the list of repositories that make up the virtual repository.
When the value of repositories is modified it triggers a replacement of the virtual repository.

resource "terraform_data" "maven_virtual_replace" {
  input = var.repositories
}

resource "artifactory_virtual_maven_repository" "maven_virtual" {
  key = "maven-virtual"
  repositories = var.repositories
  lifecycle {
    ignore_changes = [
      project_environments,
      project_key
    ]
    replace_triggered_by = [
      terraform_data.maven_virtual_replace
    ]
  }
}
@oallauddin oallauddin added the bug Something isn't working label Jan 10, 2025
@alexhung
Copy link
Member

@oallauddin You can share repository with project using the project_share_repository resource.

@oallauddin
Copy link
Author

Here is the scenario I am running into.
Two teams and two projects in the same instance of Artifactory.
Each team owns the iac for their individual teams.
Team A wants to share a local repository with Team B.
Team A sets up a user for Team B to use that has access to the local repository.
Team B sets up a remote repository to the local repository owned by Team A.
Team B adds the remote repository to the virtual repository for Team B.
Team B encounters the error.

We are using a remote repository and not sharing using project.
Project share repository still falls into this scenario?
In other cases of using a remote repository we don't fall into the problem i.e. two different instances of Artifactory.
I am not sure what the API validation is checking.
It seems to recognize that the remote repository is in the same instance and enforcing project sharing.

@alexhung alexhung removed their assignment Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants