Skip to content

Staging

Staging #1635

Workflow file for this run

name: Staging
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
Tag:
required: true
type: choice
options:
- akto_staging1
- akto_staging2
- akto_staging3
default: akto_staging1
Environment:
required: true
type: choice
options:
- prod
- staging
default: staging
Deploy:
description: 'Deploy to flash staging'
required: false
type: boolean
default: false
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '8'
architecture: x64
deploy:
needs: build
runs-on: ubuntu-latest
environment: Dev
permissions:
id-token: write
contents: read
steps:
- name: Fetch kube yaml
run: |
wget https://raw.githubusercontent.com/akto-api-security/infra/feature/ephemeral_env/single.yml
export SETUP_SUFFIX=test
envsubst < single.yml > single_complete.yml
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_AKI_DEV_CLUSTER_02 }}
aws-secret-access-key: ${{ secrets.AWS_SAK_DEV_CLUSTER_02 }}
aws-region: ap-south-1
- name: deploy to cluster
uses: kodermax/kubectl-aws-eks@main
env:
KUBE_CONFIG_DATA: ${{ secrets.DEV_CLUSTER_02_KUBE_CONFIG }}
IMAGE_TAG: ${{ github.sha }}
with:
args: apply -f single_complete.yml
test:
if: ${{ github.event.inputs.Environment == 'prod' && github.event.inputs.Deploy == 'true' }}
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run testsigma end to end tests
env:
TESTSIGMA_API_KEY: ${{ secrets.TESTSIGMA_API_KEY }}
TESTSIGMA_TEST_PLAN_ID: 789
TS_DASHBOARD_URL: ${{vars.TS_DASHBOARD_URL}}
run: bash ./.github/scripts/akto-testsigma.sh
delete:
needs: test
runs-on: ubuntu-latest
environment: Dev
permissions:
id-token: write
contents: read
steps:
- name: Fetch kube yaml
run: |
wget https://raw.githubusercontent.com/akto-api-security/infra/feature/ephemeral_env/single.yml
export SETUP_SUFFIX=test
envsubst < single.yml > single_complete.yml
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_AKI_DEV_CLUSTER_02 }}
aws-secret-access-key: ${{ secrets.AWS_SAK_DEV_CLUSTER_02 }}
aws-region: ap-south-1
- name: deploy to cluster
uses: kodermax/kubectl-aws-eks@main
env:
KUBE_CONFIG_DATA: ${{ secrets.DEV_CLUSTER_02_KUBE_CONFIG }}
IMAGE_TAG: ${{ github.sha }}
with:
args: delete -f single_complete.yml