wayfair-incubator / telefonistka

Safe and Controlled GitOps Promotion Across Environments/Failure-Domains
https://hub.docker.com/r/odedbenozer/telefonistka
MIT License
63 stars 7 forks source link

Fails on dry-run mode #97

Closed krzwiatrzyk closed 1 year ago

krzwiatrzyk commented 1 year ago

Description

Please provide a description of the problem. image

Expected Behaviour

Setup telefonistka based on instruction:

name: Telefonistka

on:
  pull_request:
    types: 
      - closed
      - opened
      - synchronize
    branches:
      - main

permissions:
  contents: write
  pull-requests: write
  statuses: write

jobs:
  telefonistka:
    runs-on: ubuntu-latest
    steps:
      - uses:  Oded-B/telefonistka-action@main
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
promotionPaths:
  - sourcePath: "configs/staging/[^/]*"
    promotionPrs:
      - targetPaths:
        - configs/production
dryRunMode: true
autoApprovePromotionPrs: true

Actual Behaviour

Error after merge

Affected Version

Current

Steps to Reproduce

Follow instruction

Checklist

krzwiatrzyk commented 1 year ago

And FYI, i checked if this tries to find those in local files and it doesn't, setting those files in repo won't change output.

Oded-B commented 1 year ago

I was able to reproduce. GitHub action override the default docker work dir with --workdir /github/workspace so the relative path reference fails. Hopefully I can force the working dir in the GH action yaml (as I prefer to keep using relative path)

Oded-B commented 1 year ago

https://github.com/actions/runner/issues/878 😭 And I use a "scratch" container so I can't "cd" my way around this. I'll have to allow overriding the template dir(or files) via environment variables or something like that

Oded-B commented 1 year ago

Please test the Set-TEMPLATES_PATH-to-support-GHA-workdir-override branch of the GH action repo and let me know. example config:

jobs:
  telefonistka:
    runs-on: ubuntu-latest
    steps:
      - uses:  Oded-B/telefonistka-action@Set-TEMPLATES_PATH-to-support-GHA-workdir-override
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
Oded-B commented 1 year ago

BTW, a wildcard at the end of the sourcePath("configs/staging/[^/]*") is only needed if there multiple directories that nest the component directory, like

configs/staging/clusterA/componentA
configs/staging/clusterA/componentB
configs/staging/clusterB/componentA
configs/staging/clusterB/componentB

If it's just

configs/staging/componentA
configs/staging/componentB

than - sourcePath: "configs/staging/" should be enough

see example repo: https://github.com/Oded-B/telefonistka-actions-example/blob/main/telefonistka.yaml