[英]Azure Pipeline failed for maven app engine deploy
I have been trying to deploy my app engine app from azure pipeline now.我现在一直在尝试从 azure 管道部署我的应用程序引擎应用程序。
I was able to make mvn clean and package it but when i used mvn appengine:deploy it does throw this permission issue.我能够使 mvn clean 和 package 它但是当我使用 mvn appengine:deploy 时,它确实抛出了这个权限问题。 I got through some common questions like this:
我解决了一些常见的问题,例如:
I cant init Google Cloud SDK on Ubuntu 我无法在 Ubuntu 上初始化 Google Cloud SDK
and和
gcloud components update permission denied gcloud 组件更新权限被拒绝
What I did, I added the script tag before my maven in yml file.我做了什么,我在 yml 文件中的 maven 之前添加了脚本标签。
- script: |
sudo chown -R $USER /home/vsts/.config/gcloud/config_sentinel
- task: Maven@3
displayName: 'Maven api/pom.xml'
inputs:
mavenPomFile: 'api/pom.xml'
goals: 'clean package appengine:deploy'
But not sure what is the issue and which else permission i need to set my USER for pipeline is vsts here.但不确定是什么问题以及我需要为管道设置我的 USER 的其他权限是这里的 vsts。 Please let me know if i made any mistake so far.
如果到目前为止我犯了任何错误,请告诉我。
Error log from the pipeline is below for reference:来自管道的错误日志如下供参考:
Downloaded from central: https://repo.maven.apache.org/maven2/com/google/guava/guava/27.0-jre/guava-27.0-jre.jar (2.7 MB at 3.4 MB/s)
Nov 06, 2019 6:51:59 PM com.google.cloud.tools.managedcloudsdk.install.Downloader download
INFO: Downloading https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz to /home/vsts/.cache/google-cloud-tools-java/managed-cloud-sdk/downloads/google-cloud-sdk.tar.gz
Welcome to the Google Cloud SDK!
WARNING: Could not setup log file in /home/vsts/.config/gcloud/logs, (IOError: [Errno 13] Permission denied: u'/home/vsts/.config/gcloud/logs/2019.11.06/18.52.02.245238.log')
Traceback (most recent call last):
File "/home/vsts/.cache/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/bin/bootstrapping/install.py", line 225, in <module>
main()
File "/home/vsts/.cache/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/bin/bootstrapping/install.py", line 200, in main
Prompts(pargs.usage_reporting)
File "/home/vsts/.cache/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/bin/bootstrapping/install.py", line 123, in Prompts
scope=properties.Scope.INSTALLATION)
File "/home/vsts/.cache/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/lib/googlecloudsdk/core/properties.py", line 2269, in PersistProperty
named_configs.ActivePropertiesFile.Invalidate(mark_changed=True)
File "/home/vsts/.cache/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/lib/googlecloudsdk/core/configurations/named_configs.py", line 413, in Invalidate
file_utils.WriteFileContents(config.Paths().config_sentinel_file, '')
File "/home/vsts/.cache/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/lib/googlecloudsdk/core/util/files.py", line 1103, in WriteFileContents
with FileWriter(path, private=private) as f:
File "/home/vsts/.cache/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/lib/googlecloudsdk/core/util/files.py", line 1180, in FileWriter
return _FileOpener(path, mode, 'write', encoding='utf8', private=private)
File "/home/vsts/.cache/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/lib/googlecloudsdk/core/util/files.py", line 1208, in _FileOpener
raise exc_type('Unable to {0} file [{1}]: {2}'.format(verb, path, e))
googlecloudsdk.core.util.files.Error: Unable to write file [/home/vsts/.config/gcloud/config_sentinel]: [Errno 13] Permission denied: '/home/vsts/.config/gcloud/config_sentinel'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.958 s
[INFO] Finished at: 2019-11-06T18:52:02Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:2.0.0:deploy (default-cli) on project configuration-api: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:2.0.0:deploy failed: com.google.cloud.tools.managedcloudsdk.command.CommandExitException: Process failed with exit code: 1 -> [Help 1]
As requested, posting my yaml file which may help few to solve the same problem.根据要求,发布我的 yaml 文件可能有助于解决同样的问题。
Now I given the permission to the parent directory which is gcloud one, as I shown other directories were giving issue.现在我授予了父目录 gcloud 1 的权限,因为我显示其他目录正在给出问题。
- script: |
sudo chown -R $USER:$USER /home/$USER/.config/gcloud/
- task: Maven@3
displayName: 'Maven api/pom.xml'
inputs:
mavenPomFile: 'api/pom.xml'
goals: 'clean package appengine:deploy'
I uses $USER to make it for all.我使用 $USER 为所有人制作。 As I used Azure maintained Agent my pipeline user was vsts which picked up automatically.
当我使用 Azure 维护代理时,我的管道用户是自动拾取的 vsts。 And would help others irrespective of their user.
并且会帮助其他人,无论他们的用户如何。
if any more help required let me know thanks.如果需要更多帮助,请告诉我谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.