Closed marceloavf closed 5 years ago
Hi, sorry to hear that, which version of the tasks are you using and in addition, can you provide the full debug log of the task as mentioned here: https://github.com/geeklearningio/gl-vsts-tasks-yarn/wiki/How-to-Report-an-issue
Version 2.4.999
Seems that VSTS don't pass environments variables inside the task, I was trying to reach a way to store this in the agent, but the only way I found was to set it in the system, but anyone who have access to the system can see the variable
2017-12-18T09:09:29.4183769Z ##[debug]Evaluating condition for step: 'yarn run release'
2017-12-18T09:09:29.4183769Z ##[debug]Evaluating: succeeded()
2017-12-18T09:09:29.4183769Z ##[debug]Evaluating succeeded:
2017-12-18T09:09:29.4183769Z ##[debug]=> (Boolean) True
2017-12-18T09:09:29.4183769Z ##[debug]Expanded: True
2017-12-18T09:09:29.4183769Z ##[debug]Result: True
2017-12-18T09:09:29.4183769Z ##[section]Starting: yarn run release
2017-12-18T09:09:29.4213777Z ==============================================================================
2017-12-18T09:09:29.4213777Z Task : Yarn task
2017-12-18T09:09:29.4213777Z Description : Executes Yarn
2017-12-18T09:09:29.4213777Z Version : 2.4.999
2017-12-18T09:09:29.4213777Z Author : Geek Learning
2017-12-18T09:09:29.4213777Z Help : [More Information](https://github.com/geeklearningio/gl-vsts-tasks-yarn/wiki/Yarn) (Version 2.4.999).
Dear Angular and Ember CLI users, please check our [known issues](https://github.com/geeklearningio/gl-vsts-tasks-yarn/wiki/Known-Issues)
2017-12-18T09:09:29.4213777Z ==============================================================================
2017-12-18T09:09:29.9984104Z ##[debug]agent.workFolder=C:\agent\_work
2017-12-18T09:09:30.0044111Z ##[debug]loading inputs and endpoints
2017-12-18T09:09:30.0054112Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2017-12-18T09:09:30.0074115Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2017-12-18T09:09:30.0074115Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2017-12-18T09:09:30.0084129Z ##[debug]loading INPUT_ARGUMENTS
2017-12-18T09:09:30.0084129Z ##[debug]loading INPUT_CUSTOMREGISTRY
2017-12-18T09:09:30.0094117Z ##[debug]loading INPUT_PRODUCTIONMODE
2017-12-18T09:09:30.0094117Z ##[debug]loading INPUT_PROJECTDIRECTORY
2017-12-18T09:09:30.0104114Z ##[debug]loading SECRET_CSC_KEY_PASSWORD
2017-12-18T09:09:30.0104114Z ##[debug]loading SECRET_GH_TOKEN
2017-12-18T09:09:30.0114115Z ##[debug]loaded 9
2017-12-18T09:09:30.6034447Z ##[debug]check path : C:\agent\_work\_tasks\Yarn_0888c9a9-d1b2-4567-aae2-beadcb2059b3\2.4.999\task.json
2017-12-18T09:09:30.6034447Z ##[debug]set resource file to: C:\agent\_work\_tasks\Yarn_0888c9a9-d1b2-4567-aae2-beadcb2059b3\2.4.999\task.json
2017-12-18T09:09:30.6034447Z ##[debug]system.culture=en-US
2017-12-18T09:09:30.7194516Z ##[debug]which 'yarn'
2017-12-18T09:09:30.7304529Z ##[debug]found: 'C:\Program Files (x86)\Yarn\bin\yarn.cmd'
2017-12-18T09:09:30.7324527Z ##[debug]Arguments=run release
2017-12-18T09:09:30.7324527Z ##[debug]ProjectDirectory=C:\agent\_work\4\s
2017-12-18T09:09:30.7334528Z ##[debug]customRegistry=useNpmrc
2017-12-18T09:09:30.7344529Z ##[debug]customFeed=null
2017-12-18T09:09:30.7344529Z ##[debug]customEndpoint=null
2017-12-18T09:09:30.7364527Z ##[debug]C:\Program Files (x86)\Yarn\bin\yarn.cmd
2017-12-18T09:09:30.7364527Z ##[debug]Build.BuildId=1057
2017-12-18T09:09:30.7364527Z ##[debug]Agent.BuildDirectory=C:\agent\_work\4
2017-12-18T09:09:30.7374533Z ##[debug]testing directory 'C:\agent\_work\4\npm'
2017-12-18T09:09:30.7374533Z ##[debug]testing directory 'C:\agent\_work\4'
2017-12-18T09:09:30.7374533Z ##[debug]mkdir 'C:\agent\_work\4\npm'
2017-12-18T09:09:30.7454534Z ##[debug]Npm.PackagingCollectionUrl=undefined
2017-12-18T09:09:30.7454534Z ##[debug]System.TeamFoundationCollectionUri=https://precisaosistemas.visualstudio.com/
2017-12-18T09:09:30.7604539Z ##[debug]Found 0 registries in this account/collection
2017-12-18T09:09:30.7644539Z ##[debug]Using registries in .npmrc
2017-12-18T09:09:30.7644539Z ##[debug]customEndpoint=null
2017-12-18T09:09:30.7644539Z ##[debug]which 'yarn'
2017-12-18T09:09:30.7754548Z ##[debug]found: 'C:\Program Files (x86)\Yarn\bin\yarn.cmd'
2017-12-18T09:09:30.7754548Z ##[debug]which 'yarn'
2017-12-18T09:09:30.7854555Z ##[debug]found: 'C:\Program Files (x86)\Yarn\bin\yarn.cmd'
2017-12-18T09:09:30.7854555Z ##[debug]ProductionMode=false
2017-12-18T09:09:30.7864557Z ##[debug]C:\Program Files (x86)\Yarn\bin\yarn.cmd arg: run release
2017-12-18T09:09:30.7874558Z ##[debug]OverridingProjectNpmrc: C:\agent\_work\4\s\.npmrc
2017-12-18T09:09:30.7874558Z ##[debug]Agent.BuildDirectory=C:\agent\_work\4
2017-12-18T09:09:30.7874558Z ##[debug]Saving file C:\agent\_work\4\s\.npmrc
2017-12-18T09:09:30.7894560Z ##[debug]rm -rf C:\agent\_work\4\s\.npmrc
2017-12-18T09:09:30.7894560Z ##[debug]removing file
2017-12-18T09:09:30.7924559Z ##[debug]exec tool: C:\Program Files (x86)\Yarn\bin\yarn.cmd
2017-12-18T09:09:30.7924559Z ##[debug]arguments:
2017-12-18T09:09:30.7924559Z ##[debug] run
2017-12-18T09:09:30.7924559Z ##[debug] release
2017-12-18T09:09:30.7984562Z [command]C:\WINDOWS\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Yarn\bin\yarn.cmd" run release"
2017-12-18T09:09:31.8985191Z yarn run v1.3.2
2017-12-18T09:09:32.0725290Z $ node .electron-vue/build.js && electron-builder --win
2017-12-18T09:09:36.8188013Z
2017-12-18T09:09:36.8198015Z lets-build
2017-12-18T09:09:36.8198015Z
2017-12-18T09:09:36.8268014Z [?25l - building main process
2017-12-18T09:09:36.8268014Z - building renderer process
2017-12-18T09:10:38.6413417Z
2017-12-18T09:10:38.6413417Z
2017-12-18T09:10:38.6413417Z OKAY take it away `electron-builder`
2017-12-18T09:10:38.6413417Z
2017-12-18T09:10:39.7804067Z [?25helectron-builder 19.49.0
2017-12-18T09:10:49.5659672Z No native production dependencies
2017-12-18T09:10:49.6239702Z Packaging for win32 x64 using electron 1.7.9 to build\win-unpacked
2017-12-18T09:11:12.6842912Z Signing INOVAFARMA Notificações.exe (subject: "CN=Precis�o Sistemas, O=Precis�o Sistemas, L=Jales, C=BR", thumbprint: "8E0EBF08EC68D95B6C49002524061AA8D4851F5F", store: My (current user))
2017-12-18T09:11:21.5197967Z No native production dependencies
2017-12-18T09:11:21.5217969Z Packaging for win32 ia32 using electron 1.7.9 to build\win-ia32-unpacked
2017-12-18T09:11:41.8639616Z Signing INOVAFARMA Notificações.exe (subject: "CN=Precis�o Sistemas, O=Precis�o Sistemas, L=Jales, C=BR", thumbprint: "8E0EBF08EC68D95B6C49002524061AA8D4851F5F", store: My (current user))
2017-12-18T09:11:44.9611391Z Building nsis-web installer (x64 and ia32)
2017-12-18T09:12:26.9705453Z Signing NSIS uninstaller (subject: "CN=Precis�o Sistemas, O=Precis�o Sistemas, L=Jales, C=BR", thumbprint: "8E0EBF08EC68D95B6C49002524061AA8D4851F5F", store: My (current user))
2017-12-18T09:12:30.0477208Z Signing inovafarma-notificacoes-1.19.1-win.exe (subject: "CN=Precis�o Sistemas, O=Precis�o Sistemas, L=Jales, C=BR", thumbprint: "8E0EBF08EC68D95B6C49002524061AA8D4851F5F", store: My (current user))
2017-12-18T09:12:31.7688204Z Error: Cannot cleanup:
2017-12-18T09:12:31.7688204Z
2017-12-18T09:12:31.7688204Z Error #1 --------------------------------------------------------------------------------
2017-12-18T09:12:31.7688204Z Error: GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN"
2017-12-18T09:12:31.7688204Z at new GitHubPublisher (C:\agent\_work\4\s\node_modules\electron-publish\src\gitHubPublisher.ts:54:15)
2017-12-18T09:12:31.7688204Z at createPublisher (C:\agent\_work\4\s\node_modules\electron-builder-lib\src\publish\PublishManager.ts:235:14)
2017-12-18T09:12:31.7688204Z at PublishManager.getOrCreatePublisher (C:\agent\_work\4\s\node_modules\electron-builder-lib\src\publish\PublishManager.ts:160:19)
2017-12-18T09:12:31.7688204Z at PublishManager.scheduleUpload (C:\agent\_work\4\s\node_modules\electron-builder-lib\src\publish\PublishManager.ts:111:28)
2017-12-18T09:12:31.7688204Z at C:\agent\_work\4\s\node_modules\electron-builder-lib\src\publish\PublishManager.ts:144:14
2017-12-18T09:12:31.7688204Z at Generator.next (<anonymous>)
2017-12-18T09:12:31.7688204Z at runCallback (timers.js:789:20)
2017-12-18T09:12:31.7688204Z at tryOnImmediate (timers.js:751:5)
2017-12-18T09:12:31.7688204Z From previous event:
2017-12-18T09:12:31.7688204Z at PublishManager.artifactCreated (C:\agent\_work\4\s\node_modules\electron-builder-lib\out\publish\PublishManager.js:408:11)
2017-12-18T09:12:31.7688204Z at EventEmitter.PublishManager.packager.artifactCreated.event (C:\agent\_work\4\s\node_modules\electron-builder-lib\src\publish\PublishManager.ts:95:39)
2017-12-18T09:12:31.7698200Z at emitOne (events.js:121:20)
2017-12-18T09:12:31.7698200Z at EventEmitter.emit (events.js:211:7)
2017-12-18T09:12:31.7698200Z at Packager.dispatchArtifactCreated (C:\agent\_work\4\s\node_modules\electron-builder-lib\src\packager.ts:214:23)
2017-12-18T09:12:31.7698200Z at WinPackager.dispatchArtifactCreated (C:\agent\_work\4\s\node_modules\electron-builder-lib\src\platformPackager.ts:107:15)
2017-12-18T09:12:31.7698200Z at C:\agent\_work\4\s\node_modules\electron-builder-lib\src\targets\nsis\NsisTarget.ts:171:20
2017-12-18T09:12:31.7698200Z at Generator.next (<anonymous>)
2017-12-18T09:12:31.7698200Z at C:\agent\_work\4\s\node_modules\graceful-fs\graceful-fs.js:99:16
2017-12-18T09:12:31.7698200Z at C:\agent\_work\4\s\node_modules\graceful-fs\graceful-fs.js:43:10
2017-12-18T09:12:31.7698200Z at FSReqWrap.oncomplete (fs.js:135:15)
2017-12-18T09:12:31.7698200Z From previous event:
2017-12-18T09:12:31.7698200Z at default.map (C:\agent\_work\4\s\node_modules\electron-builder-lib\out\targets\nsis\NsisTarget.js:273:37)
2017-12-18T09:12:31.7698200Z From previous event:
2017-12-18T09:12:31.7698200Z at C:\agent\_work\4\s\node_modules\electron-builder-lib\src\targets\nsis\NsisTarget.ts:154:29
2017-12-18T09:12:31.7698200Z at Generator.next (<anonymous>)
2017-12-18T09:12:31.7698200Z at runCallback (timers.js:789:20)
2017-12-18T09:12:31.7698200Z at tryOnImmediate (timers.js:751:5)
2017-12-18T09:12:31.7708228Z at processImmediate [as _immediateCallback] (timers.js:722:5)
2017-12-18T09:12:31.7708228Z From previous event:
2017-12-18T09:12:31.7708228Z at WebInstallerTarget.buildInstaller (C:\agent\_work\4\s\node_modules\electron-builder-lib\out\targets\nsis\NsisTarget.js:317:11)
2017-12-18T09:12:31.7708228Z at C:\agent\_work\4\s\node_modules\electron-builder-lib\src\targets\nsis\NsisTarget.ts:92:18
2017-12-18T09:12:31.7708228Z at Generator.next (<anonymous>)
2017-12-18T09:12:31.7708228Z From previous event:
2017-12-18T09:12:31.7708228Z at WebInstallerTarget.finishBuild (C:\agent\_work\4\s\node_modules\electron-builder-lib\out\targets\nsis\NsisTarget.js:200:11)
2017-12-18T09:12:31.7708228Z at C:\agent\_work\4\s\node_modules\electron-builder-lib\src\packager.ts:353:36
2017-12-18T09:12:31.7708228Z From previous event:
2017-12-18T09:12:31.7708228Z at Packager.doBuild (C:\agent\_work\4\s\node_modules\electron-builder-lib\out\packager.js:407:11)
2017-12-18T09:12:31.7708228Z at C:\agent\_work\4\s\node_modules\electron-builder-lib\src\packager.ts:289:52
2017-12-18T09:12:31.7708228Z From previous event:
2017-12-18T09:12:31.7708228Z at Packager._build (C:\agent\_work\4\s\node_modules\electron-builder-lib\out\packager.js:351:11)
2017-12-18T09:12:31.7708228Z at C:\agent\_work\4\s\node_modules\electron-builder-lib\src\packager.ts:259:23
2017-12-18T09:12:31.7708228Z at Generator.next (<anonymous>)
2017-12-18T09:12:31.7708228Z at runCallback (timers.js:789:20)
2017-12-18T09:12:31.7708228Z at tryOnImmediate (timers.js:751:5)
2017-12-18T09:12:31.7708228Z at processImmediate [as _immediateCallback] (timers.js:722:5)
2017-12-18T09:12:31.7708228Z From previous event:
2017-12-18T09:12:31.7708228Z at Packager.build (C:\agent\_work\4\s\node_modules\electron-builder-lib\out\packager.js:311:11)
2017-12-18T09:12:31.7718207Z at C:\agent\_work\4\s\node_modules\electron-builder\src\builder.ts:287:40
2017-12-18T09:12:31.7718207Z at Generator.next (<anonymous>)
2017-12-18T09:12:31.7718207Z From previous event:
2017-12-18T09:12:31.7718207Z at _build (C:\agent\_work\4\s\node_modules\electron-builder\out\builder.js:61:21)
2017-12-18T09:12:31.7718207Z at build (C:\agent\_work\4\s\node_modules\electron-builder\src\builder.ts:257:10)
2017-12-18T09:12:31.7718207Z at then (C:\agent\_work\4\s\node_modules\electron-builder\src\cli\cli.ts:49:4)
2017-12-18T09:12:31.7718207Z at runCallback (timers.js:789:20)
2017-12-18T09:12:31.7718207Z at tryOnImmediate (timers.js:751:5)
2017-12-18T09:12:31.7718207Z at processImmediate [as _immediateCallback] (timers.js:722:5)
2017-12-18T09:12:31.7718207Z From previous event:
2017-12-18T09:12:31.7718207Z at Object.args [as handler] (C:\agent\_work\4\s\node_modules\electron-builder\src\cli\cli.ts:49:4)
2017-12-18T09:12:31.7718207Z at Object.runCommand (C:\agent\_work\4\s\node_modules\electron-builder\node_modules\yargs\lib\command.js:228:22)
2017-12-18T09:12:31.7718207Z at Object.parseArgs [as _parseArgs] (C:\agent\_work\4\s\node_modules\electron-builder\node_modules\yargs\yargs.js:1041:24)
2017-12-18T09:12:31.7718207Z at Object.get [as argv] (C:\agent\_work\4\s\node_modules\electron-builder\node_modules\yargs\yargs.js:957:21)
2017-12-18T09:12:31.7718207Z at Object.<anonymous> (C:\agent\_work\4\s\node_modules\electron-builder\src\cli\cli.ts:43:15)
2017-12-18T09:12:31.7718207Z at Module._compile (module.js:635:30)
2017-12-18T09:12:31.7718207Z at Object.Module._extensions..js (module.js:646:10)
2017-12-18T09:12:31.7718207Z at Module.load (module.js:554:32)
2017-12-18T09:12:31.7718207Z at tryModuleLoad (module.js:497:12)
2017-12-18T09:12:31.7718207Z at Function.Module._load (module.js:489:3)
2017-12-18T09:12:31.7728200Z at Function.Module.runMain (module.js:676:10)
2017-12-18T09:12:31.7728200Z at startup (bootstrap_node.js:187:16)
2017-12-18T09:12:31.7728200Z at bootstrap_node.js:608:3
2017-12-18T09:12:31.7728200Z
2017-12-18T09:12:31.7968211Z error Command failed with exit code 1.
2017-12-18T09:12:31.7968211Z info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2017-12-18T09:12:31.8218232Z ##[debug]rc:1
2017-12-18T09:12:31.8218232Z ##[debug]success:false
2017-12-18T09:12:31.8258232Z ##[debug]Error: C:\Program Files (x86)\Yarn\bin\yarn.cmd failed with return code: 1
2017-12-18T09:12:31.8258232Z ##[debug]Error: C:\Program Files (x86)\Yarn\bin\yarn.cmd failed with return code: 1
at ChildProcess.<anonymous> (C:\agent\_work\_tasks\Yarn_0888c9a9-d1b2-4567-aae2-beadcb2059b3\2.4.999\node_modules\vsts-task-lib\toolrunner.js:568:30)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:886:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
2017-12-18T09:12:31.8258232Z ##[debug]task result: Failed
2017-12-18T09:12:31.8348261Z ##[error]Error: C:\Program Files (x86)\Yarn\bin\yarn.cmd failed with return code: 1
2017-12-18T09:12:31.8348261Z ##[debug]Processed: ##vso[task.issue type=error;]Error: C:\Program Files (x86)\Yarn\bin\yarn.cmd failed with return code: 1
2017-12-18T09:12:31.8348261Z ##[debug]Processed: ##vso[task.complete result=Failed;]Error: C:\Program Files (x86)\Yarn\bin\yarn.cmd failed with return code: 1
2017-12-18T09:12:31.8358240Z ##[debug]Agent.BuildDirectory=C:\agent\_work\4
2017-12-18T09:12:31.8358240Z ##[debug]rm -rf C:\agent\_work\4\npm
2017-12-18T09:12:31.8358240Z ##[debug]removing directory
2017-12-18T09:12:31.8428240Z ##[section]Finishing: yarn run release
Ok so what I undestand is:
You need a way to make this environment variable available to your custom script?
Exactly @sandorfr, that's what I need, I already tried cross-env, but VSTS doesn't understand, even set in another task, seems that it doesn't send the env var to the next task.
Allow me some time to investigate as I'm quite busy on another front :).
No problem, I appreciated your help, I'll try another way to advance the work, I'll post here if I find a solution, thanks!
Hi @marceloavf,
Sorry I didn't have the time to look into it earlier. basically secret variables are not available as environement variables. They can only be consumed explicitly through the tasks inputs as explained in this issue there's apparently a way around that with the new YAML builds but it's not there yet for regular builds.
By any chance, have you solved your issue any other way?
I might consider adding some environment mapping feature.
PS: it's also documented in the official docs : https://docs.microsoft.com/en-us/vsts/build-release/concepts/definitions/build/variables?tabs=batch#secret-variables
Hello @sandorfr
I got a way around by setting the variable into environment of the system of the agent and let the build see these variables, I don't know if it's the best way, but it's working properly.
It would be good to have some environment mapping feature for sure, but take your time.
What I consider too was to try to pass them to the power shell task and call the yarn inside, but I don't know if it works too.
Anyway, thanks for your patience and help in research it.
I think one easy way to do it would be to make your script accepts command line arguments and pass the secret through the Arguments fields it would give something like:
run release -- --GH_TOKEN $(GH_TOKEN)
I've tried that but seems we can't pass like that to don't expose the variable as shown in this issue: https://github.com/electron-userland/electron-builder/issues/2226
Yes it wouldn't work just like that, the variable has to be resolved by the build agent so it has to be given through the vsts task Arguments field. and your release script should accept that as a command line argument.
Nice! that should be a feature from yarn task ?
Yes and no, you can do that today. All you have to do is replacing whatever you have in your release script by a script which accepts an argument as explained in my previous comment : https://github.com/geeklearningio/gl-vsts-tasks-yarn/issues/40#issuecomment-355859363
I'll test it soon, so then if it doesn't work I should get in contact with the owner of electron-builder
to make it possible?
Since if I directly try to input it expose inside the config file. He suggested to use set/cross-env but seems to not work.
If you can extract some hello-world sample repo sample I might be able to guide you.
@marceloavf it's now dead easy with Yaml Builds. Example here : https://github.com/geeklearningio/gl-vsts-tasks-yarn/issues/54#issuecomment-447568522
I'm receiving an error when trying to release with yarn: