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

Question: Use (environment) variable for URL (and label) #407

Closed
kaerbr opened this issue Jun 19, 2022 · 3 comments
Closed

Question: Use (environment) variable for URL (and label) #407

kaerbr opened this issue Jun 19, 2022 · 3 comments

Comments

@kaerbr
Copy link
Contributor

kaerbr commented Jun 19, 2022

I would like to be able to set url( and label dynamically).

Lets say I've set an environment URL in my .gitlab-ci.yml (will be set dynamically in the "real world") :

image: node:lts-alpine
stages:
  - release
semantic-release:
  stage: release
  script:
    - export ARTIFACT_URL="https://my.url/to/my/artifact"
    - apk update && apk upgrade
    - apk add --no-cache git
    - npm install -g semantic-release@19 @semantic-release/changelog@6 @semantic-release/exec@6 @semantic-release/git@10 @semantic-release/gitlab@9
    - semantic-release --debug

If I try to pass this variable into the gitlab plugin, the variable won't resolve. See .releaserc.yml:

plugins:
  - "@semantic-release/commit-analyzer"
  - "@semantic-release/release-notes-generator"
  - "@semantic-release/changelog"
  - - "@semantic-release/exec"
    - prepareCmd: $CI_PROJECT_DIR/.m2/prepare.sh ${nextRelease.version} $CI_PROJECT_DIR
      publishCmd: $CI_PROJECT_DIR/.m2/publish.sh
  - - "@semantic-release/git"
    - assets:
        - CHANGELOG.md
        - "**/*pom.xml"
  - - "@semantic-release/gitlab"
    - assets:
        - url: $ARTIFACT_URL
          label: "my-artifact"
          type: other
branches:
  - main

This will result in the following JSON payload that will be send to the gitlab releases API:

"assets": {
    "links": [
      {
        "name": "URL",
        "url": "$ARTIFACT_URL",
        "link_type": "other"
      }
    ]
  }

and will result in an error cause gitlab checks the url field to really be a URL.

So my question:
Is there any supported way of giving custom variable inputs to the gitlab plugin? (:

@jagiella
Copy link

I guess, that my question points into a similar direction:
#406

@fgreinacher
Copy link
Contributor

Yes, I think we can close this in favor of #406.

@kaerbr
Copy link
Contributor Author

kaerbr commented Jun 20, 2022

Closing in favour of #406

@kaerbr kaerbr closed this as completed Jun 20, 2022
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

3 participants