I installed a GitLab runner in a Build server and registered a runner for a Project I have in GitLab.
The Build Stage has the following in the first line:
'D:\scripts\NuGet\NuGet.exe restore %CI_PROJECT_DIR%%SOLUTION_FILE%'
I already verified %SOLUTION_FILE%' has the right value however I get the following error:
Cannot locate a solution file.
I already checked everything I could think of but I can't figure out why it can't find the solution file.
Related
Im a newbie to azure and maven. I have created a build pipeline and it is dropping artifacts to Build.ArtifactDirectory. In CD pipeline, there is a java class which uses System.getProperty("user.dir"). But this path is taking wrongly and it throws ClassNotFoundException.
Reason for this:
Actual artifacts in cd after drop is present in path: C:/agent1/1/a/buildpipeline/drop/s/TestCode/src/main/read.java
user.dir : is searching in path: C:/agent1/1/a/ in which the code is not available.
Fix the issue:
To fix this, i need to manually pass the user.dir value through maven commandline that is -Duser.dir="pathname". But this is not working
I can change the artifact drop path from build pipeline and include a task of download artifact in release pipeline - Is not working because, I need to add a maven task to integrate pom.xml and it is automatically showing the path C:/agent1/1/a/buildpipeline/drop/s/TestCode/pom.xml.
Please help me with a solution
Have a Jenkins Pipeline that downloads a testing repo from bitbucket then does the following:
gradle build --refresh-dependencies
One of the dependencies is as follows:
compile 'org.codehaus.groovy:groovy-all:2.5.5'
We have the Pipeline running every 30min, and at least 3-4 times a day a build will fail with the following error:
Could not determine artifacts for org.codehaus.groovy:groovy-all:2.5.5
> Could not get resource '<pathToResource>/org/codehaus/groovy/groovy-all/2.5.5/grovy-all-2.5.5.jar'.
> Could not HEAD '<pathToResource>/org/codehaus/groovy/groovy-all/2.5.5/grovy-all-2.5.5.jar'.
> Read timed out
I've tried upgrading the version of groovy-all, as well as specifying the ext/type as pom. When specifying the type I get a new error as follows:
> Cannot infer Groovy class path because no Groovy Jar was found on class path:
As I said this only happens about 3-4 times a day, out of 48 builds a day, so it's very inconsistent and happens at random intervals.
We can't revert groovy-all to a previous version where the .jar exists, so is there any solution to resolve this?
You say the problem is intermittent so it sounds like you are timing out when downloading the artefact. Are you caching it locally (Artifactory, Nexus or similar)? If not, look into doing so. If you are caching locally, I'd check if something is flushing the cache
I want to deploy my .Net project from GitHub repository to the azure server.
In Deployment options I am getting Building failed error.
Here are screen shots of my Deployment details and Logs
1- Deployment Details:
2- Activity Log:
According to your description and logs, I found you have error in MSbuild step.
The error shows some files not found in your project. I suggest you could exclude the related files in the csproj file or make sure the related files is in your project.
Besides, I suggest you could firstly clone the project to your local and test it , make sure the project could build well without any error then publish to the GitHub and deploy to the azure.
Update:
I also write a test demo on my computer and I reproduce your error.
Error image:
I think in your project you have inclued the bin and obj folder into your project and then you push the project to the github.
Like below:
After you push the project to the github, the csporj file will include all the bin and obj references.
Like below:
This is the reason about your MSBuild fail.
So I suggest you uninclude all the bin and obj folder in the local and push to the github again. Then it will work well.
Azure looks in your site/repository/packages folder for all the packages your app uses. By looking through it you will find that visual studio doesn't deploy all of the files from your local packages folder to the azure one. MSBuild needs these files when you push to git and trigger a build. Ftp into your azure site and look for the packages folder. Upload every missing file (dll) from your local folder to the azure one. This worked for me and now I can trigger a build and deployment from bitbucket to azure app service upon a push.
Additionally, if you have other projects in your VS solution and you are using VS to build those projects and then put the dll into your main projects bin folder, that will cause a missing file error also. I create a folder in my packages folder and link the dll to my main folder from there. That way when you perform the fix above, the file needed by your main project is in the packages folder also.
I hope this helps!
We are currently trying to setup an Angular 2 project that also contains a Cloud Service project in its solution. We have set up numerous Angular 1 projects containing Cloud Service projects and have had no errors. When trying to run the MSBuild step for the Angular 2 project, we get the following error on the TeamCity build server:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Windows Azure Tools\2.7\Microsoft.WindowsAzure.targets(2787, 5): error MSB3021: Unable to copy file "C:\TeamCityBuildAgent\temp\buildTmp\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs" to "C:\SourceControlFolder\Apps\MyApp\MyApp.CloudDeployment\obj\Debug\Website\C:\TeamCityBuildAgent\temp\buildTmp\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs". The given path's format is not supported.
The main problem seems to be the build attempting to throw the full C:\TeamCityBuildAgent.. path into the obj\Debug\Website folder.
My current MSBuild parameters are:
/p:Configuration="Dev"
/p:platform="Any CPU"
/p:OctoPackEnforceAddingFiles=true
/p:OctoPackProjectName=MyApp_Dev
I've tried the following solutions:
Making sure the latest Visual Studio Update is installed (for MSBuild)
Running the install tool to repair Azure Tools 2.7 on the build server.
Changing the debug configuration in the build.
Ensuring TypeScript 1.7.6 is installed on the build server (even though it's an Azure.targets issue) [https://github.com/Microsoft/TypeScript/issues/6215]
Updated the project to Azure Tools 2.9. The same error remains except it's failing on the 2.9 folder instead now.
Curious if anyone else has experienced this error and knows a fix. I'll keep this post updated as I try other solutions.
Update
It appears that what is causing this issue is this line within the .csproj file:
<FilesToIncludeForPublish>AllFilesInProjectFolder</FilesToIncludeForPublish>
This is specified for our build configurations to copy all files generated by the ng build to the output directory of the publish. What I don't understand at the moment is how this works on all of the devs' local machines but does not work on our build server. Will keep this posted as I find more info or any kind of workaround.
This ended up being the fix:
Instead of targeting the .sln in MSBuild, we specifically targeted the .csproj file. This fixed the build errors and allowed us to keep the FilesToIncludeForPublish tag inside.
I have my .gitlab-ci.yml file set up in the typical three stages: test, build, deploy. During the build stage, I run a command that compiles my project and puts it in a tarball. The build stage appears to execute successfully because it moves on to the deploy stage, but the deploy stage then says it can't find the tarball. Is it in another directory? What happened to it? Thanks.
For each test gitlab-ci clean the build folder, therefore the output files of the build stage are not available in the deploy stage.
You need to rebuild your project also in the deploy stage.
The "stages" are only useful to order your tests, i.e. avoid to try to do a deploy test if a build test failed.
EDIT:
Since Gitlab 8.6, it is possible using dependencies feature
I was surprised to see the same behaviour (on GitLab 8.4).
I use cmake to create makefiles, then make to build, and then make test to run the test. I run all these in a build/ directory.
I don't want to repeat myself and identify easily which steps are failing. As such, I've created different gitlab-ci stages: cmake, make, test, etc. I then tell gitlab-ci to keep the build directory using the cache option:
cache:
key: "$CI_BUILD_REF_NAME"
untracked: true
paths:
- build/
I think that the key option will keep the same build directory for all stages acting on the same branch. See the gitlab-ci doc here: http://doc.gitlab.com/ce/ci/yaml/README.html#cache
EDIT: Don't use the cache for this! GitLab implemented reusable artifacts between stages in 8.4: https://gitlab.com/gitlab-org/gitlab-ce/issues/3423
The CI runners will have to be adapted to support this. See: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/336