gpt4 book ai didi

github-actions - 将 secret 传递给可重用工作流时出错

转载 作者:行者123 更新时间:2023-12-05 01:06:15 24 4
gpt4 key购买 nike

我正在尝试调用可重用的工作流。

https://github.com/dhis2-sre/gha-workflows/blob/master/.github/workflows/instance-manager.yaml

调用者如下所示

name: Tests, build and deploy

on:
push:
branches:
- master
- feature/**
tags:
- v*.*.*

pull_request:

workflow_dispatch:

jobs:
call-workflow:
uses: dhis2-sre/gha-workflows/.github/workflows/instance-manager.yaml@v0.2.0
with:
DOCKER_IMAGE_NAME: dhis2/instance-manager-api
PROCESS_NAME: dhis2-instance-manager
DOCKER_USERNAME: "${{ secrets.DOCKER_USERNAME }}"
DOCKER_PASSWORD: "${{ secrets.DOCKER_PASSWORD }}"
SOPS_KMS_ARN: "${{ secrets.SOPS_KMS_ARN }}"
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
KUBECONFIG: "${{ secrets.KUBECONFIG }}"

我收到以下错误

Invalid workflow file
The workflow is not valid. .github/workflows/cicd.yaml (Line: 21, Col: 24): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DOCKER_USERNAME .github/workflows/cicd.yaml (Line: 22, Col: 24): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DOCKER_PASSWORD

关于我做错了什么的任何线索?如果我应该发布更多代码,请告诉我

最佳答案

调用者在“with”下有 secret ,应该在“ secret ”下

调用工作流程
...
jobs:
call-workflow:
uses: dhis2-sre/gha-workflows/.github/workflows/instance-manager.yaml@v0.2.0
with:
DOCKER_IMAGE_NAME: dhis2/instance-manager-api
PROCESS_NAME: dhis2-instance-manager
secrets:
DOCKER_USERNAME: "${{ secrets.DOCKER_USERNAME }}"
DOCKER_PASSWORD: "${{ secrets.DOCKER_PASSWORD }}"
SOPS_KMS_ARN: "${{ secrets.SOPS_KMS_ARN }}"
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
KUBECONFIG: "${{ secrets.KUBECONFIG }}"
调用的工作流
...
on:
workflow_call:
secrets:
DOCKER_USERNAME:
required: true
description: ''

关于github-actions - 将 secret 传递给可重用工作流时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69493352/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com