Fixing pipeline.
This commit is contained in:
@@ -5,6 +5,7 @@ on:
|
|||||||
- main
|
- main
|
||||||
paths:
|
paths:
|
||||||
- '**.yml'
|
- '**.yml'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-and-create-pr:
|
check-and-create-pr:
|
||||||
name: Check and Create PR
|
name: Check and Create PR
|
||||||
@@ -15,8 +16,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
- name: Cache tea CLI
|
- name: Cache tea CLI
|
||||||
id: cache-tea
|
uses: actions/cache@v3
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
with:
|
||||||
path: /opt/hostedtoolcache/tea/0.9.2/x64
|
path: /opt/hostedtoolcache/tea/0.9.2/x64
|
||||||
key: tea-${{ runner.os }}-0.9.2
|
key: tea-${{ runner.os }}-0.9.2
|
||||||
@@ -30,17 +30,17 @@ jobs:
|
|||||||
id: check-opened-pr-step
|
id: check-opened-pr-step
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
tea login add --name gitea-rinoa --url "${{ secrets.RINOA_GITEA_URL }}" --user gitea-sonarqube-bot --password "${{ secrets.BOT_GITEA_PASSWORD }}" --token ${{ secrets.BOT_GITEA_TOKEN }}
|
tea login add --name gitea-rinoa --url ${{ secrets.RINOA_GITEA_URL }} --user gitea-sonarqube-bot --password "${{ secrets.BOT_GITEA_PASSWORD }}" --token ${{ secrets.BOT_GITEA_TOKEN }}
|
||||||
|
tea login default gitea-rinoa
|
||||||
pr_exists=$(tea pr list --repo ${{ github.repository }} --state open --fields index,title,head | egrep ${{ github.ref_name }} | tail -1 | wc -l)
|
pr_exists=$(tea pr list --repo ${{ github.repository }} --state open --fields index,title,head | egrep ${{ github.ref_name }} | tail -1 | wc -l)
|
||||||
echo ${pr_exists}
|
echo ${pr_exists}
|
||||||
echo "exists=$pr_exists" >> $GITHUB_OUTPUT
|
echo "exists=$pr_exists" >> $GITHUB_OUTPUT
|
||||||
- name: Create PR
|
- name: Create PR
|
||||||
if: ${{ steps.check-opened-pr-step.outputs.exists == '0' }}
|
if: ${{ steps.check-opened-pr-step.outputs.exists == '0' }}
|
||||||
run: |
|
run: |
|
||||||
tea login default gitea-rinoa
|
pr_index_old=$(tea pr ls --repo ${{ github.repository }} --state all --fields index,title,head --output csv | head -2 | tail -1 | awk -F, '{print $1}' | sed -e 's|"||g')'
|
||||||
pr_index_old=$(tea pr ls --repo ${{ github.repository }} --state all --fields index,title,head --output csv | sed -e 's|"||g' | egrep '^[0-9]' | head -1 | awk -F"," '{print $1}')
|
|
||||||
pr_index_new=$(expr ${pr_index_old} + 1)
|
pr_index_new=$(expr ${pr_index_old} + 1)
|
||||||
tea pr c -r ${{ github.repository }} -t "Automated PR for ${{ github.ref_name }} - #${pr_index_new}" -d "Automatically created PR for branch: ${{ github.ref_name }}" -a ${{ github.actor }}
|
tea pr c -r ${{ github.repository }} -t "Automated PR for ${{ github.ref_name }} - ${pr_index_new}" -d "Automatically created PR for branch: ${{ github.ref_name }}" -a ${{ github.actor }}
|
||||||
docker-compose-ansible-lints:
|
docker-compose-ansible-lints:
|
||||||
name: Docker Compose & Ansible Lints
|
name: Docker Compose & Ansible Lints
|
||||||
needs: [check-and-create-pr]
|
needs: [check-and-create-pr]
|
||||||
@@ -52,46 +52,31 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Cache Ansible Galaxy Collections
|
- name: Cache Ansible Galaxy Collections
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ansible/collections
|
path: ansible/collections
|
||||||
key: ${{ runner.os }}-ansible-${{ hashFiles('./ansible/collections/requirements.yml') }}
|
key: ${{ runner.os }}-ansible-${{ hashFiles('./ansible/collections/requirements.yml') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-ansible-
|
${{ runner.os }}-ansible-
|
||||||
- name: Install Ansible
|
|
||||||
uses: alex-oleshkevich/setup-ansible@v1.0.1
|
|
||||||
with:
|
|
||||||
version: "11.0.0"
|
|
||||||
- name: Cache Vault install
|
|
||||||
id: cache-vault
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: /opt/hostedtoolcache/vault/1.18.0/x64
|
|
||||||
key: vault-${{ runner.os }}-1.18.0
|
|
||||||
- name: Install Vault
|
- name: Install Vault
|
||||||
if: steps.cache-vault.outputs.cache-hit != 'true'
|
uses: cpanato/vault-installer@main
|
||||||
uses: supplypike/setup-bin@v4
|
- name: Ansible Playbook Dry Run
|
||||||
|
uses: dawidd6/action-ansible-playbook@v2
|
||||||
with:
|
with:
|
||||||
uri: 'https://releases.hashicorp.com/vault/1.18.0/vault_1.18.0_linux_amd64.zip'
|
directory: ansible/
|
||||||
name: 'vault'
|
playbook: docker_config_deploy.yml
|
||||||
version: '1.18.0'
|
key: ${{secrets.RINOA_ANSIBLE_PRIVATE_KEY}}
|
||||||
- name: Install Galaxy Collections
|
options: |
|
||||||
if: steps.cache-ansible-galaxy-collections.outputs.cache-hit != 'true'
|
--inventory inventory/hosts.yml
|
||||||
run: |
|
--verbose
|
||||||
ansible-galaxy collection install -r ansible/collections/requirements.yml -p ansible/collections
|
--check
|
||||||
- name: Ansible Dry Run
|
requirements: ansible/collections/requirements.yml
|
||||||
id: docker-config-deploy
|
vault_password: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
|
||||||
run: |
|
|
||||||
cd ansible/
|
|
||||||
echo "${{ secrets.RINOA_ANSIBLE_KNOWN_HOSTS }}" > /root/.ssh/known_hosts
|
|
||||||
echo "${{ secrets.RINOA_ANSIBLE_PRIVATE_KEY }}" > private-ssh-key ; chmod 600 private-ssh-key
|
|
||||||
echo "${{ secrets.ANSIBLE_VAULT_PASSWORD }}" > vault_pass
|
|
||||||
ansible-playbook --check -i inventory/hosts.yml --vault-pass-file=vault_pass docker_config_deploy.yml
|
|
||||||
- name: Generate .env file for Docker Compose Dry Run
|
- name: Generate .env file for Docker Compose Dry Run
|
||||||
run: |
|
run: |
|
||||||
vault kv get -format=json rinoa-docker/env | jq -r '.data.data' | jq -r 'keys[] as $k | "\($k)='\''\(.[$k])'\''"' > .env
|
vault kv get -format=json rinoa-docker/env | jq -r '.data.data' | jq -r 'keys[] as $k | "\($k)='\''\(.[$k])'\''"' > .env
|
||||||
- name: Cache .env Files
|
- name: Cache .env Files
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: .env
|
path: .env
|
||||||
key: ${{ runner.os }}-env-${{ hashFiles('docker-compose.yml') }}
|
key: ${{ runner.os }}-env-${{ hashFiles('docker-compose.yml') }}
|
||||||
@@ -115,7 +100,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
- name: Cache flarectl CLI
|
- name: Cache flarectl CLI
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.flarectl
|
path: ~/.flarectl
|
||||||
key: flarectl-${{ runner.os }}-${{ hashFiles('workflow-config.yml') }}
|
key: flarectl-${{ runner.os }}-${{ hashFiles('workflow-config.yml') }}
|
||||||
@@ -126,7 +111,7 @@ jobs:
|
|||||||
name: 'flarectl'
|
name: 'flarectl'
|
||||||
version: '0.113.0'
|
version: '0.113.0'
|
||||||
- name: Cache Subdomain Files
|
- name: Cache Subdomain Files
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
compose_subdomains.txt
|
compose_subdomains.txt
|
||||||
@@ -226,8 +211,8 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
# - name: Install Vault
|
- name: Install Vault
|
||||||
# uses: cpanato/vault-installer@main
|
uses: cpanato/vault-installer@main
|
||||||
- name: Gotify Notification
|
- name: Gotify Notification
|
||||||
uses: eikendev/gotify-action@master
|
uses: eikendev/gotify-action@master
|
||||||
with:
|
with:
|
||||||
@@ -241,7 +226,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
galaxy_collections_path: ansible/collections
|
galaxy_collections_path: ansible/collections
|
||||||
galaxy_requirements_file: ansible/collections/requirements.yml
|
galaxy_requirements_file: ansible/collections/requirements.yml
|
||||||
inventory: ansible/inventory/hosts.yml
|
inventory: ansible/ansible-inventory
|
||||||
playbook: ansible/docker_config_deploy.yml
|
playbook: ansible/docker_config_deploy.yml
|
||||||
private_key: ${{ secrets.RINOA_ANSIBLE_PRIVATE_KEY }}
|
private_key: ${{ secrets.RINOA_ANSIBLE_PRIVATE_KEY }}
|
||||||
vault_password: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
|
vault_password: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
|
||||||
|
|||||||
Reference in New Issue
Block a user