Exclude commands from PR build
I have some commands that rely on environment variables to execute. For example:
after_build:
..
- secure-file\tools\secure-file -decrypt src\myfile.txt.enc -secret %dec_secret%
..
However, I do not want this to run on PR builds because the environment variables are not available. How do I enable certain commands to not run on PR builds?
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Feodor Fitsner on 11 Feb, 2017 11:11 PM
You can use something like:
2 Posted by kyle.spearrin on 11 Feb, 2017 11:46 PM
Is this possible with other parts of the config file as well? For example, I only have an artifact to attach if the environment variables are set in an earlier part of the build (env vars are needed to produce the artifact) so I imagine this will fail if the file does not exist?
artifacts:
- path: com.package-%APPVEYOR_BUILD_NUMBER%.apk
3 Posted by Ilya Finkelshte... on 13 Feb, 2017 09:26 AM
Hi Kyle,
Build will not fail, it will just write warning like
No artifacts found matching 'com.package-123.apk' path
assuming123
is build number.Ilya.
4 Posted by kyle.spearrin on 14 Feb, 2017 03:44 AM
Great! Last question to wrap this one up:
What does the syntax look like for powershell command? Something like this?
after_build:
- ps: IF($env:myvar) copy-item file1.txt .\file2-$($env:myvar).txt
Support Staff 5 Posted by Feodor Fitsner on 14 Feb, 2017 04:20 AM
Correct.
6 Posted by kyle.spearrin on 14 Feb, 2017 04:21 AM
Thanks all! This is now resolved.
Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:14 AM.