diff --git a/.github/workflows/test-pr.yaml b/.github/workflows/test-pr.yaml index 778bed4..4880de0 100644 --- a/.github/workflows/test-pr.yaml +++ b/.github/workflows/test-pr.yaml @@ -12,8 +12,10 @@ jobs: id: filter with: filters: | - color: ./**/color/** - hello: ./**/hello/** + ansible: ./**/ansible/** + tofu: ./**/tofu/** + kubectl: ./**/kubectl/** + ansible-kubernetes-tofu: ./**/ansible-kubernetes-tofu/** test: needs: [detect-changes] diff --git a/src/ansible-kubernetes-tofu/.devcontainer/Dockerfile b/src/ansible-kubernetes-tofu/.devcontainer/Dockerfile index 0753b8b..97261f5 100644 --- a/src/ansible-kubernetes-tofu/.devcontainer/Dockerfile +++ b/src/ansible-kubernetes-tofu/.devcontainer/Dockerfile @@ -4,29 +4,26 @@ LABEL org.opencontainers.image.source="https://github.com/jhoareaumarion/devcont LABEL org.opencontainers.image.description="Ansible + Kubernetes + OpenTofu for VS Code" LABEL org.opencontainers.image.licenses="MPL 2.0" -# Copy the installation script +# Copy the installation scripts COPY tofu/install_tofu.sh /tmp/install_tofu.sh +COPY kubectl/install_kubectl.sh /tmp/install_kubectl.sh +COPY ansible/install_ansible.sh /tmp/install_ansible.sh +COPY snap/install_snap.sh /tmp/install_snap.sh +COPY post_create.sh /usr/local/bin/post_create.sh + +# Making post_create runnable +RUN chmod +x /usr/local/bin/post_create.sh -# Run the script +# Run the scripts RUN /tmp/install_tofu.sh && \ rm /tmp/install_tofu.sh - -# Copy the installation script -COPY kubectl/install_kubectl.sh /tmp/install_kubectl.sh - -# Run the script RUN /tmp/install_kubectl.sh && \ rm /tmp/install_kubectl.sh - -# Copy the installation script -COPY ansible/install_ansible.sh /tmp/install_ansible.sh - -# Run the script RUN /tmp/install_ansible.sh && \ rm /tmp/install_ansible.sh +RUN /tmp/install_snap.sh && \ + rm /tmp/install_snap.sh -COPY ansible/post_create.sh /usr/local/bin/post_create.sh -RUN chmod +x /usr/local/bin/post_create.sh WORKDIR /workspace CMD ["/bin/bash"] \ No newline at end of file diff --git a/src/ansible-kubernetes-tofu/.devcontainer/devcontainer.json b/src/ansible-kubernetes-tofu/.devcontainer/devcontainer.json index 902ecd0..110112d 100644 --- a/src/ansible-kubernetes-tofu/.devcontainer/devcontainer.json +++ b/src/ansible-kubernetes-tofu/.devcontainer/devcontainer.json @@ -6,7 +6,8 @@ }, "containerEnv": { "PYTHON_PACKAGES": "${templateOption:additionalPythonPackages}", // comma-separated - "ANSIBLE_COLLECTIONS": "${templateOption:additionnalAnsibleCollections}" // comma-separated + "ANSIBLE_COLLECTIONS": "${templateOption:additionnalAnsibleCollections}", + "SNAP_PACKAGES": "${templateOption:additionalPythonPackages}" // comma-separated }, "customizations": { "vscode": { diff --git a/src/ansible-kubernetes-tofu/.devcontainer/ansible/post_create.sh b/src/ansible-kubernetes-tofu/.devcontainer/post_create.sh similarity index 73% rename from src/ansible-kubernetes-tofu/.devcontainer/ansible/post_create.sh rename to src/ansible-kubernetes-tofu/.devcontainer/post_create.sh index a33c181..600211d 100644 --- a/src/ansible-kubernetes-tofu/.devcontainer/ansible/post_create.sh +++ b/src/ansible-kubernetes-tofu/.devcontainer/post_create.sh @@ -15,6 +15,12 @@ if [ ! -z "$ANSIBLE_COLLECTIONS" ]; then ansible-galaxy collection install -r /tmp/requirements.yml fi +if [ ! -z "$SNAP_PACKAGES" ]; then + echo "Installing snap packages into the devcontainer.." + snap install $(echo $SNAP_PACKAGES | tr ',' ' ') +fi + # Cleanup environment variables unset PYTHON_PACKAGES -unset ANSIBLE_COLLECTIONS \ No newline at end of file +unset ANSIBLE_COLLECTIONS +unset SNAP_PACKAGES \ No newline at end of file diff --git a/src/ansible-kubernetes-tofu/.devcontainer/snap/install_snap.sh b/src/ansible-kubernetes-tofu/.devcontainer/snap/install_snap.sh new file mode 100644 index 0000000..06a7e34 --- /dev/null +++ b/src/ansible-kubernetes-tofu/.devcontainer/snap/install_snap.sh @@ -0,0 +1,3 @@ +apt install snapd + +snap install snapd \ No newline at end of file diff --git a/src/ansible-kubernetes-tofu/devcontainer-template.json b/src/ansible-kubernetes-tofu/devcontainer-template.json index b0218c0..100d6b8 100644 --- a/src/ansible-kubernetes-tofu/devcontainer-template.json +++ b/src/ansible-kubernetes-tofu/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "ansible-kubernetes-tofu", - "version": "1.0.0", + "version": "1.0.1", "name": "Ansible + Kubernetes + OpenTofu", "description": "Develop applications using Ansible, Kubernetes and OpenTofu", "documentationURL": "https://github.com/jhoareaumarion/devcontainers/blob/main/src/ansible-kubernetes-tofu/README.md", @@ -22,7 +22,7 @@ "3.10-bullseye", "3.9-bullseye" ], - "default": "3.12-bullseye" + "default": "3.12-bookworm" }, "additionalPythonPackages":{ "type": "string", @@ -33,6 +33,11 @@ "type": "string", "description": "A comma-separated list of ansible collections you want to include in the devcontainer. Example: `community.docker,ansible.posix,kubernetes.core`", "default": "" + }, + "additionnalSnapPackages":{ + "type": "string", + "description": "A comma-separated list of ansible collections you want to include in the devcontainer. Example: `hello-world`", + "default": "" } }, "platforms": ["Python"],