python3-kubernetes #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | ||
name: deploy dev | ||
on: | ||
workflow_call: | ||
inputs: | ||
host_name: | ||
required: true | ||
type: string | ||
tenant: | ||
required: true | ||
type: string | ||
secrets: | ||
ONEPASSWORD_VAULT: | ||
required: true | ||
KUBECONFIG: | ||
required: true | ||
permissions: | ||
contents: read | ||
jobs: | ||
create-artifact: | ||
runs-on: ubuntu-latest | ||
name: Ansible artifact ${{ inputs.tenant }} | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
- run: ls -R | ||
- run: mv */*.tar ./ | ||
- run: find -name "*.tar" -exec tar -xf {} \; | ||
- run: tar -cf ${{ inputs.tenant }}-ansible.tar ansible | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: debug-${{ inputs.tenant }}-ansible | ||
path: ${{github.workspace }}/${{ inputs.tenant }}-ansible.tar | ||
overwrite: true | ||
deploy-matrix: | ||
runs-on: ubuntu-latest | ||
name: deploy ${{ inputs.tenant }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
action: | ||
- tags: configmap | ||
op: tags | ||
- tags: service | ||
op: tags | ||
- tags: 1password | ||
op: tags | ||
- tags: deployment | ||
op: tags | ||
- tags: ingress | ||
op: tags | ||
- tags: "ingress,configmap,service,1password,deployment" | ||
op: skip-tags | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
- run: ls -R | ||
- run: mv */*.tar ./ | ||
- run: find -name "*.tar" -exec tar -xf {} \; | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
- name: Install python3-kubernetes | ||
run: apt-get install -y python3-kubernetes | ||
- name: 1Password | ||
working-directory: ${{github.workspace }}/ansible/group_vars | ||
run: | | ||
echo "VAULT: ${{ secrets.ONEPASSWORD_VAULT }}" >> develop/dof_deploy.yml | ||
echo "ONEPASSWORD_OPERATOR_VAULT: ${{ secrets.ONEPASSWORD_VAULT }}" >> develop/dof_deploy.yml | ||
echo "TLS_ENABLED: \"true\"" >> develop/dof_deploy.yml | ||
- run: ansible-galaxy install -r ansible/collections/requirements.yml | ||
- working-directory: ${{github.workspace }}/ansible/roles/sys | ||
run: | | ||
mkdir files | ||
echo "${{ secrets.KUBECONFIG }}" > files/config | ||
- name: Set proxy environment variable if included in the kubeconfig | ||
working-directory: ${{github.workspace }}/ansible/roles/sys/files | ||
run: | | ||
yq ".clusters[0].cluster.proxy-url" config | sed -nr 's+(.*//).*@(.*)+K8S_AUTH_PROXY=\1\2+p' >> $GITHUB_ENV | ||
yq ".clusters[0].cluster.proxy-url" config | sed -nr 's+.*//(.*)@.*+K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH=\1+p' >> $GITHUB_ENV | ||
- run: ansible-playbook ./playbook.yml --inventory-file hosts --limit "${{ inputs.host_name }}" -e 'ansible_python_interpreter=/usr/bin/python3' --${{ matrix.action.op }} ${{ matrix.action.tags }} | ||
working-directory: ${{github.workspace }}/ansible | ||
- working-directory: ${{github.workspace }}/ansible/roles/sys/files | ||
run: | | ||
rm -rf /config |