From 1b68fe68708c29c63e38b73fdebbabc240c07433 Mon Sep 17 00:00:00 2001 From: Jan Snasel Date: Thu, 18 Jan 2024 11:10:46 +0000 Subject: [PATCH 1/4] feat: Re-bake --- .github/workflows/tag-nautobot-app.yml | 40 ++++++ .../.github/workflows/rebake.yml | 1 - .../.github/workflows/rebake.yml | 1 - .../.github/workflows/rebake.yml | 118 ------------------ 4 files changed, 40 insertions(+), 120 deletions(-) create mode 100644 .github/workflows/tag-nautobot-app.yml delete mode 120000 nautobot-app-chatops/{{ cookiecutter.project_slug }}/.github/workflows/rebake.yml delete mode 120000 nautobot-app-ssot/{{ cookiecutter.project_slug }}/.github/workflows/rebake.yml delete mode 100644 nautobot-app/{{ cookiecutter.project_slug }}/.github/workflows/rebake.yml 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 %} From 06f590329b964b336d93ec76eb3048a6574caf08 Mon Sep 17 00:00:00 2001 From: Jan Snasel Date: Fri, 19 Jan 2024 11:17:04 +0000 Subject: [PATCH 2/4] chore: Disable nautobot-app tag workflow --- .github/workflows/tag-nautobot-app.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tag-nautobot-app.yml b/.github/workflows/tag-nautobot-app.yml index b542603d..60f334ba 100644 --- a/.github/workflows/tag-nautobot-app.yml +++ b/.github/workflows/tag-nautobot-app.yml @@ -1,9 +1,10 @@ --- name: "Rebake Tag" on: # yamllint disable-line rule:truthy - push: - tags: - - "nautobot-app-v*" + - "workflow_dispatch" + # push: + # tags: + # - "nautobot-app-v*" jobs: rebake: container: "ghcr.io/nautobot/cookiecutter-nautobot-app-drift-manager/prod:latest" From cb4fff58b52a52f08deea03e41c84601ada7c45b Mon Sep 17 00:00:00 2001 From: Jan Snasel Date: Fri, 19 Jan 2024 11:29:45 +0000 Subject: [PATCH 3/4] fix: Doc --- docs/admin/compatibility_matrix.md | 2 +- docs/user/quick-start.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/admin/compatibility_matrix.md b/docs/admin/compatibility_matrix.md index f419353d..4aaf8d76 100644 --- a/docs/admin/compatibility_matrix.md +++ b/docs/admin/compatibility_matrix.md @@ -1,6 +1,6 @@ # Compatibility Matrix -This table shows the target Nautobot versions which the templates in this repository are compatible with. For example, if you wish to build an App for Nautobot 1.6, then you should use the templates from `v1.2` (or whichever is the latest v1.x) of the repository. These specific versions are git tags. +This table shows the target Nautobot versions which the templates in this repository are compatible with. For example, if you wish to build an App for Nautobot 1.6, then you should use the templates from `nautobot-app-v1.2.0` (or whichever is the latest `nautobot-app-v1.x.y) of the repository. These specific versions are git tags. | Repo Release Version | Nautobot First Support Version | Nautobot Last Support Version | | ------------- | -------------------- | ------------- | diff --git a/docs/user/quick-start.md b/docs/user/quick-start.md index 5b10b58f..3ca2678f 100644 --- a/docs/user/quick-start.md +++ b/docs/user/quick-start.md @@ -176,5 +176,5 @@ The file `creds.env` will be ignored by git and can be used to override default The cookiecutter CLI tool uses the default branch when using the above example command, to use a different branch, commit, or tag the `--checkout` command line argument can be used. - `--checkout=main` will bake the cookie against the main branch -- `--checkout=v1.0.0` will bake the cookie against the `v1.0.0` tag +- `--checkout=nautobot-app-v1.0.0` will bake the cookie against the `nautobot-app-v1.0.0` tag - `--checkout=6769dee` will bake the cookie against the `6769dee` commit From 27356c4164d1236682c90118b3db2785ac3a1b3c Mon Sep 17 00:00:00 2001 From: Jan Snasel Date: Fri, 19 Jan 2024 11:30:03 +0000 Subject: [PATCH 4/4] fix: Enable rebake workflow --- .github/workflows/tag-nautobot-app.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tag-nautobot-app.yml b/.github/workflows/tag-nautobot-app.yml index 60f334ba..b542603d 100644 --- a/.github/workflows/tag-nautobot-app.yml +++ b/.github/workflows/tag-nautobot-app.yml @@ -1,10 +1,9 @@ --- name: "Rebake Tag" on: # yamllint disable-line rule:truthy - - "workflow_dispatch" - # push: - # tags: - # - "nautobot-app-v*" + push: + tags: + - "nautobot-app-v*" jobs: rebake: container: "ghcr.io/nautobot/cookiecutter-nautobot-app-drift-manager/prod:latest"