I have created a pipeline in Go from ThoughtWorks that fails. The error message is about not finding ant in the PATH. I have defined an Environment where I override the PATH variable, but that does not seem to work.
Source code: https://github.com/aavella77/junit-sample.git
I can compile using ant from a terminal. Not sure how to setup the PATH using Go. Any suggestions?
[go] Start to prepare junit-sample-Pipeline/25/defaultStage/1/defaultJob on AAVELLA-M-G0AM [/Applications/Go Agent.app] at Sun Jan 25 22:13:16 PST 2015
[go] Start updating files at revision bae3528396b34f842ebe495fefd9f3a37dfb5f6d from https://github.com/aavella77/junit-sample.git
[GIT] Fetch and reset in working directory pipelines/junit-sample-Pipeline
[GIT] Cleaning all unversioned files in working copy
[GIT] Cleaning submodule configurations in .git/config
[GIT] Fetching changes
[GIT] Performing git gc
[GIT] Updating working copy to revision bae3528396b34f842ebe495fefd9f3a37dfb5f6d
HEAD is now at bae3528 Create build.xml
[GIT] Removing modified files in submodules
[GIT] Cleaning all unversioned files in working copy
[go] Start to build junit-sample-Pipeline/25/defaultStage/1/defaultJob on AAVELLA-M-G0AM [/Applications/Go Agent.app] at Sun Jan 25 22:13:17 PST 2015
[go] Current job status: passed.
[go] Start to execute task: <ant buildfile="build.xml" />.
[go] setting environment variable 'GO_ENVIRONMENT_NAME' to value 'Production'
[go] overriding environment variable 'PATH' with value '/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin/ant/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/bin/ant/bin'
[go] setting environment variable 'GO_SERVER_URL' to value 'https://127.0.0.1:8154/go/'
[go] setting environment variable 'GO_TRIGGER_USER' to value 'anonymous'
[go] setting environment variable 'GO_PIPELINE_NAME' to value 'junit-sample-Pipeline'
[go] setting environment variable 'GO_PIPELINE_COUNTER' to value '25'
[go] setting environment variable 'GO_PIPELINE_LABEL' to value '25'
[go] setting environment variable 'GO_STAGE_NAME' to value 'defaultStage'
[go] setting environment variable 'GO_STAGE_COUNTER' to value '1'
[go] setting environment variable 'GO_JOB_NAME' to value 'defaultJob'
[go] setting environment variable 'GO_REVISION' to value 'bae3528396b34f842ebe495fefd9f3a37dfb5f6d'
[go] setting environment variable 'GO_TO_REVISION' to value 'bae3528396b34f842ebe495fefd9f3a37dfb5f6d'
[go] setting environment variable 'GO_FROM_REVISION' to value 'bae3528396b34f842ebe495fefd9f3a37dfb5f6d'
[go] setting environment variable 'JUNIT_HOME' to value '/Library/JUNIT'
[go] setting environment variable 'CLASSPATH' to value '$CLASSPATH:/Library/JUNIT/junit-4.10.jar:.'
[go] setting environment variable 'ANT_HOME' to value '/usr/bin/ant/bin'
Error happened while attempting to execute 'ant -f build.xml'.
Please make sure [ant] can be executed on this agent.
[Debug Information] Environment variable PATH: /usr/bin:/bin:/usr/sbin:/sbin
[go] Start to create properties junit-sample-Pipeline/25/defaultStage/1/defaultJob on AAVELLA-M-G0AM [/Applications/Go Agent.app] at Sun Jan 25 22:13:18 PST 2015
[go] Start to upload junit-sample-Pipeline/25/defaultStage/1/defaultJob on AAVELLA-M-G0AM [/Applications/Go Agent.app] at Sun Jan 25 22:13:18 PST 2015
[go] Job completed junit-sample-Pipeline/25/defaultStage/1/defaultJob on AAVELLA-M-G0AM [/Applications/Go Agent.app] at Sun Jan 25 22:13:18 PST 2015
Thanks in advance,
There's a problem with $PATH setting on agents for OSX. You can find details along with the solution logged here.
https://github.com/gocd/gocd/issues/852
Related
I'm having problems with files created from within Eclipse running on Linux.
All files (as far as I know) only gets the owner read and write permissions. Build output is the same but with the execute permission added.
The "test" file is created in Eclipse by File > New, and the "test1" file is created in command line by "touch" by the same user in the same folder.
-rw-------. 1 user stdgroup 0 Mar 15 10:22 test
-rw-r--r--. 1 user stdgroup 0 Mar 15 10:23 test1
My umask is set to 0022, so the output from the "touched" file is correct.
I'm running Eclipse Oxygen.2 Release 4.7.2 on Linux RedHatEnterpriseServer 7.3.
Anyone knows if there is a setting in Eclipse that can cause this, or any other ideas as to why this happens?
I've moved my fastlane folder out of the xcode directory, so I'm trying to get it to target it. I have this is my Fastfile:
increment_build_number(
xcodeproj: "../ember-cordova/cordova/platforms/ios/Patontheback.xcodeproj",
build_number: ENV['CIRCLE_BUILD_NUM']
)
Which gives
[06:50:47]: ------------------------------------
[06:50:47]: --- Step: increment_build_number ---
[06:50:47]: ------------------------------------
[06:50:47]: Error setting value '../ember-cordova/cordova/platforms/ios/Patontheback.xcodeproj' for option 'xcodeproj'
[06:50:47]: You passed invalid parameters to 'increment_build_number'.
[06:50:47]: Check out the error below and available options by running `fastlane action increment_build_number`
[06:50:47]: Variable Dump:
[06:50:47]: {:DEFAULT_PLATFORM=>:ios, :PLATFORM_NAME=>:ios, :LANE_NAME=>"ios beta", :SIGH_PROFILE_TYPE=>"app-store"}
[06:50:47]: Could not find Xcode project
xcodeproj definitely exists in that location:
$ ls -l ../ember-cordova/cordova/platforms/ios/Patontheback.xcodeproj
total 28
-rwxr-xr-x 1 kitsunde staff 25639 Sep 23 02:57 project.pbxproj
What am I doing wrong?
It's because it appends ../ to the path. So it's relative the parent directory and not the directory of the Fastlane file.
I am running Windows Server 2012 R2 with MDT 2012, I installed the Windows 8 ADK before installing MDT 2012. I have created my Deployment Share and set everything up, but when I try to run the build it fails. I have included the error log bellow;
FindFile: The file imagex.exe could not be found in any standard locations. LTIApply 01/06/2015 09:54:30 0 (0x0000)
FAILURE ( 5441 ): 1: FindFile: imagex.exe LTIApply 01/06/2015 09:54:30 0 (0x0000)
Command completed, return code = -2147467259 LiteTouch 01/06/2015 09:54:30 0 (0x0000)
Litetouch deployment failed, Return Code = -2147467259 0x80004005 LiteTouch 01/06/2015 09:54:30 0 (0x0000)
For more information, consult the task sequencer log ...\SMSTS.LOG. LiteTouch 01/06/2015 09:54:30 0 (0x0000)
I see that it is unable to find the 'imagex.exe' file, where should this be located, and can I copy the file to the directory?
Any ideas?
Kind Regards,
Copy imagex.exe and wimgapi.dll (this may be optional, but I would still copy it) from the installation of ADK to the Tools\x86 and Tools\x64 directories in your deployment share.
For example (using 8.1 ADK instead of 8 ADK, folder names may be slightly different) the default installation on Server 2012 R2 would be "C:\Program Files (x86)\Windows Kit\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\DISM" for the 64-bit imagex.exe and wimgapi.dll files. And "C:\Program Files (x86)\Windows Kit\8.1\Assessment and Deployment Kit\Deployment Tools\x86\DISM" for the 32-bit imagex.exe and wimgapi.dll files.
These files would be copied to the appropriate folders in C:\DeploymentShare\Tools\x64 and C:\DeploymentShare\Tools\x86.
This should resolve your problem. For whatever reason, MDT sometimes does not place all the needed files into the Tools folder when you create a deployment share.
When I cap deploy my Symfony2 project, then log into my server I see that the the dev (app_dev.php) runs ok but the prod version (app.php) does not.
The error is
[Tue Jan 03 14:31:48 2012] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Failed to write cache file "/var/www/example/prod/releases/20120103202539/app/cache/prod/classes.php".' in /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache:1079\nStack trace:\n#0 /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache(1017): Symfony\\Component\\ClassLoader\\ClassCollectionLoader::writeCacheFile('/var/www/example/p...', '<?php ????name...')\n#1 /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache(682): Symfony\\Component\\ClassLoader\\ClassCollectionLoader::load(Array, '/var/www/example/p...', 'classes', false, false, '.php')\n#2 /var/www/example/prod/releases/20120103202539/web/app.php(10): Symfony\\Component\\HttpKernel\\Kernel->loadClassCache()\n#3 {main}\n thrown in /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache on line 1079
Looking at the recently deployed cache directory I see:
drwxrwxrwx 4 root root 4096 Jan 3 14:28 .
drwxrwxr-x 5 root root 4096 Jan 3 14:28 ..
drwxr-xr-x 6 www-data www-data 4096 Jan 3 14:28 dev
drwxrwxr-x 7 root root 4096 Jan 3 14:28 prod
I can fix the issue with chown -R www-data.www-data prod/ but I wondered if I can stop this from happening in the first place? And why do the directories have different owners?
This happens because your web-server is running by user, who is not able to write to just created cache/prod directory.
There are two solutions, which I know and use. First, add extra commands to run after deployment to Capfile. Capfile will like this:
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/bundles/*/*/recipes/*.rb'].each { |bundle| load(bundle) }
load Gem.find_files('symfony2.rb').last.to_s
after "deploy:finalize_update" do
run "sudo chown -R www-data:www-data #{latest_release}/#{cache_path}"
run "sudo chown -R www-data:www-data #{latest_release}/#{log_path}"
run "sudo chmod -R 777 #{latest_release}/#{cache_path}"
end
load 'app/config/deploy'
Second solution is more elegant. You specify correct user, who can write to cache in deploy.rb and make sure that you don't use sudo:
set :user, "anton"
set :use_sudo, false
In the last version of capifony, they've added the option to set writable directories.
Here's the official article which explains what I've written below : http://capifony.org/cookbook/set-permissions.html
You have to deploy using sudo (not a good practice, but it gets the job done)
set :use_sudo, false
# To prompt the sudo password
default_run_options[:pty] = true
and tell capifony which files to make cache and logs folder writable :
set :writable_dirs, ["app/cache", "app/logs"]
set :webserver_user, "www-data"
set :permission_method, :acl
(you have to install acl on your machine, or use :chwon instead of :acl)
EDIT :
I've just realized that this is not enough, the "set_permissions" task is not automatically called, so you have to explicitly run
cap deploy:set_permissions
Or add this line in your deploy.rb :
before "deploy:restart", "deploy:set_permissions"
I solved this problem by adding cache folder to shared folders.
set :shared_children, [app_path + "/cache", app_path + "/logs", web_path + "/uploads", "vendor"]
This way the directory is not recreated each time during deployment, so there is no problem with permissions.
Yes, don't need recreate cache every time after deploy, this solution is logical and pragmatical.
Second solution from Anton - is work if you cache folder permission true in develop environment
Every build has failed as of Tuesday. I'm not exactly sure what happened. The Phing targets (clean/prepare) are being executed properly. Additionally, the unit tests are passing with flying colors, with only a warning for duplicate code (not a reason for a fail). I tried removing the phpDoc target to see if that was causing the error, but the build still failed.
Started by user chris Updating
file://localhost/projects/svn/ips-com/trunk
At revision 234 no change for
file://localhost/projects/svn/ips-com/trunk
since the previous build [trunk] $
/opt/phing/bin/phing clean prepare
-logger phing.listener.NoBannerLogger Buildfile:
/var/lib/hudson/.hudson/jobs/IPS/workspace/trunk/build.xml
IPS > clean:
[echo] Clean... [delete] Deleting directory
/var/lib/hudson/.hudson/jobs/IPS/workspace/build
IPS > prepare:
[echo] Prepare...
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs/coverage
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs/coverage-html
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/docs
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/app
BUILD FINISHED
Total time: 1.0244 second
[workspace] $ /bin/bash -xe
/tmp/hudson3259012225710915845.sh
+ cd trunk/tests
+ /usr/local/bin/phpunit --verbose -d memory_limit=512M --log-junit
../../build/logs/phpunit.xml
--coverage-clover ../../build/logs/coverage/clover.xml
--coverage-html ../../build/logs/coverage-html/
PHPUnit 3.5.0 by Sebastian Bergmann.
IPS Default_IndexControllerTest .
Default_AuthControllerTest ......
Manage_UsersControllerTest .....
testDeleteInvalidUserId ..
testGetPermissionsForInvalidUserId .. Audit_OverviewControllerTest
............
Time: 14 seconds, Memory: 61.00Mb
[30;42m[2KOK (28 tests, 198
assertions) [0m[2K Writing code
coverage data to XML file, this may
take a moment.
Generating code coverage report, this
may take a moment.
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
[workspace] $ /bin/bash -xe
/tmp/hudson1439023061736436000.sh
+ /usr/local/bin/phpcpd --log-pmd ./build/logs/cpd.xml ./trunk phpcpd
1.3.2 by Sebastian Bergmann.
Found 1 exact clones with 6 duplicated
lines in 2 files:
library/Ips/Form/Decorator/SplitInput.php:8-14
library/Ips/Form/Decorator/FeetInches.php:10-16
0.04% duplicated lines out of 16585 total lines of code.
Time: 4 seconds, Memory: 19.50Mb [DRY]
Skipping publisher since build result
is FAILURE Publishing Javadoc [xUnit]
[INFO] - Starting to record. [xUnit]
[WARNING] - Can't create the path
/var/lib/hudson/.hudson/jobs/IPS/workspace/generatedJUnitFiles.
Maybe the directory already exists.
[xUnit] [INFO] - Processing
PHPUnit-3.4 (default) [xUnit] [INFO] -
[PHPUnit-3.4 (default)] - 1 test
report file(s) were found with the
pattern 'build/logs/phpunit.xml'
relative to
'/var/lib/hudson/.hudson/jobs/IPS/workspace'
for the testing framework 'PHPUnit-3.4
(default)'. [xUnit] [INFO] -
Converting
'/var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs/phpunit.xml'
. [xUnit] [INFO] - Stopping recording.
Publishing Clover coverage report...
Publishing Clover XML report...
Publishing Clover coverage results...
Finished: FAILURE
What changed since Tuesday? Try to manually run exactly the same commands that Hudson tries to run from the same directory that Hudson starts it from (usually the jobs workspace directory). Of course with the user account that Hudson is started under.
There are several possibilities. ranging from standard groups for a directory, to permission, or other things outside of Hudson. Was Hudson upgraded? Was a plugin upgraded? Was the OS or php upgraded? Was there a change in the default or user .profile or .env (or the equivalent files)? Does another process accesses the workspace? ......
Once I had the problem that all of the sudden my deployment scripts did not run anymore. The mystery was, that I could still run the script from command line with the Hudson user account. The reason was simple but took a while to uncover. There was a java upgrade from 5 to 6. Both versions were available. After comparing the environment variables, there was a difference in the path. The problem was that the new path was set in the global .profile. But Hudson does not open an interactive shell, therefore the .profile will not be executed. If you have a problem like this, you can put the initialization in the .env file (or whatever the filename is for your system), because this will be run regardless if it is a interactive shell or not. Alternatively you can configure Hudson to set it on master or node/slave level.
if you want a command to not break the 'build' as a failure you have to add #! in front of the command to prevent the flags -xe which produce this behaviour.