FrontEnd Pipelines: Using private NPM Repositories. | Community
Skip to main content
Level 2
July 22, 2024
Solved

FrontEnd Pipelines: Using private NPM Repositories.

Adobe has documentation about how we would use Pipeline secrets and ENV variables to use a Private Maven Repository.

Is there something similar for the FrontEnd Sites projects and NPM??

e.g, if in my package.json I had this..

"dependencies": {
"my-private-repo": "git+https://${GITHUB_PAT_KEY}@github.com/My-Organization/Private-REPO.git"
}

I have been sandboxing this, and found that:

 

  • Simply having GITHUB_PAT_KEY as a Pipeline secret does not work, as NPM is not picking up on the ENV variable.
  • We cannot have exposed PAT keys in the codebase, and so the PAT must always be an ENV secret somewhere.
  • I have tried using a npm preinstall which would insert the PAT key from process.env, but the pipeline is not able to run npm preinstall.
  • Using git submodules or similar may have problems due to the predefined npm commands that the pipeline is using..

In short, how do we use a private repo as a dependancy for our Sites theme where it would build using the pipeline?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
h_kataria
h_katariaAccepted solution
New Participant
July 22, 2024

Check if this helps https://www.netcentric.biz/insights/2020/08/private-repository-cloud-manager It has a well explained section on how you can use pipeline variables for private NPM dependencies.
Hope this helps.

3 replies

h_kataria
h_katariaAccepted solution
New Participant
July 22, 2024

Check if this helps https://www.netcentric.biz/insights/2020/08/private-repository-cloud-manager It has a well explained section on how you can use pipeline variables for private NPM dependencies.
Hope this helps.

Translate
arunpatidar
New Participant
July 22, 2024
Arun Patidar
TarunKumar
New Participant
July 22, 2024

Hi @david_dorr1 ,

Please make sure you have below configuration in pom file.
npm and node versions you can mention as per ypour project requirement.

ui-frontend module POM.xml <plugin> <groupId>com.github.eirslett</groupId> <artifactId>frontend-maven-plugin</artifactId> <executions> <execution> <id>npm run prod</id> <phase>generate-resources</phase> <goals> <goal>npm</goal> </goals> <configuration> <arguments>run prod</arguments> </configuration> </execution> </executions> </plugin> main pom.xml <configuration> <nodeVersion>v18.18.2</nodeVersion> <npmVersion>9.8.1</npmVersion> </configuration>

 

 

-Tarun

 

Translate