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
34 changes: 34 additions & 0 deletions .github/workflows/publish-devcontainer-features.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Publish dev container features"
on:
push:
branches:
- main
paths:
- .github/workflows/validate-devcontainer-feature.yml
- devcontainer/features/**
pull_request:
branches:
- main
paths:
- .github/workflows/validate-devcontainer-feature.yml
- devcontainer/features/**

jobs:
deploy:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3

- name: "Publish Features"
uses: devcontainers/action@v1.4.0
with:
publish-features: "true"
base-path-to-features: "./devcontainer/features"
generate-docs: "false"

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/validate-devcontainer-features.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Validate devcontainer-feature.json files"
on:
push:
branches:
- main
paths:
- .github/workflows/validate-devcontainer-feature.yml
- devcontainer/features/**
pull_request:
branches:
- main
paths:
- .github/workflows/validate-devcontainer-feature.yml
- devcontainer/features/**

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: "Validate devcontainer-feature.json files"
uses: devcontainers/action@v1.4.0
with:
validate-only: "true"
base-path-to-features: "./devcontainer/features"
1 change: 1 addition & 0 deletions devcontainer/features/ansible/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Feature to run an ansible playbook on container start
15 changes: 15 additions & 0 deletions devcontainer/features/ansible/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "Run an ansible playbook",
"id": "ansible",
"version": "1.0.0",
"description": "Runs an ansible playbook and installs pre-requests for plays/roles from the marinatedconcrete repo",
"options": {
"playbook": {
"type": "string",
"proposals": ["site.yml"],
"default": "site.yml",
"description": "Select a play to run on container start"
}
},
"installsAfter": ["ghcr.io/devcontainers/features/common-utils"]
}
25 changes: 25 additions & 0 deletions devcontainer/features/ansible/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh
set -e

if [ -f requirements.txt ]; then
# Install pip to install ansible & kubernetes modules
if ! command -v pip; then
sudo apt update
sudo apt install -y --no-install-recommends python3-pip
fi
pip install -r requirements.txt
fi

# Now that pip is setup, install Ansible Galaxy modules
if [ -f requirements.yml ]; then
ansible-galaxy install -r requirements.yml
fi

# sshpass for initial node provisioning
if ! command -v sshpass; then
sudo apt update
sudo apt install -y --no-install-recommends sshpass
fi

PLAYBOOK=${PLAYBOOK:-undefined}
ansible-playbook "$PLAYBOOK"