Skip to content

Commit

Permalink
add json validation
Browse files Browse the repository at this point in the history
  • Loading branch information
id committed Jul 30, 2023
1 parent eb18082 commit ffebb31
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM alpine:latest
RUN apk add --no-cache ansible
RUN apk add --no-cache ansible jq
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ jobs:
- run: echo "${{ secrets.ANSIBLE_VAULT_PASSWORD }}" > .vault_pass.txt
- name: Test server.yml
run: |
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i candy --tags config --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/server.yml
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i freefeed --tags config --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/server.yml
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i candy --tags config,validate-json --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/server.yml
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i freefeed --tags config,validate-json --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/server.yml
- name: Test react-client.yml
run: |
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i candy --tags config --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/react-client.yml
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i beta --tags config --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/react-client.yml
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i freefeed --tags config --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/react-client.yml
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i candy --tags config,validate-json --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/react-client.yml
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i beta --tags config,validate-json --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/react-client.yml
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i freefeed --tags config,validate-json --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/react-client.yml
- name: Test nginx.yml
run: |
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i candy --tags config --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/nginx.yml
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i beta --tags config --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/nginx.yml
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i freefeed --tags config --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/nginx.yml
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i candy --tags config,validate-json --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/nginx.yml
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i beta --tags config,validate-json --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/nginx.yml
docker run --rm -v $PWD:/w -w /w --add-host freefeed.net:127.0.0.1 freefeed-ansible ansible-playbook --connection local -i freefeed --tags config,validate-json --skip-tags handlers --vault-password-file .vault_pass.txt playbooks/nginx.yml
- run: rm -f .vault_pass.txt
if: always()
Expand Down
5 changes: 5 additions & 0 deletions roles/react_client/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
tags:
- config

- name: Validate /etc/freefeed/{{ freefeed_site }}/config.json
ansible.builtin.command: jq type "/etc/freefeed/{{ freefeed_site }}/config.json"
tags:
- validate-json

- set_fact:
server_containers: []
tags:
Expand Down
5 changes: 5 additions & 0 deletions roles/server/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
- local-json
- config

- name: Validate local-{{ freefeed_env }}.json
ansible.builtin.command: jq type "{{ freefeed_config_dir }}/local-{{ freefeed_env }}.json"
tags:
- validate-json

- name: Start redis container
become: yes
docker_container:
Expand Down

0 comments on commit ffebb31

Please sign in to comment.