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

Creating m2 group with version_policy = "SNAPSHOT" produces a group repo with version policy as Release #148

Open
mykelalvis-rialtic opened this issue Dec 12, 2021 · 5 comments
Assignees
Labels
blocked This issue is blocked by external resources bug Something isn't working exempt-from-stale Exception label for stale bot

Comments

@mykelalvis-rialtic
Copy link

Describe the bug
terraform plan tells me the following as part of the attached TF files run (this is a subset)

  # nexus_repository.op2-snapshot-group-m2 will be created
  + resource "nexus_repository" "op2-snapshot-group-m2" {
      + format = "maven2"
      + id     = (known after apply)
      + name   = "op2-snapshot-group-m2"
      + online = true
      + type   = "group"

      + group {
          + member_names = [
              + "op2-release-group-m2",
              + "op2-snapshot-m2",
            ]
        }

      + maven {
          + layout_policy  = "STRICT"
          + version_policy = "SNAPSHOT"
        }

      + storage {
          + blob_store_name                = "op2-snapshot-group-m2"
          + strict_content_type_validation = true
          + write_policy                   = "ALLOW"
        }
    }

To Reproduce

  1. modify obv.tf.zip contents to give the group some actual member repos that exist
  2. terraform apply
  3. see that op2-snapshot-group-m2 is of type Release

Expected behavior

op2-snapshot-group-m2 should have version policy of Snapshot

@mykelalvis-rialtic mykelalvis-rialtic added the bug Something isn't working label Dec 12, 2021
@anmoel anmoel self-assigned this Dec 12, 2021
@anmoel
Copy link
Member

anmoel commented Dec 12, 2021

hi @mykelalvis-rialtic,

thanks for your report.
Unfortunately the nexus api does not support maven options for creating a maven group.

here is the important excerpt from api version 3.37:

"MavenGroupRepositoryApiRequest": {
      "type": "object",
      "required": [
        "group",
        "name",
        "online",
        "storage"
      ],
      "properties": {
        "name": {
          "type": "string",
          "example": "internal",
          "description": "A unique identifier for this repository",
          "pattern": "^[a-zA-Z0-9\\-]{1}[a-zA-Z0-9_\\-\\.]*$"
        },
        "online": {
          "type": "boolean",
          "example": true,
          "description": "Whether this repository accepts incoming requests"
        },
        "storage": {
          "$ref": "#/definitions/StorageAttributes"
        },
        "group": {
          "$ref": "#/definitions/GroupAttributes"
        }
      }
    },

I am sorry that this cannot be seen. We are in the process of splitting up the repository resource so that everything is easier to use.
I will open a request at sonatype for the this feature in the api

regards
André

@anmoel
Copy link
Member

anmoel commented Dec 12, 2021

Issue at nexus jira is created. here: https://issues.sonatype.org/browse/NEXUS-30501

@mykelalvis-rialtic
Copy link
Author

mykelalvis-rialtic commented Dec 12, 2021

So...to be clear....the Nexus API forces you to select an option that cannot be changed at a later date. #genius 😄

Also...thanks! I'll try to work that from my end, as well.

@mykelalvis-rialtic
Copy link
Author

And just so everyone understands why, it appears that if I set the version_policy to release, then it only resolves releases. Thus a true snapshot group seems effectively impossible to produce with this provider at the present time.

@anmoel anmoel added the blocked This issue is blocked by external resources label Dec 13, 2021
@github-actions
Copy link

This issue has been automatically marked as stale because it has had no activity in the last 90 days. It will be closed in 7 days if no further activity occurs. Leaving a comment starting with /fresh will mark this issue as not stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked This issue is blocked by external resources bug Something isn't working exempt-from-stale Exception label for stale bot
Projects
Development

No branches or pull requests

2 participants