removed unwanted code #60
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: "F5 XC Bot Defense on GCP Deploy" | |
on: | |
push: | |
branches: | |
- deploy-bot-defense-gcp | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
# terraform_infra: | |
# name: "Deploy GCP Infra" | |
# runs-on: ubuntu-latest | |
# defaults: | |
# run: | |
# working-directory: ./gcp/infra | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v4 | |
# | |
# - name: Setup Terraform | |
# uses: hashicorp/setup-terraform@v3 | |
# with: | |
# cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
# | |
# - name: Setup Terraform Backend | |
# id: backend | |
# run: | | |
# cat > backend.tf << EOF | |
# terraform { | |
# cloud { | |
# organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}" | |
# workspaces { | |
# name = "${{ secrets.TF_CLOUD_WORKSPACE_GCP_INFRA }}" | |
# } | |
# } | |
# } | |
# EOF | |
# | |
# - name: Terraform Init | |
# id: init | |
# run: terraform init | |
# | |
# - name: Terraform Validate | |
# id: validate | |
# run: terraform validate -no-color | |
# | |
# - name: Terraform Plan | |
# id: plan | |
# if: github.event_name == 'pull_request' | |
# run: terraform plan -no-color -input=false | |
# continue-on-error: true | |
# | |
# - uses: actions/github-script@v6 | |
# if: github.event_name == 'pull_request' | |
# env: | |
# PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" | |
# with: | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# script: | | |
# const output = `#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` | |
# #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` | |
# #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` | |
# <details><summary>Show Plan</summary> | |
# \`\`\`\n | |
# ${process.env.PLAN} | |
# \`\`\` | |
# </details> | |
# *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | |
# github.rest.issues.createComment({ | |
# issue_number: context.issue.number, | |
# owner: context.repo.owner, | |
# repo: context.repo.repo, | |
# body: output | |
# }) | |
# - name: Terraform Plan Status | |
# if: steps.plan.outcome == 'failure' | |
# run: exit 1 | |
# | |
# - name: Terraform Apply | |
# if: github.ref == 'refs/heads/deploy-bot-defense-gcp' && github.event_name == 'push' | |
# run: terraform apply -auto-approve -input=false | |
# | |
# terraform_gke: | |
# name: "Deploy GCP GKE" | |
# runs-on: ubuntu-latest | |
# needs: terraform_infra | |
# defaults: | |
# run: | |
# working-directory: ./gcp/gke-cluster | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# | |
# - name: Setup Terraform | |
# uses: hashicorp/setup-terraform@v2 | |
# with: | |
# cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
# | |
# - name: Setup Terraform Backend | |
# id: backend | |
# run: | | |
# cat > backend.tf << EOF | |
# terraform { | |
# cloud { | |
# organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}" | |
# workspaces { | |
# name = "${{ secrets.TF_CLOUD_WORKSPACE_GKE }}" | |
# } | |
# } | |
# } | |
# EOF | |
# - name: Terraform Init | |
# id: init | |
# run: terraform init | |
# | |
# - name: Terraform Validate | |
# id: validate | |
# run: terraform validate -no-color | |
# | |
# - name: Terraform Plan | |
# id: plan | |
# if: github.event_name == 'pull_request' | |
# run: terraform plan -no-color -input=false | |
# continue-on-error: true | |
# | |
# - uses: actions/github-script@v6 | |
# if: github.event_name == 'pull_request' | |
# env: | |
# PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" | |
# with: | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# script: | | |
# const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` | |
# #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` | |
# #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` | |
# #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` | |
# <details><summary>Show Plan</summary> | |
# \`\`\`\n | |
# ${process.env.PLAN} | |
# \`\`\` | |
# </details> | |
# *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | |
# github.rest.issues.createComment({ | |
# issue_number: context.issue.number, | |
# owner: context.repo.owner, | |
# repo: context.repo.repo, | |
# body: output | |
# }) | |
# - name: Terraform Plan Status | |
# if: steps.plan.outcome == 'failure' | |
# run: exit 1 | |
# | |
# - name: Terraform Apply | |
# if: github.ref == 'refs/heads/deploy-bot-defense-gcp' && github.event_name == 'push' | |
# run: terraform apply -auto-approve -input=false | |
# | |
# terraform_app: | |
# name: "Deploy Demo App" | |
# runs-on: ubuntu-latest | |
# needs: terraform_gke | |
# defaults: | |
# run: | |
# working-directory: ./workflow-guides/bot/deploy-botdefense-in-gcp-with-f5xc-bigip-connector/airline-app/ | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v4 | |
# | |
# - name: Setup Terraform | |
# uses: hashicorp/setup-terraform@v3 | |
# with: | |
# cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
# | |
# - name: Setup Terraform Backend | |
# id: backend | |
# run: | | |
# cat > backend.tf << EOF | |
# terraform { | |
# cloud { | |
# organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}" | |
# workspaces { | |
# name = "${{ secrets.TF_CLOUD_WORKSPACE_APP }}" | |
# } | |
# } | |
# } | |
# EOF | |
# - name: Terraform Init | |
# id: init | |
# run: terraform init | |
# | |
# - name: Terraform Validate | |
# id: validate | |
# run: terraform validate -no-color | |
# | |
# - name: Terraform Plan | |
# id: plan | |
# if: github.event_name == 'pull_request' | |
# run: terraform plan -no-color -input=false | |
# continue-on-error: true | |
# | |
# - uses: actions/github-script@v6 | |
# if: github.event_name == 'pull_request' | |
# env: | |
# PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" | |
# with: | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# script: | | |
# const output = `#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` | |
# #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` | |
# #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` | |
# <details><summary>Show Plan</summary> | |
# \`\`\`\n | |
# ${process.env.PLAN} | |
# \`\`\` | |
# </details> | |
# *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | |
# github.rest.issues.createComment({ | |
# issue_number: context.issue.number, | |
# owner: context.repo.owner, | |
# repo: context.repo.repo, | |
# body: output | |
# }) | |
# - name: Terraform Plan Status | |
# if: steps.plan.outcome == 'failure' | |
# run: exit 1 | |
# | |
# - name: Terraform Apply | |
# if: github.ref == 'refs/heads/deploy-bot-defense-gcp' && github.event_name == 'push' | |
# run: terraform apply -auto-approve -input=false | |
# | |
# terraform_bigip: | |
# name: "Deploy BIGIP" | |
# runs-on: ubuntu-latest | |
# needs: [terraform_infra, terraform_app] | |
# defaults: | |
# run: | |
# working-directory: ./gcp/bigip | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# | |
# - name: Setup Terraform | |
# uses: hashicorp/setup-terraform@v2 | |
# with: | |
# cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
# | |
# - name: Setup Terraform Backend | |
# id: backend | |
# run: | | |
# cat > backend.tf << EOF | |
# terraform { | |
# cloud { | |
# organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}" | |
# workspaces { | |
# name = "${{ secrets.TF_CLOUD_WORKSPACE_BIGIP }}" | |
# } | |
# } | |
# } | |
# EOF | |
# - name: Terraform Init | |
# id: init | |
# run: terraform init | |
# | |
# - name: Terraform Validate | |
# id: validate | |
# run: terraform validate -no-color | |
# | |
# - name: Terraform Plan | |
# id: plan | |
# if: github.event_name == 'pull_request' | |
# run: terraform plan -no-color -input=false | |
# continue-on-error: true | |
# | |
# - uses: actions/github-script@v6 | |
# if: github.event_name == 'pull_request' | |
# env: | |
# PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" | |
# with: | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# script: | | |
# const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` | |
# #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` | |
# #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` | |
# #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` | |
# <details><summary>Show Plan</summary> | |
# \`\`\`\n | |
# ${process.env.PLAN} | |
# \`\`\` | |
# </details> | |
# *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | |
# github.rest.issues.createComment({ | |
# issue_number: context.issue.number, | |
# owner: context.repo.owner, | |
# repo: context.repo.repo, | |
# body: output | |
# }) | |
# - name: Terraform Plan Status | |
# if: steps.plan.outcome == 'failure' | |
# run: exit 1 | |
# | |
# - name: Terraform Apply | |
# if: github.ref == 'refs/heads/deploy-bot-defense-gcp' && github.event_name == 'push' | |
# run: terraform apply -auto-approve -input=false | |
terraform_bot: | |
name: "Configure Bot Defense on BIGIP" | |
runs-on: ubuntu-latest | |
#needs: [terraform_bigip] | |
defaults: | |
run: | |
working-directory: ./gcp/bigip/bot-defense | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v2 | |
with: | |
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
- name: Setup Terraform Backend | |
id: backend | |
run: | | |
cat > backend.tf << EOF | |
terraform { | |
cloud { | |
organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}" | |
workspaces { | |
name = "${{ secrets.TF_CLOUD_WORKSPACE_BOTDEFENSE }}" | |
} | |
} | |
} | |
EOF | |
- name: Terraform Init | |
id: init | |
run: terraform init | |
- name: Terraform Validate | |
id: validate | |
run: terraform validate -no-color | |
- name: Terraform Plan | |
id: plan | |
if: github.event_name == 'pull_request' | |
run: terraform plan -no-color -input=false | |
continue-on-error: true | |
- uses: actions/github-script@v6 | |
if: github.event_name == 'pull_request' | |
env: | |
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` | |
#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` | |
#### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` | |
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\` | |
<details><summary>Show Plan</summary> | |
\`\`\`\n | |
${process.env.PLAN} | |
\`\`\` | |
</details> | |
*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: output | |
}) | |
- name: Terraform Plan Status | |
if: steps.plan.outcome == 'failure' | |
run: exit 1 | |
- name: Terraform Apply | |
if: github.ref == 'refs/heads/deploy-bot-defense-gcp' && github.event_name == 'push' | |
run: terraform apply -auto-approve -input=false | |
# - name: Install Ansible | |
# shell: bash | |
# run: | | |
# sudo apt update | |
# sudo apt install -y ansible | |
# - name: Run Ansible | |
# if: github.ref == 'refs/heads/deploy-bot-defense-gcp' && github.event_name == 'push' | |
# run: | | |
# - big_ips = $(terraform output bigip_private_addresses) | |
# - big_ip = $(echo "big_ips" | jq -r '.[0]') | |
# - echo $big_ip | |
# - app_ip = $(terraform output app_ip) | |
# - echo $app_ip | |
# - cd bot-defense | |
# - python update_vip_as3.py $big_ip $app_ip 80 | |
# - bot-defense-playbook -i inventory/hosts playbook.yaml | |
# | |
# | |
# validate_bot_defense: | |
# name: "Test Bot Defense" | |
# runs-on: ubuntu-latest | |
# needs: t_bigip | |
# defaults: | |
# run: | |
# working-directory: ./gcp/bigip | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# | |
# - name: Run Traffic | |
# run: | | |
# cp ../tools/run-curl-traffic.sh . | |
# export cname=$(terraform output -raw lb_cname) | |
# echo $cname | |
# sleep 30 | |
# sh run-curl-traffic.sh "$cname/user/signin" |