TeamCity is failing to checkout github repository - github

I'm having following errors from TeamCity when it updates working directory.
I'm using TeamCity 8.1.3 and checking out github repository on agent.
Looks like it happened all of a sudden. This was working yesterday.
I'm not sure how I can investigate this issue... Could someone help me?
[19:11:33]Checking for changes
[19:11:34]Failed to register agent parameters for: class jetbrains.buildServer.agent.impl.buildFiles.RecentlyFailedTestsFileWriter. Error: Permission denied
[19:11:34]Failed to register agent parameters for: class jetbrains.buildServer.agent.impl.buildFiles.ChangedFilesListFileWriter. Error: Permission denied
[19:11:34]Failed to register agent parameters for: class jetbrains.buildServer.agent.impl.buildFiles.RunnerParametersFileWriter. Error: Permission denied
[19:11:34]Failed to register agent parameters for: class jetbrains.buildServer.agent.impl.buildFiles.BuildParametersFileWriter. Error: Permission denied
[19:11:34]Failed to register agent parameters for: class jetbrains.buildServer.agent.impl.buildFiles.ConfigurationParametersFileWriter. Error: Permission denied
[19:11:34]Failed to publish build.start.properties.gz file. /Users/iosdevelopment/Documents/buildAgent/temp/agentTmp/build.start.properties.gz (Permission denied)
[19:11:34]Clearing temporary directory: /Users/iosdevelopment/Documents/buildAgent/temp/buildTmp
[19:11:34]Failed to delete empty directory: /Users/iosdevelopment/Documents/buildAgent/temp/buildTmp
[19:11:34]Checkout directory: /Users/iosdevelopment/Documents/buildAgent/work/ios_build_dir
[19:11:34]Updating sources: agent side checkout
[19:11:34][Updating sources] Will perform clean checkout. Reason: Checkout directory is empty or doesn't exist
[19:11:34][Updating sources] Cleaning /Users/iosdevelopment/Documents/buildAgent/work/ios_build_dir
[19:11:34][Updating sources] Using vcs information from server. Reason: no revision information for buildtype iPhone_CI and checkout directory /Users/iosdevelopment/Documents/buildAgent/work/ios_build_dir on agent
[19:11:34][Updating sources] VCS Root: git#github.com:taichino/iOS.git
[19:11:34][Updating sources] Failed to perform checkout on agent: Permission denied
[19:11:34]Publishing artifacts
[19:11:34]Failed to generate coverage report, error: java.io.FileNotFoundException: /Users/iosdevelopment/Documents/buildAgent/work/ios_build_dir/coverage.ic file does not exist
[19:11:34]Failed to publish build.finish.properties.gz file. /Users/iosdevelopment/Documents/buildAgent/temp/agentTmp/build.finish.properties.gz (Permission denied)
[19:11:34]Build failed to start. Artifacts will not be published for this build

I meet this similar issue, it is because of permission restriction.
I chmod -R 777 for the entire Teamcity installation, it works.
Hope it helps.

It might because you run teamcity agent under root (or other users) before, chmod -R 777 should solve the problem, but before that, you can do a "ll" on your agent's install dir, especially the ~/yourAgent/temp folder, make sure it is not owned by root.

I switched to check out on the server, ran the build and once it finished successfully I switched back to checkout on the agent, and it worked!

Related

yocto devtool change ":portnumber" to "/portnumber" in URI, how to fix it?

The command I executed:
devtool add --srcbranch master hello ssh://git#gitlab.xxxx.com.cn:22222/cjl/hello.git
but error shows:
ERROR: Fetcher failure: Fetch command export PATH="...omit"; export HOME="...omit"; git -c core.fsyncobjectfiles=0 ls-remote ssh://git#gitlab.xxxx.com.cn/22222/cjl/hello.git failed with exit code 128, output:
Permission denied, please try again.
Permission denied, please try again.
git#gitlab.ucas.com.cn: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
It resolves my URI to ssh://git#gitlab.xxxx.com.cn/22222/cjl/hello.git(:22222 to /22222)
I'm sure that:
git clone ssh://git#gitlab.xxxx.com.cn:22222/cjl/hello.git in bash is ok.
git://git#gitlab.xxxx.com.cn:22222/cjl/hello.git;protocol=ssh in other bbfile is ok.
so, why devtool change :port to /port?
yocto version: rocko 2.4

VSTS build agent failed with get sources: Permission denied

I have seen a couple of posts, but it did not help me. I have created around 10 Linux machines in Azure and added them to agent pools.
First, the build succeeded, but when I queued the build again, it failed at get sources with the below error.
My build definition was configured:
clean: true
clean options: sources
Error:
018-03-14T18:08:10.9360932Z ##[command]git clean -fdx
2018-03-14T18:08:11.1202177Z warning: failed to remove builddir/support-files/wsrep.cnf: Permission denied
2018-03-14T18:08:11.1221821Z warning: failed to remove builddir/support-files/sysusers.conf: Permission denied
2018-03-14T18:08:11.1248161Z warning: failed to remove builddir/support-files/CTestTestfile.cmake: Permission denied
2018-03-14T18:08:11.1268109Z warning: failed to remove builddir/support-files/mariadb.pc: Permission denied
2018-03-14T18:08:11.1285043Z warning: failed to remove builddir/support-files/wsrep_notify: Permission denied
2018-03-14T18:08:11.1297658Z warning: failed to remove builddir/support-files/mysql.server: Permission denied
2018-03-14T18:08:11.1309669Z warning: failed to remove builddir/support-files/cmake_install.cmake: Permission denied
2018-03-14T18:08:11.1321349Z warning: failed to remove builddir/support-files/CMakeFiles/CMakeDirectoryInformation.cmake: Permission denied
2018-03-14T18:08:11.1333209Z warning: failed to remove builddir/support-files/CMakeFiles/progress.marks: Permission denied
2018-03-14T18:08:11.1345486Z warning: failed to remove builddir/support-files/mysqld_multi.server: Permission denied
Based on the logs, it seems delete for the duilddir/support-files directory is not allowed (you can also check the permission by referring to the post Why can't I delete a file where I have group write permissions on?).
Please set the permission enable to delete under your agent's work folder.

jenkins -github build issue

I have been facing issues while trying to build a project in jenkins which fetches the files from github .
Below is the error log i got :
p.s: for security reason i have removed the ssh url of git .I can able to clone from my locally but when im trying it from jenkins it fails . I have generated ssh key in linux server and its able to connect to github .Can anyone please help me on this
Building in workspace /var/lib/jenkins/jobs/tr-data-events-testing/workspace
> /usr/local/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> /usr/local/bin/git config remote.origin.url git#github.url---------git # timeout=10
Fetching upstream changes from git#github.url-----------s.git
> /usr/local/bin/git --version # timeout=10
using GIT_SSH to set credentials jenkins dxc key
> /usr/local/bin/git fetch --tags --progress git#----url--------------.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git#---url-------.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:766)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1022)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1282)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
at hudson.model.Run.execute(Run.java:1741)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:381)
Caused by: hudson.plugins.git.GitException: Command "/usr/local/bin/git fetch --tags --progress git#github.-------events.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: error: The requested URL returned error: 503 while accessing https://--url-----------/info/refs
fatal: HTTP request failed
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1693)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1441)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:62)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:313)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:764)
... 11 more
ERROR: null
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: FAILURE
Help us localize this page
i resolved this issue by un setting the proxy in .gitconfig file . thank you for your answers
First, make sure Jenkins is running with the same user account you have created your ssh keys with.
It it does not, it would search for ~/.ssh/id_rsa in its own $HOME.
Second, to debug, you can launch Jenkins with this environment variable set first:
export GIT_SSH_COMMAND='ssh -Tv'
That way, any time it will try a git command involving ssh, you will see exactly where Jenkins/git tries to look for ssh keys, and what is the error.
Make sure you Git is recent enough to support this (Git 2.3+, Q4 2015).
But your logs show:
The requested URL returned error: 503 while accessing https://
So this has nothing to do with ssh. As mentioned, a proxy can interfere.

hudson.plugins.git.GitException: Could not fetch from any repository

I want to configure hudson+git and want to create a build. But I am getting following exception:
Started by user nitish
Checkout:workspace / /root/.hudson/jobs/NightlyGit/workspace - hudson.remoting.LocalChannel#dd7efd
Using strategy: Default
Checkout:workspace / /root/.hudson/jobs/NightlyGit/workspace - hudson.remoting.LocalChannel#dd7efd
Fetching changes from the remote Git repository
Fetching upstream changes from https://github.com/test/eng.git
ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
ERROR: (Underlying report) : Error performing command: /usr/bin/git fetch -t https://github.com/test/eng.git +refs/heads/nightly:refs/remotes/origin/nightly
Command "/usr/bin/git fetch -t https://github.com/test/engile.git +refs/heads/nightly:refs/remotes/origin/nightly" returned status code 128: error: The requested URL returned error: 401 while accessing https://github.com/test/eng.git/info/refs
fatal: HTTP request failed
ERROR: Could not fetch from any repository
FATAL: Could not fetch from any repository
hudson.plugins.git.GitException: Could not fetch from any repository
at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:887)
at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:845)
at hudson.FilePath.act(FilePath.java:758)
at hudson.FilePath.act(FilePath.java:740)
at hudson.plugins.git.GitSCM.gerRevisionToBuild(GitSCM.java:845)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:622)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1483)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:507)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:424)
at hudson.model.Run.run(Run.java:1366)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:145)
I am newbie to the git ,I dont know what is the exact problem is there any creadentials required while using git with hudson?. Right now I have created the hudson job and providing the git repository link but it throws above exception. can somebody help me to sort out this issue.
Try this:
Go to the job's "Configure" page.
Under Source Code Management → Git → Additional Behaviors, add a behavior "Wipe out repository & force clone":
Click on Save button.
Try to Build again.
I have created the SSH key on hudson server and added it to my github account that solved my issue.
Sometimes the permission of the workspace also can cause the same error.
sudo chown -R jenkins: <workspace>

Chef Deployment with irrelevant default symlinks

I am trying to deploy my application code with Chef, which is working for one node and failing on another. I cannot determine why it works for one node and not another when they have the exact same config, but I can at least try to debug the problem on the node that fails.
deploy_revision app_config['deploy_dir'] do
scm_provider Chef::Provider::Git
repo app_config['deploy_repo']
revision app_config['deploy_branch']
if secrets["deploy_key"]
git_ssh_wrapper "#{app_config['deploy_dir']}/git-ssh-wrapper" # For private Git repos
end
enable_submodules true
shallow_clone false
symlink_before_migrate({}) # Symlinks to add before running db migrations
purge_before_symlink [] # Directories to delete before adding symlinks
create_dirs_before_symlink [] # Directories to create before adding symlinks
# symlinks()
action :deploy
restart_command do
service "apache2" do action :restart; end
end
end
This is my recipe for deploying the code. Notice that I have tried disabling symlinking entirely, as Chef always jams its own defaults in. Even with this I get the error:
================================================================================
Error executing action `deploy` on resource 'deploy_revision[/var/www]'
================================================================================
Chef::Exceptions::FileNotFound
------------------------------
Cannot symlink /var/www/shared/config/database.yml to /var/www/releases/7404041cf8859a35de90ae72091bea1628391075/config/database.yml before migrate: No such file or directory - /var/www/shared/config/database.yml or /var/www/releases/7404041cf8859a35de90ae72091bea1628391075/config/database.yml
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/kapture/recipes/api.rb
68:
69: deploy_revision app_config['deploy_dir'] do
70: scm_provider Chef::Provider::Git
71: repo app_config['deploy_repo']
72: revision app_config['deploy_branch']
73: if secrets["deploy_key"]
74: git_ssh_wrapper "#{app_config['deploy_dir']}/git-ssh-wrapper" # For private Git repos
75: end
76: enable_submodules true
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/kapture/recipes/api.rb:69:in `from_file'
deploy_revision("/var/www") do
destination "/var/www/shared/cached-copy"
symlink_before_migrate {"config/database.yml"=>"config/database.yml"}
updated_by_last_action true
restart_command #<Proc:0x00007f40f366e5a0#/var/chef/cache/cookbooks/kapture/recipes/api.rb:82>
repository_cache "cached-copy"
retries 0
keep_releases 5
create_dirs_before_symlink ["tmp", "public", "config"]
updated true
provider Chef::Provider::Deploy::Revision
enable_submodules true
deploy_to "/var/www"
current_path "/var/www/current"
recipe_name "api"
revision "HEAD"
scm_provider Chef::Provider::Git
purge_before_symlink ["log", "tmp/pids", "public/system"]
git_ssh_wrapper "/var/www/git-ssh-wrapper"
remote "origin"
shared_path "/var/www/shared"
cookbook_name "kapture"
symlinks {"log"=>"log", "system"=>"public/system", "pids"=>"tmp/pids"}
action [:deploy]
repo "git#github.com:kapture/api.git"
retry_delay 2
end
[2012-09-24T15:42:07+00:00] ERROR: Running exception handlers
[2012-09-24T15:42:07+00:00] FATAL: Saving node information to /var/chef/cache/failed-run-data.json
[2012-09-24T15:42:07+00:00] ERROR: Exception handlers complete
[2012-09-24T15:42:07+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2012-09-24T15:42:07+00:00] FATAL: Chef::Exceptions::FileNotFound: deploy_revision[/var/www] (kapture::api line 69) had an error: Chef::Exceptions::FileNotFound: Cannot symlink /var/www/shared/config/database.yml to /var/www/releases/7404041cf8859a35de90ae72091bea1628391075/config/database.yml before migrate: No such file or directory - /var/www/shared/config/database.yml or /var/www/releases/7404041cf8859a35de90ae72091bea1628391075/config/database.yml
Here you can see it mention database.yml, tmp/, system/ and pids folders, all of which are defaults that Chef likes to set (see related bug)
Question 1
What are these symlinks for and how do I know if I even need any. What sort of things am I symlinking? I will be using migrations, so if they are useful for the migration then I'll need them working.
I have read the documentation many times and it just doesn't explain this is plain English - at least not that I have found.
Question 2
If I do not require them, how can I disable symlinking entirely? Following the examples in that bug report have not helped.
Clear out all the symlink attributes.
deploy_revision("/var/www") do
# ...
symlink_before_migrate.clear
create_dirs_before_symlink.clear
purge_before_symlink.clear
symlinks.clear
end
Make sure the deployment directory in shared has the proper directory structure (/var/www/shared/[log,pids,system,config]) and that all config files necessary for your application are in the config directory.
Your recipe for your application's cookbook should have an array of directory names to create (recursively) so that you won't run into this error again.
The symlinks are there so that while your application code will continue to evolve, you can share the log, pids, and system folder by symlinking shared/log to current/log and so on and so forth..
Chef happens to cache the directory structure - somehow, I haven't dug into that - with this troll application cookbook. It's something in the deploy resource I believe - I never use that - but you can fix it by deleting the directory structure it creates in /var/derp or whatever. Also ensure your tmp directory is setup.
A couple reasons this may be an issue:
File permissions are incorrect
The currently running chef user cannot access the file
You are using the application cookbook in a configuration for rails deploys and your application does not have the same directory structure.
It's definitely caused by Chef caching the state of the deploy somewhere, then reading that state out of it's cache - wherever that is - and then reusing that. I would look at either the application cookbook to see for any persistance, and if you fail at finding it there, look in the deploy resource from chef itself.