Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/test-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
25 changes: 11 additions & 14 deletions src/ansible-kubernetes-tofu/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
3 changes: 2 additions & 1 deletion src/ansible-kubernetes-tofu/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
unset ANSIBLE_COLLECTIONS
unset SNAP_PACKAGES
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apt install snapd

snap install snapd
9 changes: 7 additions & 2 deletions src/ansible-kubernetes-tofu/devcontainer-template.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -22,7 +22,7 @@
"3.10-bullseye",
"3.9-bullseye"
],
"default": "3.12-bullseye"
"default": "3.12-bookworm"
},
"additionalPythonPackages":{
"type": "string",
Expand All @@ -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"],
Expand Down
Loading