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

Tagging dosent seem to infer semver for independant tags #972

Open
fjanicki opened this issue Mar 1, 2024 · 2 comments
Open

Tagging dosent seem to infer semver for independant tags #972

fjanicki opened this issue Mar 1, 2024 · 2 comments

Comments

@fjanicki
Copy link

fjanicki commented Mar 1, 2024

Hi,

I am using the new release module in NX to tag my individual apps and use the following pattern, as suggested by the NX docs: release/{projectName}/{version}. However I cannot make the tags work for this. I tried with the following pattern:

    "container": {
      "executor": "@nx-tools/nx-container:build",
      "options": {
        "build-args": ["APP_NAME={projectName}"],
        "target": "release",
        "file": "{workspaceRoot}/Dockerfile",
        "engine": "docker",
        "metadata": {
          "images": ["-redacted-.dkr.ecr.-redacted-1.amazonaws.com/{projectName}"],
          "load": true,
          "flavor": ["latest=auto"],
          "tags": [
            "type=schedule",
            "type=ref,event=tag",
            "type=ref,event=pr",
            "type=match,pattern=release/{projectName}/(\\d+\\.\\d+\\.\\d+)(?!-)/i,group=1",
            "type=match,pattern=release/{projectName}/(\\d+\\.\\d+)\\.\\d+(?!-)/i,group=1",
            "type=match,pattern=release/{projectName}/(\\d+)\\.\\d+\\.\\d+(?!-)/i,group=1",
            "type=sha"
          ]
        }
      }
    }

But when running locally and after pushing the git tags to origin, I end up with 2 tags: the name of my current branch and the git SHA. The regex seems to work according to regex101 so I am a bit lost here on what to do next.

@fjanicki
Copy link
Author

fjanicki commented Mar 3, 2024

I think I misunderstood how this works. I thought it would read the last tag and build the docker container with this tag as I wanted to make it part of the same build step. I changed my pipeline to have the merge event in main to auto create a tag and add a only: tag to the build pipeline and this tags properly.

@CaporalDead
Copy link

Hi @fjanicki, I'm trying to achieve the same goal. Can you please share your project.json config and your pipeline config ? Thanks a lot !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants