gscho / setup-cloud-custodian

GitHub action for installing cloud custodian

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request - add c7n-org

devops-cinch opened this issue · comments

Greetings,
Thanks for making this.
Would it possible t add c7n-org to this?

Thanks

Added in #3

Hey, is it me, or does c7n-org not work? It installed fine, but I cant run it?
The logs:

[....]
Successfully installed c7n-org-0.6.15 click-8.1.2 typing-extensions-4.2.0
1s
0s
Run for policy in policies/daily/*
#############################################
Policy: policies/daily/ebs-1y-old.yaml:
#############################################
/home/runner/work/_temp/7f9e050d-6e78-4c2a-8b04-eff0db498d19.sh: line 7: c7n-org: command not found
Error: Process completed with exit code 127.

My workflow:

name: daily-checks
on:
  workflow_dispatch:
  schedule:
    - cron: "30 7 * * *"

jobs:
  c7norg:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: gscho/setup-cloud-custodian@v1.2.0
        with:
          include-c7n-org: true
      
      - run: |
          for policy in policies/daily/*
          do
            rm -rf output
            echo "#############################################"
            echo "Policy: ${policy}:"
            echo "#############################################"
            c7n-org run --metrics --metrics-uri "aws://master?namespace=c7n" -c accounts-all.yaml -u ${policy} -s output -r eu-west-1
          done

@sbkg0002 You were correct. c7n-org is being installed under the same virtualenv as the c7n executable so I created a wrapper script for it as well. Also added a test to the test workflow.

Should be fixed in #4 and v1.2.1.