From d79378e9c8bf7c6f2a3458aa0221d3f34641197d Mon Sep 17 00:00:00 2001 From: dappnodedev Date: Fri, 14 Jun 2024 17:28:00 +0200 Subject: [PATCH] Add autoinstall validation file --- .github/workflows/validate_autoinstall.yml | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/validate_autoinstall.yml diff --git a/.github/workflows/validate_autoinstall.yml b/.github/workflows/validate_autoinstall.yml new file mode 100644 index 0000000..a10a116 --- /dev/null +++ b/.github/workflows/validate_autoinstall.yml @@ -0,0 +1,47 @@ +name: Validate Ubuntu autoinstall YAML Files + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install check-jsonschema yamllint + apt-get install -y yq + + - name: Lint attended autoinstall.yaml + run: yamllint iso/preseeds/ubuntu/autoinstall.yaml + + - name: Lint unattended autoinstall.yaml + run: yamllint iso/preseeds/ubuntu/autoinstall_unattended.yaml + + - name: Download JSON schema + run: curl -o schema.json https://raw.githubusercontent.com/canonical/subiquity/main/autoinstall-schema.json + + - name: Extract autoinstall properties from YAML files + run: | + yq eval '.autoinstall' iso/preseeds/ubuntu/autoinstall.yaml > attended.yaml + yq eval '.autoinstall' iso/preseeds/ubuntu/autoinstall_unattended.yaml > unattended.yaml + + - name: Validate attended autoinstall.yaml + run: | + check-jsonschema --schemafile schema.json attended.yaml + + - name: Validate unattended autoinstall.yaml + run: | + check-jsonschema --schemafile schema.json unattended.yaml