这是我的代码的片段:
stage('tf run') {
agent {
dockerfile {
additionalBuildArgs "${ADDITIONAL_BUILD_ARGS}"
registryCredentialsId "${REGISTRY_CREDENTIALS}"
registryUrl "${REGISTRY_URL}"
reuseNode true
}
}
Run Code Online (Sandbox Code Playgroud)
现在我想在运行这段代码时添加特殊变量 DOCKER_BUILDKIT=1 。例如,在 shell 中,它应该如下所示:“DOCKER_BUILDKIT=1 docker build ”。我需要它,因为我想在 docker_buildkit 模式下运行我的 docker。我怎样才能做到这一点?
我想将我的 Pod 部署在特定的命名空间中。我考虑了 Pod Affinity,但找不到如何选择特定命名空间的解决方案。有人做吗?
我有两个工作流程:
我需要在workflow2.yaml中添加类似的内容:
jobs:
build_kotlin:
runs-on: [server1, server2, server3]
needs: [workflow1]
steps:
- name: Checkout code
uses: actions/checkout@v2
Run Code Online (Sandbox Code Playgroud)
目前“需要”无法正常工作。如何引用单独的工作流程 yaml 文件?
假设我在 docker-compose 中有十个服务,每个服务都需要相同的 extra_hosts 和四个记录。我想定义一次 extra_hosts 并仅将其包含到每个服务中。
是否可以?
version: '3.7'
services:
web:
build:
context: ./apache
dockerfile: dockerfile_apache2
image: debian:latest
container_name: hsthttp1
extra_hosts:
- "somehost1:162.242.195.82"
- "somehost2:162.242.195.83"
- "somehost3:162.242.195.84"
- "somehost4:162.242.195.85"
web2:
build:
context: ./apache
dockerfile: dockerfile_apache2
image: debian:latest
container_name: hsthttp2
extra_hosts:
- "somehost1:162.242.195.82"
- "somehost2:162.242.195.83"
- "somehost3:162.242.195.84"
- "somehost4:162.242.195.85"
web3:
build:
context: ./apache
dockerfile: dockerfile_apache2
image: debian:latest
container_name: hsthttp3
extra_hosts:
- "somehost1:162.242.195.82"
- "somehost2:162.242.195.83"
- "somehost3:162.242.195.84"
- "somehost4:162.242.195.85"
Run Code Online (Sandbox Code Playgroud) 我需要准备 if 语句。我想知道最好的解决方案是什么?
locals {
prod_ingress_certyficate = "${prod_ingress_certyficate == "true" ? var.prod_cert : var.test_cert}"
}
Run Code Online (Sandbox Code Playgroud)
这是正确的方法吗?如果变量为 true,则使用 prod_cert,如果为 false,则使用 test_cert。