0
votes

I'm currently trying to set up a GAE push-to-deploy from my bitbucket wordpress repo. Seems like all the needed steps for setting up jenkins on GCE were done, but build failed with OSError: [Errno 13] Permission denied: '/root/.config'

I think shell command: gcloud --project=projectjp01 preview app deploy . added to the build step caused problem. (looks like jenkins user cannot access root folder or log folder )

Could someone help me out successfully accomplishing this push-to-depoly process for GAE? Any helps will be appreciated.

FYI, below are the console message for the build process:

Started by user User Name Building in workspace /opt/bitnami/apps/jenkins/jenkins_home/jobs/firstjenkins/workspace

/opt/bitnami/git/bin/git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository /opt/bitnami/git/bin/git config remote.origin.url https://source.developers.google.com/p/projectjp01 # timeout=10 Fetching upstream changes from source.developers.google.com/p/projectname /opt/bitnami/git/bin/git --version # timeout=10 using .gitcredentials to set credentials /opt/bitnami/git/bin/git config --local credential.helper store --file=/opt/bitnami/apache-tomcat/temp/git2753293187622835876.credentials

timeout=10

/opt/bitnami/git/bin/git fetch --tags --progress +refs/heads/:refs/remotes/origin/ /opt/bitnami/git/bin/git config --local --remove-section credential # timeout=10 /opt/bitnami/git/bin/git rev-parse refs/remotes/origin/master^{commit} # timeout=10 /opt/bitnami/git/bin/git rev-parse refs/remotes/origin/origin/master^{commit} > # timeout=10 Checking out Revision 2297db6db06f19198dd3097e8db6b72687e8d433 (refs/remotes/origin/master) /opt/bitnami/git/bin/git config core.sparsecheckout # timeout=10 /opt/bitnami/git/bin/git checkout -f 2297db6db06f19198dd3097e8db6b72687e8d433 /opt/bitnami/git/bin/git rev-list 2297db6db06f19198dd3097e8db6b72687e8d433 # timeout=10 [workspace] $ /bin/sh -xe /opt/bitnami/apache-tomcat/temp/hudson1649832068994489242.sh + gcloud --project=projectname preview app deploy . Traceback (most recent call last): File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 177, in _cli = CreateCLI() File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 175, in CreateCLI return loader.Generate() File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 236, in Generate return self.__LoadCLIFromGroups() File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 280, in __LoadCLIFromGroups cli = self.__MakeCLI(top_group) File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 442, in __MakeCLI log.AddFileLogging(self.__logs_dir) File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 532, in AddFileLogging _log_manager.AddLogsDir(logs_dir=logs_dir) File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 316, in AddLogsDir log_file = self._SetupLogsDir(logs_dir) File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 393, in _SetupLogsDir os.makedirs(day_dir_path) File "/usr/lib/python2.7/os.py", line 150, in makedirs makedirs(head, mode) File "/usr/lib/python2.7/os.py", line 150, in makedirs makedirs(head, mode) File "/usr/lib/python2.7/os.py", line 150, in makedirs makedirs(head, mode) File "/usr/lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 13] Permission denied: '/root/.config' Build step 'Execute shell' marked build as failure Finished: FAILURE

1

1 Answers

0
votes

I found out myself. All the problem comes from permission setting.

gcloud should be run as sudo but the tomcat (jenkins) configured to disable the sudo by default. So I ssh to the GCE server where jenkins are running, open(create) file with:

sudo vi /etc/sudoers.d/tomcat

and then put this line:

tomcat ALL=(ALL) NOPASSWD: ALL

that's it. I can build & deploy without problem now.