Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

GitLab NPM Scope adds second @ in orchestrator:release #1200

Closed

Description

@dschibster

Describe the bug
After checking at multiple junctures what the issue may be, I have come to the conclusion that the failure in our pipelines could only stem from the duplicate @ that is prepended to the npm_scope, because I could verify that the artifact exists, and at all other places I was not able to find any traces. #1168 already had such a failure, but only publish.ts was fixed as a hotfix. It seems more than publish is affected.

To Reproduce
Steps to reproduce the behavior:

  • Update a Package using orchestrator:publish
  • Create a Pipeline for manual-release
  • Run a Pipeline for Staging or whatever Instance is chosen as the first one.

Expected behavior

Artifacts should be found and released to target Instance

Screenshots

image

Platform Details (please complete the following information):

  • OS: Using the Docker Image provided at ghcr.io/dxatscale/sfpowerscripts
  • Version [e.g. CLI Version eg: 1.6.6]: 20.2.11
  • Salesforce CLI(sfdx cli) Version: 1.179,9
  • CI Platform: GitLab

Additional context
Probably a follow up issue to #1168 as more than one script uses npm scope in a similar way to publish. For me, it happens when running the release command.

Activity

  1. added
    analysis
    on Jan 23, 2023
  2. vuha-acn commented on Jan 23, 2023

    @vuha-acn
    Contributor

    @dschibster - To fix the error, I have done the following in the in the default section:

    1. Added the "@" manually in the writing of the .npmrc file at the top for default
    2. Removed the "@" for the variable --scope "$NPM_SCOPE"

    I'll be updated the dxatscale-templates soon to reflect this and corresponding documentation.

    default:
       image: ghcr.io/dxatscale/sfpowerscripts
       # Generate NPM Configuration File for Package Registry Publishing
       before_script:
        - sfdx auth:sfdxurl:store -f "$DEVHUB_SFDX_AUTH_URL" -a "$DEVHUB_ALIAS"
        - echo "@${NPM_SCOPE}:registry=https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/packages/npm/" >> .npmrc
        - echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> .npmrc 
        # Below setting is required to push git tags and changelog to the repo      
        - git remote set-url --push origin https://gitlab-ci-token:${PROJECT_ACCESS_TOKEN}@$CI_SERVER_HOST/$CI_PROJECT_PATH.git
    
  3. dschibster commented on Jan 24, 2023

    @dschibster
    Author

    @vuha-acn Thanks for the heads-up but that doesn't do it for me. None of the --scope variables had an "@" to begin with. I did change the line you changed in the before_script, but at the end of it I still found it tried to pack @@salesforce-app/....

  4. dschibster commented on Jan 24, 2023

    @dschibster
    Author

    image
    Going a little further, removing the "@" altogether will give me the correct npm-scope (as it only has one @), but the npm pack command still adds another one, because I think it expects the npm-scope to be without the prepended "@".

    @vuha-acn Can you make something of that?

  5. dschibster commented on Jan 24, 2023

    @dschibster
    Author

    For the time being I was able to fix this by hard-coding the scope in both the before_script (with @ prepended) and in the --scope variables. For our current use case the single scope should be enough but I would appreciate a long-term fix that addresses this.

  6. vuha-acn commented on Jan 24, 2023

    @vuha-acn
    Contributor

    Yes, i've only hardcoded the '@' item below and removed any '@' on my NPM_SCOPE in my GitLab pipeline for CI/CD. That is basically the workaround now until we have time to investigate further.

    - echo "@${NPM_SCOPE}:registry=https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/packages/npm/" >> .npmrc

    Glad you were able to get a short term work around in place.

  7. added
    bug
    and removed
    analysis
    on Jan 25, 2023
  8. dschibster commented on Jan 25, 2023

    @dschibster
    Author

    After Realizing that my NPM_SCOPE variable did actually have an @ I didn't ask for, your workaround now also does the trick. So the script adjustment with prepending the @ to the before_script is the only adjustment I needed to make in the end.

  9. vuha-acn commented on Jan 26, 2023

    @vuha-acn
    Contributor

    Glad that was the case. The workaround works for me as I've been using GitLab for my pipelines for few projects and that is the current fix until we get a more long term fix in place. I'm working on updating the dxatscale-template just strapped for time recently.

  10. added a commit that references this issue on Jan 31, 2023
    cf20323
  11. azlam-abdulsalam commented on Feb 6, 2023

    @azlam-abdulsalam
    Contributor

    Fixed in Jan 23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions