【问题标题】:helm hosted repo via CLIhelm 通过 CLI 托管 repo
【发布时间】:2019-09-03 14:47:48
【问题描述】:

我为 nexus3 安装了helm repo plugin

现在我想通过 RestAPI 命令创建 helm 托管 repo,就像我为原始存储库所做的那样

# RAW Repository

curl -X POST "${NEXUS_URL}/service/rest/v1/script" \
     --user "admin:admin123" \
     -H "accept: application/json" \
     -H "Content-Type: application/json" \
     -d "{ \"name\": \"create_raw_repo\", \"content\": \"repository.createRawHosted(args, 'default')\", \"type\": \"groovy\"}"

curl -X POST "${NEXUS_URL}/service/rest/v1/script/create_raw_repo/run" \
     --user "admin:admin123" \
     -H "accept: application/json" \
     -H "Content-Type: text/plain" \
     -d "raw-release"


# HELM Repo

curl -X POST "${NEXUS_URL}/service/rest/v1/script" \
     --user "admin:admin123" \
     -H "accept: application/json" \
     -H "Content-Type: application/json" \
     -d "{ \"name\": \"create_helm_repo\", \"content\": \"repository.createHelmHosted(args, 'default')\", \"type\": \"groovy\"}"

curl -X POST "${NEXUS_URL}/service/rest/v1/script/create_helm_repo/run" \
     --user "admin:admin123" \
     -H "accept: application/json" \
     -H "Content-Type: text/plain" \
     -d "helm-demo-release"

问题是repository.createHelmHosted方法不存在。

正确的做法是什么?

【问题讨论】:

  • 此处稍作修正。您没有使用 REST API 创建存储库。您正在使用 REST API 运行将创建存储库的脚本。 HELM 插件不附带脚本 API 帮助程序,因此您必须编写自己的脚本。您可以在文档中找到更多信息:help.sonatype.com/repomanager3/rest-and-integration-api/…

标签: nexus nexus3


【解决方案1】:

从 3.21 版本开始,nexus 支持 OOB helm repo 并具有 REST API 来创建 repo

http://you-nexus:8081/service/rest/beta/repositories/helm/hosted


curl -X POST "http://you-nexus:8081/service/rest/beta/repositories/helm/hosted" \
     -H "accept: application/json" \
     -H "Content-Type: application/json" \
     -d "{ \"name\": \"internal\", \"online\": true, \"storage\": { \"blobStoreName\": \"default\", \"strictContentTypeValidation\": true, \"writePolicy\": \"allow_once\" }, \"cleanup\": { \"policyNames\": \"weekly-cleanup\" }}"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-17
    相关资源
    最近更新 更多