linux - 用于在harbor中创建多个项目的bash脚本
问题描述
我想使用 API 在港口创建多个项目。所以我有 5 个项目要在文本文件中创建
项目.txt
projects: abcd
efgh
ijkl
mnop
qrst
create_projects.sh
#!/bin/bash
DIR=$( cd "$( dirname "$BASH_SOURCE[0]}" )" && pwd )
while read p
do
curl --location --request POST 'https://harbor.rl.com/api/v2.0/projects' --header 'Content-Type: application/json' --header 'X-Resource-Name-In-Location: true' --header 'Authorization: Basic jhgkyyktfkghfgfhfgh=' --data-raw '{
"project_name": $p,
"public": true,
"metadata": {
"public": "true",
"prevent_vul": "true",
"auto_scan": "true"
},
"storage_limit": -1
}'
done < "$DIR/../assets/projects.txt"
我创建了这样的 bash 脚本。请建议我们如何通过脚本在港口回购中创建这五个项目
解决方案
推荐阅读
- python - tf-nightly-gpu 在整个训练过程中的性能下降
- javascript - Vuex 状态中的 Javascript 类中缺少方法
- c++ - 使用另一个结构构建链接列表 - 附加函数运行时错误
- javascript - 如何渲染类组件?
- r - 如何采样实数?
- java - 矩形节点的 Graphviz (Java) 标签写在节点的末端
- reactjs - Webpack 5 DependOn 仅在条目仅依赖于一个依赖项时才有效
- wordpress - WordPress WooCommerce - 禁用“我的帐户”屏幕并允许用户转到 wp-admin
- java - 为什么我们不在 bindView 中使用 moveToFirst()?
- android - 安卓。从两个 RecyclerView 向数据库发送请求并在第三个 RecyclerView 中接收数据