diff --git a/.github/workflows/tag-nautobot-app.yml b/.github/workflows/tag-nautobot-app.yml new file mode 100644 index 00000000..b542603d --- /dev/null +++ b/.github/workflows/tag-nautobot-app.yml @@ -0,0 +1,40 @@ +--- +name: "Rebake Tag" +on: # yamllint disable-line rule:truthy + push: + tags: + - "nautobot-app-v*" +jobs: + rebake: + container: "ghcr.io/nautobot/cookiecutter-nautobot-app-drift-manager/prod:latest" + runs-on: "ubuntu-22.04" + env: + GITHUB_TOKEN: "${{ secrets.GH_NAUTOBOT_BOT_TOKEN }}" + strategy: + fail-fast: false + max-parallel: 5 # Limit of concurrent jobs + matrix: + name: + - "capacity-metrics" + - "chatops" + - "circuit-maintenance" + - "data-validation-engine" + - "device-lifecycle-mgmt" + - "device-onboarding" + - "firewall-models" + - "floor-plan" + - "golden-config" + - "netbox-importer" + - "nornir" + - "secrets-providers" + - "ssot" + - "version-control" + - "welcome-wizard" + steps: + - name: "Re-bake" + run: | + python -m ntc_cookie_drift_manager \ + rebake \ + --push \ + --template-ref="${{ github.ref }}" \ + https://github.com/nautobot/nautobot-app-${{ matrix.name }}.git diff --git a/nautobot-app-chatops/{{ cookiecutter.project_slug }}/.github/workflows/rebake.yml b/nautobot-app-chatops/{{ cookiecutter.project_slug }}/.github/workflows/rebake.yml deleted file mode 120000 index 2559c895..00000000 --- a/nautobot-app-chatops/{{ cookiecutter.project_slug }}/.github/workflows/rebake.yml +++ /dev/null @@ -1 +0,0 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/.github/workflows/rebake.yml \ No newline at end of file diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/.github/workflows/rebake.yml b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/.github/workflows/rebake.yml deleted file mode 120000 index 2559c895..00000000 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/.github/workflows/rebake.yml +++ /dev/null @@ -1 +0,0 @@ -../../../../nautobot-app/{{ cookiecutter.project_slug }}/.github/workflows/rebake.yml \ No newline at end of file diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/.github/workflows/rebake.yml b/nautobot-app/{{ cookiecutter.project_slug }}/.github/workflows/rebake.yml deleted file mode 100644 index 04282da3..00000000 --- a/nautobot-app/{{ cookiecutter.project_slug }}/.github/workflows/rebake.yml +++ /dev/null @@ -1,118 +0,0 @@ ---- -name: "Rebake Cookie" -on: # yamllint disable-line rule:truthy - workflow_call: - inputs: - cookie: - description: "The cookie to rebake" - type: "string" - default: "" - draft: - description: "Whether to create the pull request as a draft" - type: "string" - default: "" - pull-request: - description: "The pull request strategy" - type: "string" - default: "" - template: - description: "The template repository URL" - type: "string" - default: "" - template-dir: - description: "The directory within the template repository to use as the template" - type: "string" - default: "" - template-ref: - description: "The branch or tag to use for the template" - type: "string" - default: "" - drift-manager-tag: - description: "The drift manager Docker image tag to use" - type: "string" - default: "latest" - workflow_dispatch: - inputs: - cookie: - description: "The cookie to rebake" - type: "string" - default: "" - draft: - description: "Whether to create the pull request as a draft" - type: "string" - default: "" - pull-request: - description: "The pull request strategy" - type: "string" - default: "" - template: - description: "The template repository URL" - type: "string" - default: "" - template-dir: - description: "The directory within the template repository to use as the template" - type: "string" - default: "" - template-ref: - description: "The branch or tag to use for the template" - type: "string" - default: "" - drift-manager-tag: - description: "The drift manager Docker image tag to use" - type: "string" - default: "latest" -jobs: - rebake: - runs-on: "ubuntu-22.04" - permissions: - actions: "write" - contents: "write" - packages: "read" - pull-requests: "write" - container: "ghcr.io/nautobot/cookiecutter-nautobot-app-drift-manager/prod:{% raw %}${{ github.event.inputs.drift-manager-tag }}{% endraw %}" - env: - GITHUB_TOKEN: "{% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}" - steps: - - name: "Configure Rebake Arguments" - id: "config" - shell: "bash" - run: | - ARGS='--push' - - if [[ '{% raw %}${{ github.event.inputs.draft }}{% endraw %}' == 'true' ]]; then - ARGS="$ARGS --draft" - elif [[ '{% raw %}${{ github.event.inputs.draft }}{% endraw %}' == 'false' ]]; then - ARGS="$ARGS --no-draft" - elif [[ '{% raw %}${{ github.event.inputs.draft }}{% endraw %}' == '' ]]; then - echo "Using repo default value for --draft" - else - echo "ERROR: Invalid value for draft: '{% raw %}${{ github.event.inputs.draft }}{% endraw %}'" - exit 1 - fi - - if [[ '{% raw %}${{ github.event.inputs.pull-request }}{% endraw %}' != '' ]]; then - ARGS="$ARGS --pull-request='{% raw %}${{ github.event.inputs.pull-request }}{% endraw %}'" - fi - - if [[ '{% raw %}${{ github.event.inputs.template }}{% endraw %}' != '' ]]; then - ARGS="$ARGS --template='{% raw %}${{ github.event.inputs.template }}{% endraw %}'" - fi - - if [[ '{% raw %}${{ github.event.inputs.template-dir }}{% endraw %}' != '' ]]; then - ARGS="$ARGS --template-dir='{% raw %}${{ github.event.inputs.template-dir }}{% endraw %}'" - fi - - if [[ '{% raw %}${{ github.event.inputs.template-ref }}{% endraw %}' != '' ]]; then - ARGS="$ARGS --template-ref='{% raw %}${{ github.event.inputs.template-ref }}{% endraw %}'" - fi - - if [[ '{% raw %}${{ github.event.inputs.cookie }}{% endraw %}' == '' ]]; then - ARGS="$ARGS '{% raw %}${{ github.repositoryUrl }}{% endraw %}'" - else - ARGS="$ARGS '{% raw %}${{ github.event.inputs.cookie }}{% endraw %}'" - fi - - echo "args=$ARGS" >> $GITHUB_OUTPUT - - name: "Rebake" - run: | - python -m ntc_cookie_drift_manager rebake {% raw %}${{ steps.config.outputs.args }}{% endraw %}