-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathn1c_config_update_gitops_example.yaml
More file actions
49 lines (38 loc) · 1.81 KB
/
n1c_config_update_gitops_example.yaml
File metadata and controls
49 lines (38 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: NGINX One Console Workflow Example
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Triggers the workflow on push request events but only for the "main" branch
on:
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
#workflow_dispatch:
jobs:
run-n1c-python-example-script:
runs-on: ubuntu-latest
concurrency:
group: staging_environment
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- name: Checkout and set misc environment variables
run: |
echo "MY_COMMIT_HASH=$(git show --pretty=format:"%H %s" -s HEAD)" >> $GITHUB_ENV
echo "MY_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
- name: Set environment variables for base64 encoded config files
run: |
echo "NGINX_CONFIG_FILE=`echo \# Modified by https://github.com/bwolmarans/GitOps-NGINX-One $(date) branch: ${{ env.MY_BRANCH }} commit hash: ${{ env.MY_COMMIT_HASH }} | cat - app-nyc-02/etc/nginx/nginx.conf | base64 -w 0`" >> $GITHUB_ENV
echo "MIME_TYPES_CONFIG_FILE=`cat app-nyc-02/etc/nginx/mime.types | base64 -w 0`" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install PIP requirements
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run the n1c Python script
run: |
python nginx_one_console_api_python_example.py --n1c_tenant_fqdn=${{ vars.N1C_TENANT_FQDN }} --n1c_namespace=${{ vars.N1C_NAMESPACE}} --nginx_instance_hostname=${{ vars.NGINX_INSTANCE_HOSTNAME}} --nginx_instance_id=${{ vars.NGINX_INSTANCE_ID }} --xc_api_token=${{ secrets.XC_API_TOKEN }} --nginx_config_file=${{ env.NGINX_CONFIG_FILE }}