VSTS Build definition - Store secret with special character removes characters automatically - xamarin.android

In VSTS Build definition (for building Xamarin.Android project in Mac Build Agent) the keystore password is added as a secret in Build variables tab. The TFS is automatically stripping of double quotes and convert "\" to "/"
Can someone tell me how to escape these characters?

Related

Team Foundation version control commands fails when password has double quotes in it

I am using microsoft tfs command line client. Its CLC zip is obtained from here.
My zip is = TEE-CLC-14.134.0. Extracted in dir = C:\mstfscmdclient
Issue - Whenever TFS user password has double quotes in them, tf commands fail.
Example -
call mstfscmdclient\tf.cmd workspaces /collection:<my tfs server url> /login:<my tfs username>,<my tfs password>
This command fails when passwords are with double quotes like Abcd#"2018, Abc"&<=2018 etc.
Same command works when passwords are without double quotes like Abcd#2018'', A~``$%^&<=#18b etc.
Error -
An error occurred: Access denied connecting to TFS server <my tfs server url> (Authenticating as <my tfs username>)
Please note that I must use CLC client only and must execute TFS operations using tf.cmd only. This is approved at my org level and cant be changed. So, solutions from Visual Studio, tf.exe etc tools are not useful for me.
I have gone through following official documentation but did not get details about password policies or any limitations.
[ Azure DevOps & TFS / Azure Repos / TFVC / Reference / TFVC command reference / Use Team Foundation version control commands]
and
[ Docs / Previous Versions / Visual Studio / Team Foundation Version Control Command-Line Reference / Tf Command-Line Utility Commands]
Edit 2 - This question is not duplicate of Escaping special characters in cmd.
Many passwords are not working with the solution proposed in it.
For eg - Year<"%^&*2018 did not work when called tf.cmd with "Year<""%^&*2018", "Year<""%^&&*2018", "Year<""%^^&&*2018", "Year<""%%^^&&*2018".

How to deal Semantic Versioning on Jenkins

I'm beginning on Jenkins in my work place. We use semantic versioning with Teamcity and I want to implement the same on Jenkins. My problem appears when I store the artifacts in builds folder ($JENKINS_HOME/jobs/$JOB_NAME/builds/$BUILD_NUMBER) because Jenkins use only the build_number to create the folder for build so when I have to reset de Build_number the future artifacts will be stored in the folder of previous builds.
For example:
I have build 1.3.1_develop.1 stored, when I reset Build_Number the next build should be 1.3.2_develop.1 and it should be stored in the
folder 1 of build 1.3.1_develop.1
My question is if someone could explain me how to deal with automatic semantic versioning on jenkins because we reset the build number we increase the mayor, minor and patch number.
Jenkins Version: 2.89.4
Jobs--> We use jobs to compile Vuejs for front and to deploy back with python (If this helps)
Thanks for any help.
First thing I notice is you are not using semantic versioning correctly. 1.3.1_develop.1 should be 1.3.1-develop+1. Build metadata should always be preceded by the plus '+' symbol and is not factored into the SemVer sort order.
Second, build number is never "reset", it might roll-over eventually, but it should never be reset. A build number that does not indicate the machine performing the build is also generally useless unless there can only ever be one.
Basically, there's no concept of a build number in semantic versioning. The standard specifies the syntax for build meta data, but is completely neutral on what might be included. Build numbers are generally useless at the level of semantic versioning. They have their uses for preventing directory collisions in CI build systems and even provide a unique identifier for some product lines (Windows for instance), particularly where semantic versioning is not in use (Windows again).
I recommend using a SHA-1 or better hash of the build inputs (Git commit Id for instance) in the build meta tag in addition to any build counter, and use that for your output directory name. You can still use a monotonic counter on your prerelease tags as well, but you would have to create a build output directory name that includes the entire semver string in order to maintain uniqueness.
Third, your build machine is the worst place to archive your build artifacts! Build automation can and does go horribly wrong from time to time. Your build system should not have access to your archive of build artifacts. When your build and initial smoke testing is completed, it should signal a process running on a completely different machine to move the artifacts off the build machine to a more secure location. No process running on the build system should have write access to your archive of build artifacts.
There is a tool GitVersion which does what you want and it can be integrated with Jenkins or other CI providers.
https://gitversion.net/docs/reference/build-servers/jenkins

Team Foundation 2015 Environment variable PATH not recognized

I have a TFS 2015 build in which I want to run command 'dotnet restore'. On my build machine, the path to dotnet.exe is part of my environment variable 'Path'. When running the command from command prompt window, it works fine. When trying to run it via a TFS build step of type 'Command line' dotnet is not recognized. My path variable containing dotnet.exe path is at system level, so every users, including the one on which my build agent is running, should see it.
I have tested with TFS 2015.3, after adding dotnet.exe path in Environment Variables and add Command Line step in build definition, dotnet.exe can be recognized in the following setting. You may compare it with yours:
FYI, this is still an issue with TFS 2017 as well. From my tests, it appears TFS doesn't like when the PATH variable is over 900 characters. After shortening the PATH variable and closing the dialog windows, restart the VSO/VSTS agent services and you should see the Path variable appear as a capability for the agent. Hopefully this helps someone else.

How to provide password to MSBUILD runtime and use that in Powershell script

I want MSBUILD show a POPup to enter password during/before execution of build definition.I want to pass this password to powershell script I will be running as part of MSBuild definition.
I already implemented a scenario where password is encrypted in a file checked-in on TFS and is read by powershell(MSBUILD) while executing a build definition.But for security purposes I want password to be entered by a build definition invoker during runtime .
Can we achieve this ?
I am using TFS 2013,MSBUILD 12.0 and VS 2013 for this purpose.And can use only these tools and nothing else.
You can customise the xaml file to take a password as part of queuing the build from VS or Web Access.
https://msdn.microsoft.com/en-us/library/dd647551.aspx
You can add a custom property and pass it in...

Jenkins CI clang scan-build with prefix environment

I'm using Jenkins CI on Mac Server with clang scan-build plugin.
After I build an iOS app, and run scan-build command, Then the graph will appear on right corner. When I click the edge on the graph, page says "404 Not found" because of the prefix /jenkins is not in URL. How can I fix this issue and it this a bug of this plugin?
Double check the settings of Jenkins Location in the Manage Jenkinstool, under Configure System.
This should be set to the base URL for your Jenkins server, which should include /jenkins/ according to your post. Make sure to leave the trailing slash in the URL.

Resources