I am trying to setup CI for a ASP.NET project. There is a publish profile defined in VS, which is working fine. (I can deploy the page to a remote IIS server.)
I want to automate this, using GitLab, so I am looking for a command line equivalent of the publish action of VS.
The publish profile files that VS is using can be found under Properties\PublishProfiles. I have 2 files here:
myServer.pubxml (contains the username to use for deploy, and other server data, like hostname)
myServer.pubxml.user (contains the encrypted password for the user)
My attempts to deploy/publish on the command line:
dotnet publish /p:PublishProfile=myServer.pubxml
This results in the following error:
MSDEPLOY : error Code: ERROR_USER_UNAUTHORIZED [C:\Users\myUser\source\repos\Beam Time Request\BeantimeRequest\BeantimeRequest.csproj] Error : The remote server returned an error : (401) Unauthorized. [C:\Users\myUser\source\repos\Beam Time Request\BeantimeRequest\BeantimeRequest.csproj] MSDEPLOY : error count: 1. [C:\Users\myUser\source\repos\Beam Time Request\BeantimeRequest\BeantimeRequest.csproj]
Which is logical, as I have not defined the password.
I can set the password on the command line, like this:
dotnet publish /p:PublishProfile=myServer.pubxml /p:password=myPassword
And this works, but I want to avoid having the password written in plain text.
So how could I tell dotnet publish to use the password from the myServer.pubxml.user file?
If anyone come across this:
I solved this with a GitLab Secret, as follows:
Defined a new GitLab Secret for the repository, called DEPLOY_PASSWD
using the following command to deploy:
dotnet publish -c Release -o Publish /p:PublishProfile=myServer.pubxml /p:password=$DEPLOY_PASSWD"
Related
I am facing troubles in installing the agent manually If I follow the installation guide in the TFS portal.
These steps not working for me and gives unexpected errors:
what are the clear steps for that?
Error like:
VS30063:You are not authorized to access http://xxx.xxx.x.xxx:8080. Failed to
connect.
it's not reasonable because I have administrator privilege in server in TFS all but I can't pass it
what about workaround
1- download agent files
2- put them at any location like C:\agents
3- at PowerShell cd C:\agents
4- .\config.cmd --deploymentgroup --deploymentgroupname "deploymentgroupname" --agent $env:COMPUTERNAME --runasservice --work '_work' --url 'http://xxx.xxx.xxx.xxx/tfs/' --collectionname 'DefaultCollection' --projectname 'projectname' --auth Negotiate;
5- enter username and password
I'm trying to setup a simple beakr service in Windows that implements the example at https://github.com/MazamaScience/beakr. I'm able to run the script from the command line successfully and I've been able to add the service in Windows using NSSM, but I am unable to start the service.
When I dig into the service error logs I see that Rscript.exe cannot be executed due to a non-specific permissions problem.
My Rscript.exe is running out of C:\Program Files\R<Version>\bin and my beakr.R script is running out of my User home directory.
If anyone has had success implementing a similar service (Web page based REST endpoint) using R in Windows, I would love to know how you did it.
This is what I did to run an R script as Service using latest pre-release version of NSSM on Windows 10:
Create a directory to store the files
In this example : C:\R\ServiceTest
Create in this directory a never ending script : ServiceTest.R
library(beepr)
# Test script : beeps every 10 seconds
while (T) {
beepr::beep(1)
if (interactive()) {
# Shows spin cursor to facilitate test in interactive mode
for (i in 1:10) {
if (i%%4==0) {cursor <- '/'}
if (i%%4==1) {cursor <- '-'}
if (i%%4==2) {cursor <- '\\'}
if (i%%4==3) {cursor <- '|'}
cat('\r',cursor)
flush.console()
Sys.sleep(1)
}
} else {
Sys.sleep(10)
}
}
I used to let this kind of script run in a console open on my desktop to check various alarms regularly.
Create a batch file to run the script : ServiceTest.bat
Rscript ServiceTest.R
Open an Admin console and make sure the batch file runs correctly:
C:\R\ServiceTest>ServiceTest.bat
C:\R\ServiceTest>Rscript ServiceTest.R
|
Cancel the batch (Ctrl+C)
Using the Admin console, install the batch file as service using NSSM :
nssm install
Set Service name : ServiceTest
Set Application path : C:\R\ServiceTest\ServiceTest.bat
Set Working directory : C:\R\ServiceTest\
Set Logon : Windows User + Password
Install Service
Open Windows Services Manager, find ServiceTest and start it : if everything went well, that's it!
If you get an error message, check Windows Event Log / Services : you can find there hints on the cause of the problem. Most common problems I encountered :
error on path
used local user instead of own user account / password to run the service
If you want to remove the service :
nssm remove ServiceTest
This replaced very nicely the many R consoles I left running in the background on my Desktop.
I see no reasons it wouldn't work with a REST endpoint.
I have CodeBuild project that works fine.
Trying to use it in CodePipeline and it failure with empty Repository and Submitter.
Failure logs are simple as:
01:34:17
[Container] 2018/03/08 01:34:10 Waiting for agent ping
01:34:17
[Container] 2018/03/08 01:34:12 Waiting for DOWNLOAD_SOURCE
There are no any settings to adjust CodeBuild phase anywhere.
How can I fix/customise it?
Recreate the build project from within CodePipeline, so it receives the source code from the provider called "CodePipeline".
Source of the information: https://apassionatechie.wordpress.com/2018/02/08/codebuild-aws-from-codepipeline-aws/
Just if somebody would need an answer.
The issue was in not precise file naming for CodeBuild stage where CodeDeploy in it's turn won't be able to pull the ZIP file.
As a fix I've added an extra command to builspec.yml
post_build:
commands:
- zip -r Application.zip target/Application-0.0.1.war
I'm trying to publish a dotnet core app to Azure. I've created a publish profile and using visual studio it all works fine. But since I'd like to setup continuous deployment I need to run the deployment using command line.
The official documentation was pretty helpful in identifying that the [ProfileName].ps1 is the best plan of attack.
However it gives no clues on how to use it.
First I ran it without parameters and got this error:
Production-publish.ps1 : The term 'Production-publish.ps1' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At line:1 char:1
+ Production-publish.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Production-publish.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Next I added the needed parameters:
.\Production-publish -packOutput 'C:\code\my-dotnetcore-proj\publish' -pubProfilePath 'Production.pubxml'
Which ran without error but didn't do ANYTHING!
How can I make the Azure depoyment via Powershell work?
After debugging through the publish-module.psm1 to figure out why nothing was getting deployed I noticed that the command is required to supply more parameters. This is how:
.\Production-publish -packOutput 'C:\code\my-dotnetcore-proj\publish' -pubProfilePath 'Production.pubxml' -publishProperties #{
'username' = '%PublishProfile.Username%'
'Password' = '%PublishProfile.Password%'
'AllowUntrustedCertificate' = false
'AuthType' = 'Basic'}
You obviously have to replace %PublishProfile.Username% and %PublishProfile.Password% and possibly modify Production-publish and Production.pubxml
Note that only the Password parameter is required (considering that the UserName is provided in your .pubxml file)
I actually ended up writing blog article on how to compile and deploy asp.net core sites with TeamCity:
How to deploy ASP.NET Core sites using Teamcity to Azure/IIS … or just command line
I am trying to run a build script and I keep getting errors during a specific svn task. When I try to build the target from the command line, I get an authentication error. When I run the build from flex builder I get an error saying "please get a newer Subversion client". From what I can tell there is a root issue that can be seen here when doing an ant -verbose:
svn_update:
[echo] Updating the project source...
[svn] Using javahl
[svn] <Update> started ...
[svn] update /Users/dave/Documents/Flex Builder 3/AssetLibrary -r HEAD --force
[svn] At revision 373.
[svn] <Update> finished.
[ant] Exiting /Users/dave/Documents/Flex Builder 3/Simulation/build-template/commonbuild.xml.
[ant] Exiting /Users/dave/Documents/Flex Builder 3/AssetLibrary/build.xml.
[echo] Updating DataService Source
...
svn_update:
[echo] Updating the project source...
[svn] Using command line
[svn] <Update> started ...
[svn] up -r HEAD /Users/dave/Documents/Flex Builder 3/DataService --non-interactive
[svn] svn: OPTIONS of 'https://svn.example.com/{redacted}': authorization failed: Could not authenticate to server: ignored NTLM challenge, rejected Basic challenge (https://svn.example.com)
[svn] <Update> failed !
[ant] Exiting /Users/dave/Documents/Flex Builder 3/Simulation/build-template/commonbuild.xml.
[ant] Exiting /Users/dave/Documents/Flex Builder 3/DataService/build.xml.
[ant] Exiting /Users/dave/Documents/Flex Builder 3/Simulation/build.xml.
As you can see, the second (failing) svn_update target is using command line, and the first (working) update is using javahl. I am using the default attributes for svn, so javahl should default to be used.
I updated my svnant jars to 1.3.0.
Would love some help with this one!
Dave
First thing that's catching my eye is that the javahl one isn't calling the update on the same directory as the last one:
/Users/david.marr/Documents/Flex Builder 3/AssetLibrary
vs.
/Users/david.marr/Documents/Flex Builder 3/DataService
It could be that there is some other SVN problem underlying and you're just getting a misleading error message. Also, are you sure url https://svn.frogdesign.com/{redacted} is being parsed correct whatnot? "{redacted}" doesn't look like ANT syntax to me, and neither a regular url.
Maybe your command line client is too old, and the server has a versioning constraint on clients allowed to connect? What does svn --version say?
I usually get the Could not authenticate to server: ignored NTLM challenge, rejected Basic challenge error I use svn update in non interactive mode (example: svn update --non-interactive > output.txt) and when my NT or Active Directory password has changed. The way to fix this would be to first run svn update > output.txt which will then prompt you for your password. Once provided, you will get the following
Authentication realm: <http://svnserver:80> SVN Server
Password for 'siacca':
-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:
<http://svnserver:80> SVN Server
can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details.
You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/cygdrive/u/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes
Once this is done (I'm with you, I don't like storing my password unencrypted either, but this is the only way I can run automated nightly svn updates), you should be able to run svn update in non-interactive mode.