Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error passing secret to reusable workflow

I'm trying to call a reusable workflow.

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

The caller looks like the following

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/[email protected]
    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 }}"

I'm getting the following error

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

Any clue about what I'm doing wrong? Also please let me know if I should post more code

like image 213
user672009 Avatar asked Dec 16 '25 18:12

user672009


1 Answers

The caller had secrets under "with", should be under "secrets"

Calls Workflow
...
jobs:
  call-workflow:
    uses: dhis2-sre/gha-workflows/.github/workflows/[email protected]
    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 }}"
Called Workflow
...
on:
  workflow_call:
    secrets:
      DOCKER_USERNAME:
        required: true
        description: ''
like image 146
user672009 Avatar answered Dec 20 '25 00:12

user672009



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!