diff --git a/.cc/{{cookiecutter.__demo_slug}}/containers/{{cookiecutter.__demo_slug}}/.devcontainer/postCreate.sh.jinja b/.cc/{{cookiecutter.__demo_slug}}/containers/{{cookiecutter.__demo_slug}}/.devcontainer/postCreate.sh.jinja index 89a5348..0b1bfcb 100644 --- a/.cc/{{cookiecutter.__demo_slug}}/containers/{{cookiecutter.__demo_slug}}/.devcontainer/postCreate.sh.jinja +++ b/.cc/{{cookiecutter.__demo_slug}}/containers/{{cookiecutter.__demo_slug}}/.devcontainer/postCreate.sh.jinja @@ -2,6 +2,13 @@ set +e +# replace all markdown vars in demo directory +grep -rl 'https://.*.github.io/one-click-se-demos/' . --exclude-dir .git | xargs sed -i 's/https:\/\/.*.github.io\/one-click-se-demos/https:\/\/'"${GITHUB_REPOSITORY%%/*}"'.github.io\/one-click-se-demos/g' +grep -rl 'https://github.com/.*/one-click-se-demos' . --exclude-dir .git | xargs sed -i 's/https:\/\/github.com\/.*\/one-click-se-demos/https:\/\/github.com\/'"${GITHUB_REPOSITORY%%/*}"'\/one-click-se-demos/g' +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' + 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 ardl get eos --image-type cEOS --version ${CEOS_LAB_VERSION} --import-docker diff --git a/.devcontainer/clab-build-containerlab-with-ceos/devcontainer.json b/.devcontainer/clab-build-containerlab-with-ceos/devcontainer.json index b6f1e25..a8c8c88 100644 --- a/.devcontainer/clab-build-containerlab-with-ceos/devcontainer.json +++ b/.devcontainer/clab-build-containerlab-with-ceos/devcontainer.json @@ -17,7 +17,6 @@ "memory": "16gb", "storage": "32gb" }, - // "onCreateCommand": "onCreate.sh", "postCreateCommand": "postCreate.sh", "workspaceMount": "source=${localWorkspaceFolder}/demos/${containerWorkspaceFolder},target=/${containerWorkspaceFolder},type=bind", "workspaceFolder": "/clab-build-containerlab-with-ceos" diff --git a/containers/avd-avd-extended-workshop--part-1/.devcontainer/postCreate.sh b/containers/avd-avd-extended-workshop--part-1/.devcontainer/postCreate.sh index 89a5348..0b1bfcb 100644 --- a/containers/avd-avd-extended-workshop--part-1/.devcontainer/postCreate.sh +++ b/containers/avd-avd-extended-workshop--part-1/.devcontainer/postCreate.sh @@ -2,6 +2,13 @@ set +e +# replace all markdown vars in demo directory +grep -rl 'https://.*.github.io/one-click-se-demos/' . --exclude-dir .git | xargs sed -i 's/https:\/\/.*.github.io\/one-click-se-demos/https:\/\/'"${GITHUB_REPOSITORY%%/*}"'.github.io\/one-click-se-demos/g' +grep -rl 'https://github.com/.*/one-click-se-demos' . --exclude-dir .git | xargs sed -i 's/https:\/\/github.com\/.*\/one-click-se-demos/https:\/\/github.com\/'"${GITHUB_REPOSITORY%%/*}"'\/one-click-se-demos/g' +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' + 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 ardl get eos --image-type cEOS --version ${CEOS_LAB_VERSION} --import-docker diff --git a/containers/avd_extended_workshop/.devcontainer/postCreate.sh b/containers/avd_extended_workshop/.devcontainer/postCreate.sh index 520e612..e05da19 100644 --- a/containers/avd_extended_workshop/.devcontainer/postCreate.sh +++ b/containers/avd_extended_workshop/.devcontainer/postCreate.sh @@ -2,4 +2,11 @@ set +e +# replace all markdown vars in demo directory +grep -rl 'https://.*.github.io/one-click-se-demos/' . --exclude-dir .git | xargs sed -i 's/https:\/\/.*.github.io\/one-click-se-demos/https:\/\/'"${GITHUB_REPOSITORY%%/*}"'.github.io\/one-click-se-demos/g' +grep -rl 'https://github.com/.*/one-click-se-demos' . --exclude-dir .git | xargs sed -i 's/https:\/\/github.com\/.*\/one-click-se-demos/https:\/\/github.com\/'"${GITHUB_REPOSITORY%%/*}"'\/one-click-se-demos/g' +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' + ardl get eos --image-type cEOS --version ${CEOS_LAB_VERSION} --import-docker diff --git a/containers/clab-build-containerlab-with-ceos/.devcontainer/onCreate.sh b/containers/clab-build-containerlab-with-ceos/.devcontainer/onCreate.sh deleted file mode 100644 index 27a2405..0000000 --- a/containers/clab-build-containerlab-with-ceos/.devcontainer/onCreate.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set +e - -# replace all markdown vars in demo directory -grep -rl 'https://.*.github.io/one-click-se-demos/' . --exclude-dir .git | xargs sed -i 's/https:\/\/.*.github.io\/one-click-se-demos/https:\/\/'"${GITHUB_REPOSITORY%%/*}"'.github.io\/one-click-se-demos/g' -grep -rl 'https://github.com/.*/one-click-se-demos' . --exclude-dir .git | xargs sed -i 's/https:\/\/github.com\/.*\/one-click-se-demos/https:\/\/github.com\/'"${GITHUB_REPOSITORY%%/*}"'\/one-click-se-demos/g' -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' diff --git a/containers/clab-build-containerlab-with-ceos/.devcontainer/postCreate.sh b/containers/clab-build-containerlab-with-ceos/.devcontainer/postCreate.sh index 412c480..78d7c32 100644 --- a/containers/clab-build-containerlab-with-ceos/.devcontainer/postCreate.sh +++ b/containers/clab-build-containerlab-with-ceos/.devcontainer/postCreate.sh @@ -2,8 +2,6 @@ set +e -ardl get eos --image-type cEOS --version ${CEOS_LAB_VERSION} --import-docker - # replace all markdown vars in demo directory grep -rl 'https://.*.github.io/one-click-se-demos/' . --exclude-dir .git | xargs sed -i 's/https:\/\/.*.github.io\/one-click-se-demos/https:\/\/'"${GITHUB_REPOSITORY%%/*}"'.github.io\/one-click-se-demos/g' grep -rl 'https://github.com/.*/one-click-se-demos' . --exclude-dir .git | xargs sed -i 's/https:\/\/github.com\/.*\/one-click-se-demos/https:\/\/github.com\/'"${GITHUB_REPOSITORY%%/*}"'\/one-click-se-demos/g' @@ -11,6 +9,8 @@ grep -rl '{{gh.repo_name}}' . --exclude-dir .git | xargs sed -i 's/{{gh.repo_nam 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' +ardl get eos --image-type cEOS --version ${CEOS_LAB_VERSION} --import-docker + # init demo dir as Git repo if requested for this demo env if ${GIT_INIT}; then cd ${CONTAINERWSF} diff --git a/containers/cvaas-cvaas-and-avd-demo--evpn-aa/.devcontainer/postCreate.sh b/containers/cvaas-cvaas-and-avd-demo--evpn-aa/.devcontainer/postCreate.sh index 89a5348..0b1bfcb 100644 --- a/containers/cvaas-cvaas-and-avd-demo--evpn-aa/.devcontainer/postCreate.sh +++ b/containers/cvaas-cvaas-and-avd-demo--evpn-aa/.devcontainer/postCreate.sh @@ -2,6 +2,13 @@ set +e +# replace all markdown vars in demo directory +grep -rl 'https://.*.github.io/one-click-se-demos/' . --exclude-dir .git | xargs sed -i 's/https:\/\/.*.github.io\/one-click-se-demos/https:\/\/'"${GITHUB_REPOSITORY%%/*}"'.github.io\/one-click-se-demos/g' +grep -rl 'https://github.com/.*/one-click-se-demos' . --exclude-dir .git | xargs sed -i 's/https:\/\/github.com\/.*\/one-click-se-demos/https:\/\/github.com\/'"${GITHUB_REPOSITORY%%/*}"'\/one-click-se-demos/g' +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' + 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 ardl get eos --image-type cEOS --version ${CEOS_LAB_VERSION} --import-docker diff --git a/containers/cvaas-cvaas-and-avd-demo--evpn-mlag/.devcontainer/postCreate.sh b/containers/cvaas-cvaas-and-avd-demo--evpn-mlag/.devcontainer/postCreate.sh index 89a5348..0b1bfcb 100644 --- a/containers/cvaas-cvaas-and-avd-demo--evpn-mlag/.devcontainer/postCreate.sh +++ b/containers/cvaas-cvaas-and-avd-demo--evpn-mlag/.devcontainer/postCreate.sh @@ -2,6 +2,13 @@ set +e +# replace all markdown vars in demo directory +grep -rl 'https://.*.github.io/one-click-se-demos/' . --exclude-dir .git | xargs sed -i 's/https:\/\/.*.github.io\/one-click-se-demos/https:\/\/'"${GITHUB_REPOSITORY%%/*}"'.github.io\/one-click-se-demos/g' +grep -rl 'https://github.com/.*/one-click-se-demos' . --exclude-dir .git | xargs sed -i 's/https:\/\/github.com\/.*\/one-click-se-demos/https:\/\/github.com\/'"${GITHUB_REPOSITORY%%/*}"'\/one-click-se-demos/g' +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' + 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 ardl get eos --image-type cEOS --version ${CEOS_LAB_VERSION} --import-docker