【问题标题】:shell script is unable to create workspace in eclipse cheshell 脚本无法在 eclipse che 中创建工作区
【发布时间】:2019-11-01 21:44:27
【问题描述】:

我已经编写了一个 shell 脚本来在 eclipse che 中创建一个工作区。该脚本正在生成工作区 url。但是当我打开它时,工作区不会退出。我错过了什么吗?

#!/bin/sh
#=========================================================================

repo_url=$1
branch_name=$2
ip_addr=$3
#echo $repo_url
#B="$(cut -d'/' -f4 <<<$repourl)"
temp_var="$(echo $repo_url | cut -d'/' -f5)"
repo_name="$(echo $temp_var | cut -d '.' -f1)"

#rm /opt/stackstorm/packs/jenkins/template/latest_template
sudo cp /opt/stackstorm/packs/dev_prediction/actions/latest_template.sh /opt/stackstorm/packs/dev_prediction/template/
#sed -i "s/repourl/$repo_url/g;s/branchname/$branch_name/g;s/reponame/$repo_name/g;s/ipaddr/$ip_addr/g" latest_template

sudo sed -i "s@repourl@$repo_url@g;s@branchname@$branch_name@g;s@reponame@$repo_name@g;s@ipaddr@$ip_addr@g" /opt/stackstorm/packs/dev_prediction/template/latest_template.sh
sudo chmod u+x /opt/stackstorm/packs/dev_prediction/template/latest_template.sh
#cat /opt/stackstorm/packs/jenkins/template/latest_template
sudo sh /opt/stackstorm/packs/dev_prediction/template/latest_template.sh > /dev/null
sudo rm /opt/stackstorm/packs/dev_prediction/template/latest_template.sh

echo "http://$ip_addr/dashboard/#/ide/admin/$repo_name-$branch_name"

预期和实际网址: "http://URL.ap-south-1.elb.amazonaws.com/dashboard/#/ide/admin/petclinic-new-AIAS-37"

【问题讨论】:

    标签: linux shell kubernetes docker-container eclipse-che


    【解决方案1】:

    我实际上并没有遵循...从我在这里看到的情况来看,您只是在生成 URL,但您并没有创建工作区。以前是这样做的吗?

    要通过访问工作区的 URL 来打开工作区,工作区必须首先存在 ;-)

    如果您正在研究如何从脚本创建 工作区,您可以使用 REST API 端点。在默认的 Eclipse Che 部署中,我们还在 URL /swagger 上部署了 swagger(在您的情况下为“http://URL.ap-south-1.elb.amazonaws.com/swagger”),因此您可以自己查看所有 API 端点。

    对你来说最有趣的可能是:

    POST 到 &lt;cheUrl&gt;/api/devfile 以从 devfile 创建工作区(新,Che 7 工作区定义文件)

    POST 到 &lt;cheUrl&gt;/api/workspace 以从 Che 6 工作区定义 json 创建工作区。

    希望这会有所帮助。

    萝卜

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-18
      • 1970-01-01
      相关资源
      最近更新 更多