无法通过gitlab将代码部署到Google Cloud App Engine [英] Unable to deploy my code to google cloud app engine via gitlab

查看:72
本文介绍了无法通过gitlab将代码部署到Google Cloud App Engine的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个gitlab管道,用于将我的spring boot应用程序部署到google app引擎,并且能够对gitlab进行身份验证,但是在ci文件的部署步骤中,我必须安装Java 7+ JRE,然后在您的系统路径,尽管我已经在gitlab ci文件中使用gcloud install components app-engine-java命令安装了它.请提出解决此错误的建议.

I am trying to create a gitlab pipeline for deploying my spring boot app to google app engine and i am able to authenticate app engine to gitlab but at deployment step of ci file i am getting Java 7+ JRE must be installed and on your system PATH though i have installed it with gcloud install components app-engine-java command in gitlab ci file. Please suggest what needs to be done to resolve this error.

.gitlab-ci.yml文件:

image: google/cloud-sdk:alpine

            deploy_production:
              stage: deploy
              environment: Production
              only:
              - master
              script:
              - echo $DEPLOY_KEY_FILE_PRODUCTION > /tmp/$CI_PIPELINE_ID.json
              - gcloud -q components install app-engine-java
              - gcloud auth activate-service-account --key-file /tmp/$CI_PIPELINE_ID.json
              - gcloud --quiet --project $PROJECT_ID_PRODUCTION --verbosity debug app deploy src/main/webapp/WEB-INF/appengine-web.xml

下面是调试详细信息,其中提到要使用Java的本地登台,尽管我已使用gcloud install组件google-app-engine cmd安装了Java JRE,但仍必须安装Java JRE:

Below are the debug details which mentions that to use the local staging for java, java JRE must be installed though i have installed it using gcloud install components google-app-engine cmd:

$ gcloud --quiet --project $PROJECT_ID_PRODUCTION --verbosity debug app deploy src/main/webapp/WEB-INF/appengine-web.xml
            DEBUG: Running [gcloud.app.deploy] with arguments: [--project: "playground-kg", --quiet: "True", --verbosity: "debug", DEPLOYABLES:1: "[u'src/main/webapp/WEB-INF/appengine-web.xml']"]
            **DEBUG: (gcloud.app.deploy) To use the local staging for java, a Java 7+ JRE must be installed and on your system PATH**
            Traceback (most recent call last):
              File "/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 983, in Execute
                resources = calliope_command.Run(cli=self, args=args)
              File "/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 784, in Run
                resources = command_instance.Run(args)
              File "/google-cloud-sdk/lib/surface/app/deploy.py", line 90, in Run
                parallel_build=False)
              File "/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 573, in RunDeploy
                args.deployables, stager, deployables.GetPathMatchers())
              File "/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deployables.py", line 334, in GetDeployables
                service = Service.FromPath(path, stager, path_matchers)
              File "/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deployables.py", line 102, in FromPath
                service = matcher(path, stager)
              File "/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deployables.py", line 175, in AppengineWebMatcher
                staging_dir = stager.Stage(descriptor, app_dir, 'java-xml', env.STANDARD)
              File "/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/staging.py", line 387, in Stage
                return command.Run(self.staging_area, descriptor, app_dir)
              File "/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/staging.py", line 171, in Run
                args = self.GetArgs(descriptor, app_dir, staging_dir)
              File "/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/staging.py", line 251, in GetArgs
                return self._mapper(self.GetPath(), descriptor, app_dir, staging_dir)
              File "/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/staging.py", line 107, in _JavaStagingMapper
                java_bin = java.RequireJavaInstalled('local staging for java')
              File "/google-cloud-sdk/lib/googlecloudsdk/command_lib/util/java.py", line 54, in RequireJavaInstalled
                v=min_version))
            JavaError: To use the local staging for java, a Java 7+ JRE must be installed and on your system PATH
            ERROR: (gcloud.app.deploy) To use the local staging for java, a Java 7+ JRE must be installed and on your system PATH

推荐答案

有些人在尝试创建相同的工作流时遇到了相同的问题,但是使用github.可以在此处中查看相同的问题.这个家伙通过向Docker添加openjdk-8来解决了这个问题.

Some people got the same issue trying to create the same workflow, but with github. The same issue can be viewed here. This guy solved this by adding openjdk-8 to Docker.

您可以在此处如何将openjdk-8添加到Docker中.

You can see here how to add openjdk-8 to Docker.

如果这对您不起作用,请告诉我,我将尝试编辑答案.

If this did not work for you, please let me know and I will try to edit my answer.

您可能还需要为Google检查 Jenkins 云端并使用 Jenkins与Gitlab 进行CI.这可能对您的CI工作流程很有帮助.

You may also want to check Jenkins for Google Cloud and using Jenkins with Gitlab for CI. It may be helpful for your CI workflow.

这篇关于无法通过gitlab将代码部署到Google Cloud App Engine的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆