Closed leoShabalkin closed 4 years ago
It's pretty impossible to know what's going on based on this. ignoreNpmrcFile
is irrelevant anyway if you have defined an .npmrc
file so the premise of this issue is wrong to begin with. You can see the log DEBUG: Writing repo .npmrc
which should be whatever you configured in your $NPMRC you passed.
Yes, I pull the renovate repository and started running debug with my custom parameters, and everything went well. But, if I run from gitlab ci, I get error. I have tried running with the parameter --npmrc=//my-url, the error is not changed.
Don't use NPM_TOKEN in your --npmrc
param - put the token in there and remove --npm-token
and --ignore-npmrc-file
.
I don't use NPM_TOKEN in the --npmrc. In my ci has npmrc initialization with NPM_TOKEN. I just want him to ignore it and form npmrc it from the parameter --npmrc
Please remove --npm-token
and --ignore-npmrc-file
and get a fresh log from another npm install attempt.
Fresh log
npx renovate new-ui --dry-run true --onboarding false --print-config=true --platform "gitlab" --require-config true --token "${GITLAB_TOKEN}" --endpoint="${GITLAB_URL}/api/v4/" --onboarding-config "{\"baseBranches\":[\"develop\"],\"enabledManagers\":[\"npm\"],\"prFooter\":\"This PR has been generated by renovate\"}" --npmrc="${RENOVATE_NPMRC}" --log-level="debug"
DEBUG: File config
"config": {}
DEBUG: CLI config
"config": {
"repositories": ["new-ui"],
"dryRun": true,
"printConfig": true,
"logLevel": "debug",
"onboarding": false,
"onboardingConfig": {
"baseBranches": ["develop"],
"enabledManagers": ["npm"],
"prFooter": "This PR has been generated by renovate"
},
"requireConfig": true,
"platform": "gitlab",
"endpoint": "https://gitlab-***.ru/api/v4/",
"token": "***********",
"npmrc": "***********"
}
DEBUG: Env config
"config": {"hostRules": [], "npmrc": "***********"}
DEBUG: Combined config
"config": {
"hostRules": [],
"npmrc": "***********",
"repositories": ["new-ui"],
"dryRun": true,
"printConfig": true,
"logLevel": "debug",
"onboarding": false,
"onboardingConfig": {
"baseBranches": ["develop"],
"enabledManagers": ["npm"],
"prFooter": "This PR has been generated by renovate"
},
"requireConfig": true,
"platform": "gitlab",
"endpoint": "https://gitlab-***.ru/api/v4/",
"token": "***********"
}
DEBUG: Adding trailing slash to endpoint
DEBUG: Using platform gitAuthor: pfa-workflow-automat <pfa-workflow-automat>
DEBUG: Using baseDir: /tmp/renovate
DEBUG: Using cacheDir: /tmp/renovate/cache
DEBUG: Initializing Renovate internal cache into /tmp/renovate/cache/renovate/renovate-cache-v1
DEBUG: Commits limit = null
INFO: Repository started (repository=new-ui)
"renovateVersion": "23.35.1"
DEBUG: Using localDir: /tmp/renovate/repos/gitlab/new-ui (repository=new-ui)
DEBUG: new-ui default branch = feature/DCO-647 (repository=new-ui)
DEBUG: Enabling Git FS (repository=new-ui)
DEBUG: new-ui http URL = https://gitlab-rnd.tcsbank.ru/new-ui.git (repository=new-ui)
DEBUG: resetMemCache() (repository=new-ui)
DEBUG: Setting npmrc (repository=new-ui)
DEBUG: checkOnboarding() (repository=new-ui)
DEBUG: isOnboarded() (repository=new-ui)
DEBUG: findFile(renovate.json) (repository=new-ui)
DEBUG: Initializing git repository into /tmp/renovate/repos/gitlab/new-ui (repository=new-ui)
DEBUG: git clone completed (repository=new-ui)
"durationMs": 497
DEBUG: latest commit (repository=new-ui)
"latestCommitDate": "2020-10-23T09:43:43+03:00"
DEBUG: Setting git author name (repository=new-ui)
"gitAuthorName": "pfa-workflow-automat"
DEBUG: Setting git author email (repository=new-ui)
"gitAuthorEmail": "pfa-workflow-automat"
DEBUG: findFile(renovate.json5) (repository=new-ui)
DEBUG: config file exists (repository=new-ui)
DEBUG: ensureIssueClosing() (repository=new-ui)
DEBUG: Repo is onboarded (repository=new-ui)
DEBUG: Found renovate.json5 config file (repository=new-ui)
DEBUG: Repository config (repository=new-ui)
"fileName": "renovate.json5",
"config": {
"extends": [":rebaseStalePrs"],
"stabilityDays": 3,
"commitMessageAction": "Renovate:",
"lockFileMaintenance": {"enabled": true},
"baseBranches": ["develop"],
"rangeStrategy": "bump",
"packageRules": [
{
"depTypeList": ["dependencies", "devDependencies"],
"packagePatterns": ["*"],
"excludePackagePatterns": [
"@types/node"
],
"enabled": true
},
{
"packagePatterns": ["@types/node"],
"assigneesFromCodeOwners": true,
"major": false,
"groupName": "Type nodes packages",
"commitMessageTopic": "dependency {{depName}}"
}
]
}
DEBUG: migrateAndValidate() (repository=new-ui)
DEBUG: Config migration necessary (repository=new-ui)
"oldConfig": {
"extends": [":rebaseStalePrs"],
"stabilityDays": 3,
"commitMessageAction": "Renovate:",
"lockFileMaintenance": {"enabled": true},
"baseBranches": ["develop"],
"rangeStrategy": "bump",
"packageRules": [
{
"depTypeList": ["dependencies", "devDependencies"],
"packagePatterns": ["*"],
"excludePackagePatterns": [
"@types/node"
],
"enabled": true
},
{
"packagePatterns": ["@types/node"],
"assigneesFromCodeOwners": true,
"major": false,
"groupName": "Type nodes packages",
"commitMessageTopic": "dependency {{depName}}"
}
]
},
"newConfig": {
"extends": [":rebaseStalePrs"],
"stabilityDays": 3,
"commitMessageAction": "Renovate:",
"lockFileMaintenance": {"enabled": true},
"baseBranches": ["develop"],
"rangeStrategy": "bump",
"packageRules": [
{
"depTypeList": ["dependencies", "devDependencies"],
"packagePatterns": ["*"],
"excludePackagePatterns": [
"@types/node"
],
"enabled": true
},
{
"packagePatterns": ["@types/node"],
"assigneesFromCodeOwners": true,
"major": {"enabled": false},
"groupName": "Type nodes packages",
"commitMessageTopic": "dependency {{depName}}"
}
]
}
DEBUG: massaged config (repository=new-ui)
"config": {
"extends": [":rebaseStalePrs"],
"stabilityDays": 3,
"commitMessageAction": "Renovate:",
"lockFileMaintenance": {"enabled": true},
"baseBranches": ["develop"],
"rangeStrategy": "bump",
"packageRules": [
{
"depTypeList": ["dependencies", "devDependencies"],
"packagePatterns": ["*"],
"excludePackagePatterns": [
"@types/node"
],
"enabled": true
},
{
"packagePatterns": ["@types/node"],
"assigneesFromCodeOwners": true,
"groupName": "Type nodes packages",
"commitMessageTopic": "dependency {{depName}}"
},
{
"packagePatterns": ["@types/node"],
"assigneesFromCodeOwners": true,
"groupName": "Type nodes packages",
"commitMessageTopic": "dependency {{depName}}",
"updateTypes": ["major"],
"enabled": false
}
]
}
*****
DEBUG: Calculated maximum PRs remaining this run (repository=new-ui)
"prsRemaining": 99
DEBUG: processBranch with 1 upgrades (repository=new-ui, dependencies=@emotion/core, branch=renovate/emotion-core-10.x)
DEBUG: Setting current branch to develop (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: latest commit (repository=new-ui, branch=renovate/emotion-core-10.x)
"branchName": "develop",
"latestCommitDate": "2020-10-20T13:37:17+03:00"
DEBUG: getBranchPr(renovate/emotion-core-10.x) (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: branchExists=false (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: Branch has 1 upgrade(s) (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: recreateClosed is false (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: findPr(renovate/emotion-core-10.x, chore(deps): renovate: dependency @emotion/core to ^10.0.35, !open) (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: prAlreadyExisted=false (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: Checking schedule(at any time, null) (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: No schedule defined (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: Branch needs creating (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: Using reuseExistingBranch: false (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: manager.getUpdatedPackageFiles() (repository=new-ui, branch=renovate/emotion-core-10.x)
"reuseExistingBranch": false,
"branchName": "renovate/emotion-core-10.x"
DEBUG: npm.updateDependency(): dependencies.@emotion/core = ^10.0.35 (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: Updating packageFile content (repository=new-ui, packageFile=package.json, branch=renovate/emotion-core-10.x)
"depName": "@emotion/core"
DEBUG: Updated 1 package files (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: Getting updated lock files (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: lock file dirs (repository=new-ui, branch=renovate/emotion-core-10.x)
"dirs": {
"yarnLockDirs": [],
"npmLockDirs": ["package-lock.json"],
"pnpmShrinkwrapDirs": [],
"lernaDirs": []
}
DEBUG: Writing repo .npmrc (/tmp/renovate/repos/gitlab/new-ui) (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: Writing package.json files (repository=new-ui, branch=renovate/emotion-core-10.x)
"packageFiles": ["package.json"]
DEBUG: Writing package-lock.json (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: Writing any updated package files (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: Writing package.json (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: npmrc file found in repository (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: Generating package-lock.json for . (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: Spawning npm install to create /tmp/renovate/repos/gitlab/new-ui/package-lock.json (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: Updating lock file only (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: No node constraint found - using latest (repository=new-ui, branch=renovate/emotion-core-10.x)
DEBUG: Executing command (repository=new-ui, branch=renovate/emotion-core-10.x)
"command": "npm install --package-lock-only --ignore-scripts --no-audit"
DEBUG: lock file error (repository=new-ui, branch=renovate/emotion-core-10.x)
"err": {
"killed": false,
"code": 7,
"signal": null,
"cmd": "npm install --package-lock-only --ignore-scripts --no-audit",
"stdout": "",
"stderr": "Error: Failed to replace env in config: ${NPM_TOKEN}\n
Where is the ${NPM_TOKEN}
coming from? Is that an .npmrc
file you have committed to the repo?
Yes, I have the next step in my CI
nightly-build:
stage: pre-build
before_script:
- *npm_login
script:
- .gitlab/steps/nightly-build.sh
dependencies: []
.npm_login: &npm_login |
#!/bin/sh
echo '//npm.***.io/:_authToken=${NPM_TOKEN}'>~/.npmrc
echo '//npm.gke.***.ru/:_authToken=${NPM_TOKEN}'>~/.npmrc
echo 'unsafe-perm = true'>>~/.npmrc
nightly-build.sh
#!/bin/bash
[[ "$TRACE" ]] && set -o xtrace
set -o pipefail
set -o errexit
NODE_ENV=development npm install --unsafe-perm
npm run --if-present nightly
npx renovate new-ui --dry-run true --onboarding false --print-config=true --platform "gitlab" --require-config true --token "${GITLAB_TOKEN}" --endpoint="${GITLAB_URL}/api/v4/" --onboarding-config "{\"baseBranches\":[\"develop\"],\"enabledManagers\":[\"npm\"],\"prFooter\":\"This PR has been generated by renovate\"}" --npmrc="${RENOVATE_NPMRC}" --log-level="debug"
If you must add that .npmrc
file then you could try setting --trust-level=high
so that all env is passed from Renovate to child processes.
@leoShabalkin if you use gitlab runner for renovate, you shoud use --endpoint="${CI_API_V4_URL}"
instead of --endpoint="${GITLAB_URL}/api/v4/"
Thanks, with the parameter trust-level everything worked as I planned.
Which Renovate are you using?
npx renovate new-ui --dry-run true --onboarding false --print-config=true --platform "gitlab" --require-config true --token "${GITLAB_TOKEN}" --endpoint="${GITLAB_URL}/api/v4/" --ignore-npmrc-file true --onboarding-config "{\"baseBranches\":[\"develop\"],\"enabledManagers\":[\"npm\"],\"prFooter\":\"This PR has been generated by renovate\"}" --npmrc="${NPMRC}" --log-level="debug"
I also tried to add a parameter --npm-token="${NPM_TOKEN}"Which platform are you using?
GitLab self-hosted
Have you checked the logs? Don't forget to include them if relevant