Skip to content

Commit

Permalink
fix templates
Browse files Browse the repository at this point in the history
  • Loading branch information
ankudinov committed May 5, 2024
1 parent 53ae394 commit 2100b18
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 20 deletions.
3 changes: 0 additions & 3 deletions .cc/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"__demo_group": "{{ cookiecutter.demo_group.lower() }}",
"__demo_slug": "{{ cookiecutter.__demo_group }}-{{ cookiecutter.__demo_name }}",
"demo_author": "Petr Ankudinov",
"__gh_org_name": "{{gh.org_name}}",
"__gh_repo_name": "{{gh.repo_name}}",
"__gh_slug": "{{ cookiecutter.__gh_org_name }}/{{ cookiecutter.__gh_repo_name }}",
"from_image": "ghcr.io/aristanetworks/avd/universal",
"from_variant": "python3.11-avd-v4.7.1",
"container_username": "avd",
Expand Down
2 changes: 1 addition & 1 deletion .cc/hooks/post_gen_project.sh.jinja
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

cp -r ./ ../
rm -rf /workspaces/{{ cookiecutter.__gh_repo_name }}/{{ cookiecutter.__demo_slug }}
rm -rf /workspaces/{% raw %}{{gh.repo_name}}{%endraw%}/{{ cookiecutter.__demo_slug }}

# print additional instructions
echo "The required files for {{ cookiecutter.demo_name }} were generated."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
set +e

# replace all markdown vars in demo directory
grep -rl '{{gh.repo_name}}' . --exclude-dir .git | xargs sed -i 's/{{gh.repo_name}}/'"${GITHUB_REPOSITORY##*/}"'/g'
grep -rl '{{gh.org_name}}' . --exclude-dir .git | xargs sed -i 's/{{gh.org_name}}/'"${GITHUB_REPOSITORY%%/*}"'/g'
grep -rl '{{gh.repository}}' . --exclude-dir .git | xargs sed -i 's@{{gh.org_name}}@'"${GITHUB_REPOSITORY}"'@g'
grep -rl {% raw %}'{{gh.repo_name}}'{%endraw%} . --exclude-dir .git | xargs sed -i 's/{% raw %}'{{gh.repo_name}}'{%endraw%}/'"${GITHUB_REPOSITORY##*/}"'/g'
grep -rl {% raw %}'{{gh.org_name}}'{%endraw%} . --exclude-dir .git | xargs sed -i 's/{% raw %}'{{gh.org_name}}'{%endraw%}/'"${GITHUB_REPOSITORY%%/*}"'/g'
grep -rl {% raw %}'{{gh.repository}}'{%endraw%} . --exclude-dir .git | xargs sed -i 's@{% raw %}'{{gh.repository}}'{%endraw%}@'"${GITHUB_REPOSITORY}"'@g'

CVTOKEN=$(curl -H "Authorization: Bearer ${CV_API_TOKEN}" "https://www.cv-staging.corp.arista.io/api/v3/services/admin.Enrollment/AddEnrollmentToken" -d '{"enrollmentToken":{"reenrollDevices":["*"],"validFor":"24h"}}' | sed -n 's|.*"token":"\([^"]*\)".*|\1|p')
echo "$CVTOKEN" > ${CONTAINERWSF}/clab/cv-onboarding-token
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ Last reviewed: {% now 'local', '%d/%m/%Y' %}

Please check the lab materials:

- [Lab Documentation](https://{{ cookiecutter.__gh_org_name }}.github.io/{{ cookiecutter.__gh_repo_name }}/{{cookiecutter.__demo_slug}}/{{cookiecutter.__demo_slug}}/)
- [HTML Slides](https://{{ cookiecutter.__gh_org_name }}.github.io/{{ cookiecutter.__gh_repo_name }}/slides/{{cookiecutter.__demo_slug}}.html)
- [PDF Slides](https://{{ cookiecutter.__gh_org_name }}.github.io/{{ cookiecutter.__gh_repo_name }}/pdfs/{{cookiecutter.__demo_slug}}.pdf)
- [Lab Documentation](https://{% raw %}{{gh.org_name}}{%endraw%}.github.io/{% raw %}{{gh.repo_name}}{%endraw%}/{{cookiecutter.__demo_slug}}/{{cookiecutter.__demo_slug}}/)
- [HTML Slides](https://{% raw %}{{gh.org_name}}{%endraw%}.github.io/{% raw %}{{gh.repo_name}}{%endraw%}/slides/{{cookiecutter.__demo_slug}}.html)
- [PDF Slides](https://{% raw %}{{gh.org_name}}{%endraw%}.github.io/{% raw %}{{gh.repo_name}}{%endraw%}/pdfs/{{cookiecutter.__demo_slug}}.pdf)
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
:material-alert-circle-outline:{ .heartbeat } Please request high spec Codespace machines from [Github support](https://support.github.com/) first!
{%- endif %}

[Start "{{ cookiecutter.demo_name }}" in Codespace](https://codespaces.new/{{ cookiecutter.__gh_slug }}?quickstart=1&devcontainer_path=.devcontainer%2F{{ cookiecutter.__demo_slug }}%2Fdevcontainer.json){ .md-button .md-button--primary target=_blank}
[Start "{{ cookiecutter.demo_name }}" in Codespace](https://codespaces.new/{% raw %}'{{gh.repository}}'{%endraw%}?quickstart=1&devcontainer_path=.devcontainer%2F{{ cookiecutter.__demo_slug }}%2Fdevcontainer.json){ .md-button .md-button--primary target=_blank}

[Slides](https://{{ cookiecutter.__gh_org_name }}.github.io/{{ cookiecutter.__gh_repo_name }}/slides/{{ cookiecutter.__demo_slug }}.html){ target=_blank }
[PDF Slides](https://{{ cookiecutter.__gh_org_name }}.github.io/{{ cookiecutter.__gh_repo_name }}/pdfs/{{ cookiecutter.__demo_slug }}.pdf){ target=_blank }
[Slides](https://{% raw %}{{gh.org_name}}{%endraw%}.github.io/{% raw %}{{gh.repo_name}}{%endraw%}/slides/{{ cookiecutter.__demo_slug }}.html){ target=_blank }
[PDF Slides](https://{% raw %}{{gh.org_name}}{%endraw%}.github.io/{% raw %}{{gh.repo_name}}{%endraw%}/pdfs/{{ cookiecutter.__demo_slug }}.pdf){ target=_blank }

!!! Info "Last reviewed: {% now 'local', '%d/%m/%Y' %}"

Expand All @@ -41,7 +41,7 @@
## How To Run The Lab on Your Machine

It is possible to run the lab on your local machine (or any server) instead of using Github Codespaces.
You can [download all required lab files here](https://{{ cookiecutter.__gh_org_name }}.github.io/one-click-se-demos/lab_archives/{{ cookiecutter.__demo_slug }}.tar.gz).
You can [download all required lab files here](https://{% raw %}{{gh.org_name}}{%endraw%}.github.io/one-click-se-demos/lab_archives/{{ cookiecutter.__demo_slug }}.tar.gz).
However you must take care of you VSCode setup and setting up environment variables. Also keep in mind that auto-downloaded image will not work on ARM-based MacBooks.

## How To Run The Demo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ _paginate: false
# Q&A

- [Ansible AVD](https://avd.arista.com/)
- [This repository](https://github.com/{{ cookiecutter.__gh_slug }})
- [This repository](https://github.com/{% raw %}'{{gh.repository}}'{%endraw%})
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set +e
# replace all markdown vars in demo directory
grep -rl '{{gh.repo_name}}' . --exclude-dir .git | xargs sed -i 's/{{gh.repo_name}}/'"${GITHUB_REPOSITORY##*/}"'/g'
grep -rl '{{gh.org_name}}' . --exclude-dir .git | xargs sed -i 's/{{gh.org_name}}/'"${GITHUB_REPOSITORY%%/*}"'/g'
grep -rl '{{gh.repository}}' . --exclude-dir .git | xargs sed -i 's@{{gh.org_name}}@'"${GITHUB_REPOSITORY}"'@g'
grep -rl '{{gh.repository}}' . --exclude-dir .git | xargs sed -i 's@{{gh.repository}}@'"${GITHUB_REPOSITORY}"'@g'

CVTOKEN=$(curl -H "Authorization: Bearer ${CV_API_TOKEN}" "https://www.cv-staging.corp.arista.io/api/v3/services/admin.Enrollment/AddEnrollmentToken" -d '{"enrollmentToken":{"reenrollDevices":["*"],"validFor":"24h"}}' | sed -n 's|.*"token":"\([^"]*\)".*|\1|p')
echo "$CVTOKEN" > ${CONTAINERWSF}/clab/cv-onboarding-token
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ set +e
# replace all markdown vars in demo directory
grep -rl '{{gh.repo_name}}' . --exclude-dir .git | xargs sed -i 's/{{gh.repo_name}}/'"${GITHUB_REPOSITORY##*/}"'/g'
grep -rl '{{gh.org_name}}' . --exclude-dir .git | xargs sed -i 's/{{gh.org_name}}/'"${GITHUB_REPOSITORY%%/*}"'/g'
grep -rl '{{gh.repository}}' . --exclude-dir .git | xargs sed -i 's@{{gh.org_name}}@'"${GITHUB_REPOSITORY}"'@g'
grep -rl '{{gh.repository}}' . --exclude-dir .git | xargs sed -i 's@{{gh.repository}}@'"${GITHUB_REPOSITORY}"'@g'

ardl get eos --image-type cEOS --version ${CEOS_LAB_VERSION} --import-docker
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set +e
# replace all markdown vars in demo directory
grep -rl '{{gh.repo_name}}' . --exclude-dir .git | xargs sed -i 's/{{gh.repo_name}}/'"${GITHUB_REPOSITORY##*/}"'/g'
grep -rl '{{gh.org_name}}' . --exclude-dir .git | xargs sed -i 's/{{gh.org_name}}/'"${GITHUB_REPOSITORY%%/*}"'/g'
grep -rl '{{gh.repository}}' . --exclude-dir .git | xargs sed -i 's@{{gh.org_name}}@'"${GITHUB_REPOSITORY}"'@g'
grep -rl '{{gh.repository}}' . --exclude-dir .git | xargs sed -i 's@{{gh.repository}}@'"${GITHUB_REPOSITORY}"'@g'

ardl get eos --image-type cEOS --version ${CEOS_LAB_VERSION} --import-docker

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set +e
# replace all markdown vars in demo directory
grep -rl '{{gh.repo_name}}' . --exclude-dir .git | xargs sed -i 's/{{gh.repo_name}}/'"${GITHUB_REPOSITORY##*/}"'/g'
grep -rl '{{gh.org_name}}' . --exclude-dir .git | xargs sed -i 's/{{gh.org_name}}/'"${GITHUB_REPOSITORY%%/*}"'/g'
grep -rl '{{gh.repository}}' . --exclude-dir .git | xargs sed -i 's@{{gh.org_name}}@'"${GITHUB_REPOSITORY}"'@g'
grep -rl '{{gh.repository}}' . --exclude-dir .git | xargs sed -i 's@{{gh.repository}}@'"${GITHUB_REPOSITORY}"'@g'

CVTOKEN=$(curl -H "Authorization: Bearer ${CV_API_TOKEN}" "https://www.cv-staging.corp.arista.io/api/v3/services/admin.Enrollment/AddEnrollmentToken" -d '{"enrollmentToken":{"reenrollDevices":["*"],"validFor":"24h"}}' | sed -n 's|.*"token":"\([^"]*\)".*|\1|p')
echo "$CVTOKEN" > ${CONTAINERWSF}/clab/cv-onboarding-token
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set +e
# replace all markdown vars in demo directory
grep -rl '{{gh.repo_name}}' . --exclude-dir .git | xargs sed -i 's/{{gh.repo_name}}/'"${GITHUB_REPOSITORY##*/}"'/g'
grep -rl '{{gh.org_name}}' . --exclude-dir .git | xargs sed -i 's/{{gh.org_name}}/'"${GITHUB_REPOSITORY%%/*}"'/g'
grep -rl '{{gh.repository}}' . --exclude-dir .git | xargs sed -i 's@{{gh.org_name}}@'"${GITHUB_REPOSITORY}"'@g'
grep -rl '{{gh.repository}}' . --exclude-dir .git | xargs sed -i 's@{{gh.repository}}@'"${GITHUB_REPOSITORY}"'@g'

CVTOKEN=$(curl -H "Authorization: Bearer ${CV_API_TOKEN}" "https://www.cv-staging.corp.arista.io/api/v3/services/admin.Enrollment/AddEnrollmentToken" -d '{"enrollmentToken":{"reenrollDevices":["*"],"validFor":"24h"}}' | sed -n 's|.*"token":"\([^"]*\)".*|\1|p')
echo "$CVTOKEN" > ${CONTAINERWSF}/clab/cv-onboarding-token
Expand Down

0 comments on commit 2100b18

Please sign in to comment.