前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >kubevirtci make manifests

kubevirtci make manifests

作者头像
后端云
发布2022-11-25 17:06:10
6570
发布2022-11-25 17:06:10
举报
文章被收录于专栏:后端云后端云

make manifests with-bazel or make manifests no-bazel

前者用bazel生成manifest,后者不用bazel。

主要区别就下面的生成{templator}的不同,后者进入仓库的tools/manifest-templator/目录后执行go build生成可执行文件然后复制到{templator}路径。

代码语言:javascript
复制
(cd ${KUBEVIRT_DIR}/tools/manifest-templator/ && go_build && cp manifest-templator ${templator})

前者是通过bazel生成${templator}

代码语言:javascript
复制
bazel run \
        --config=${HOST_ARCHITECTURE} \
        //:build-manifest-templator -- ${templator}

下面进入 //:build-manifest-templator – ${templator}

用了内置的genrule,input是tools/manifest-templator/目录下的templator标签,该标签对应于tools/manifest-templator/ package中的BUILD.bazel文件中的name:templator(用于go build “tools/manifest-templator/”工具),output是”manifest-templator-copier”,命令是"echo '#!/bin/sh\n\ncp -f $(SRCS) $$1' > \"$@\""

这段genrule做的事情是往output文件中打印一段shell脚本,该脚本就执行了个复制操作。将input源(就是go编译的tools/manifest-templator/工具)复制到$1(即${templator})。

代码语言:javascript
复制
genrule(
    name = "build-manifest-templator",
    srcs = [
        "//tools/manifest-templator:templator",    ],
    outs = ["manifest-templator-copier"],
    cmd = "echo '#!/bin/sh\n\ncp -f $(SRCS) $$1' > \"$@\"",
    executable = 1,)

接下来都是用编译后的工具${templator}对manifests模板里的变量进行替换,得到manifests。

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2022-08-16,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 后端云 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • make manifests with-bazel or make manifests no-bazel
  • 下面进入 //:build-manifest-templator – ${templator}
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档