- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前有一个工作流程,在合并到 master 时触发部署,并确保在部署 prod 之前开发作业通过。总共有 4 个环境(2 个开发环境和 2 个生产环境),如果可能的话,我希望能够使用 github 矩阵减少代码重复并将作业数量减少到 1,因为作业之间唯一变化的是值环境变量。
我遇到的问题是似乎没有办法根据 github 事件有条件地包含或排除条目。如果有人有意见或知道一个好的解决方法,我将非常感激。
文件和内容如下。
申请.yaml:
name: Terraform Apply
on:
deployment:
workflow_dispatch:
inputs:
environment:
description: "name of the environment"
required: true
default: "dev"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.KEY_ID_EXAMPLE }}
AWS_SECRET_KEY: ${{ secrets.KEY_EXAMPLE }}
jobs:
deploy-dev:
name: TF Apply - Dev
runs-on: ubuntu-latest
if: ${{ github.event.deployment.environment == 'dev' || github.event.deployment.environment == 'all' || github.event.inputs.environment == 'dev' || github.event.inputs.environment == 'all' }}
env:
TF_VAR_aws_provider_role_arn: arn:example
TF_VAR_example_api_key: ${{ secrets.EXAMPLE_API_KEY }}
TF_VAR_example_app_key: ${{ secrets.EXAMPLE_APP_KEY }}
TF_WORKSPACE: dev
steps:
- name: Run Terraform Apply Composite
uses: GetTerminus/example/multi-workspace/terraform-apply@1.0
with:
ssh_key: ${{ secrets.EXAMPLE_SSH_KEY }}
deploy-dev-midwest:
name: TF Apply - Dev Midwest
runs-on: ubuntu-latest
if: ${{ github.event.deployment.environment == 'dev-midwest' || github.event.deployment.environment == 'all' || github.event.inputs.environment == 'dev-midwest' || github.event.inputs.environment == 'all' }}
env:
TF_VAR_aws_provider_role_arn: arn:example
TF_VAR_example_api_key: ${{ secrets.DEV_MIDWEST_API_KEY }}
TF_VAR_example_app_key: ${{ secrets.DEV_MIDWEST_APP_KEY }}
TF_WORKSPACE: dev-midwest
steps:
- name: Run Terraform Apply Composite
uses: GetTerminus/example/multi-workspace/terraform-apply@1.0
with:
ssh_key: ${{ secrets.GH_ACTIONS_SSH_PRIVATE_KEY }}
deploy-prod-east:
name: TF Apply - Prod East
needs: deploy-dev
runs-on: ubuntu-latest
if: ${{ github.event.deployment.environment == 'prod-east' || github.event.deployment.environment == 'all' || github.event.inputs.environment == 'prod-east' || github.event.inputs.environment == 'all' }}
env:
TF_VAR_aws_provider_role_arn: arn:example
TF_VAR_example_api_key: ${{ secrets.PROD_EAST_API_KEY }}
TF_VAR_example_app_key: ${{ secrets.PROD_EAST_APP_KEY }}
TF_WORKSPACE: prod-east
steps:
- name: Run Terraform Apply Composite
uses: GetTerminus/example/multi-workspace/terraform-apply@1.0
with:
ssh_key: ${{ secrets.GH_ACTIONS_SSH_PRIVATE_KEY }}
deploy-prod-midwest:
name: TF Apply - Prod Midwest
needs: deploy-dev-midwest
runs-on: ubuntu-latest
if: ${{ github.event.deployment.environment == 'prod-midwest' || github.event.deployment.environment == 'all' || github.event.inputs.environment == 'prod-midwest' || github.event.inputs.environment == 'all' }}
env:
TF_VAR_aws_provider_role_arn: arn:example
TF_VAR_example_api_key: ${{ secrets.PROD_MIDWEST_API_KEY }}
TF_VAR_example_app_key: ${{ secrets.PROD_MIDWEST_APP_KEY }}
TF_WORKSPACE: prod-midwest
steps:
- name: Run Terraform Apply Composite
uses: GetTerminus/example/multi-workspace/terraform-apply@1.0
with:
ssh_key: ${{ secrets.GH_ACTIONS_SSH_PRIVATE_KEY }}
部署.yaml:
name: Master Deployments
on:
push:
branches: [ master ]
jobs:
deploy-all:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Create Sequential Deployments
uses: chrnorm/deployment-action@releases/v1
with:
token: ${{ secrets.GH_DEPLOYMENT_ACCESS_TOKEN_EXAMPLE }}
environment: all
最佳答案
对于您的示例,矩阵解决方案如下所示:
name: Terraform Apply
on:
push:
inputs:
environment:
description: "name of the environment"
required: true
default: "dev"
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
environment: [dev, dev-midwest, prod-east, prod-midwest]
steps:
- name: Deploy
if: ${{ github.event.inputs.environment == 'all' || (matrix.environment == github.event.inputs.environment) }}
shell: bash
run: |
echo "Hello World !!! ${{ matrix.environment }}"
关于yaml - Github 操作矩阵包括基于 GitHub 事件有条件的条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70697950/
如何在 2014-10-04 - 2014-10-30 仅工作日和 08.00 - 20.00 之间随机更新日期列? 2014-10-04 - 2014-10-30 random working-da
我有一个二维 (3x7) 数组,我想转换为一维数组,以便我提供的行位于中心。行值可能沿途变化,但必须位于中心。 #define numRows 3 #define numCols 7 #define
我有2张 table : 第一个是“人”: person_id, 人名 第二个是“PersonsGraphs”: person_id1, person_id2, 关系类型 我正在寻找一种建立“家谱”的
是否可以在序列化 JSON 响应的同时根据 If 条件排除某些元素? if(a == 1) { //show element } else { //don't show element }
是否可以在序列化 JSON 响应的同时根据 If 条件排除某些元素? if(a == 1) { //show element } else { //don't show element }
尝试使用 jQuery 编写一个条件,该条件基本上说明,如果 div.gathering 不包含 a.cat-link,则执行以下操作。我已经尝试过以下方法,但似乎不起作用。有人能解释一下吗? if(
该练习要求插入值 x 的副本(这也是要在列表中搜索的值),但前提是该位置是另一个值 n 的倍数。未指定副本应插入到 x 值之前还是之后。 我的问题是并非在所有情况下都插入副本。我认为问题在于,当我插入
我遇到了这个[问题]:How can I store values into a multi-parameter struct and pass typedef struct to a functio
出于某种原因,当我编写 getWinner() 时,它仅适用于 2 种情况(最后一行)。就对角线和列而言,我拥有其他一切,但第 2 行(嗯,三,但数组,所以 2)基本上只适用于 o。只有当 o 位于
我有一个问题。 我想将“guid”列中的值复制到“帖子内容” 所有行都在一个表“wp-posts”中 “postparent”列中的一行有一个值,而“ID”列中的另一项也有相同的值 我必须做的事情是
我想将两个像这样的表合并到一个表中,并为重复的键行添加合并表中最旧的 DateAdded 值。 (Key1,Key2) 是主键。 +-----------+-----------+------+---
通过下面的表格和数据,我试图获得最高的 effective_from每个唯一 brand 小于当前时间戳的值/model组合 - 实际上是每件商品的当前价格。 CREATE TABLE things
您能告诉我如何删除未知号码的最后一条记录(有条件)吗? 例如,在这种情况下我想删除id为6到10的记录。 注意:该表和记录不是恒定的。 +----+-----+---------+ | id | ur
这个问题不太可能对任何 future 的访客有帮助;它只与一个较小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,通常不适用于全世界的互联网受众。如需帮助使此问题更广泛适用,visit the
我有两个表, 标签 -> id,name,description,user,status 标签_连接。 -> id, Label_id, 类别 所以有多个类别,假设 1 => 新的,2 => 旧的。
好的,我会长话短说。 这是我的代码 String s = edittextkata.getText().toString(); String[] vowels = {"a","
我有一个非常具体的要求,我发现很难做到,我需要查找并替换文件中的某些行,但问题是文本不同,唯一的好处是它们都有一个 .[扩展名] 例如: 30/07/2012 14:46 17
我有一个大型数据库,其中存在各种不一致之处。我想澄清的项目之一是根据人口更改国家/地区状态。 数据样本是: { "_id" : "D", "name" : "Deutschland", "pop" :
我需要将范围(有条件)中的唯一值组合到同一行的另一个范围中。 其实我前两天发过类似的问题Link所提供的答案在我提出上述问题时有效。 但后来,我遇到了一个新问题,我宁愿问一个新的问题,让它更清楚: (
我刚开始使用 VBA,并且正在努力处理需要清理的工作表。 我有一列包含混合邮政编码和城市名称的字符串。我想从 A 列中提取邮政编码并放在 B 列中,并在 C 列中提取带有下划线的城市名称。 我的(示例
我是一名优秀的程序员,十分优秀!