Skip to content

Instantly share code, notes, and snippets.

@voodoodror
Last active February 3, 2021 14:13
Show Gist options
  • Select an option

  • Save voodoodror/cfe8c05e6f73ecea893581b1eb7a2a21 to your computer and use it in GitHub Desktop.

Select an option

Save voodoodror/cfe8c05e6f73ecea893581b1eb7a2a21 to your computer and use it in GitHub Desktop.

Revisions

  1. voodoodror revised this gist Feb 3, 2021. 1 changed file with 5 additions and 13 deletions.
    18 changes: 5 additions & 13 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,6 @@ on:
    pull_request:
    branches:
    - master
    # paths:
    # - "**.yaml"

    # Allows you to run this workflow manually from the Actions tab
    workflow_dispatch:
    @@ -21,11 +19,11 @@ jobs:

    container:
    image: python:3.9
    # env:
    # AWS_WEB_IDENTITY_TOKEN_FILE: /var/run/secrets/eks.amazonaws.com/serviceaccount/token
    # AWS_ROLE_ARN: arn:aws:iam::884661243007:role/X/test-use1-example-runner-deployment
    # volumes:
    # - /var/run/secrets/eks.amazonaws.com/serviceaccount/token:/var/run/secrets/eks.amazonaws.com/serviceaccount/token
    env:
    AWS_WEB_IDENTITY_TOKEN_FILE: /var/run/secrets/eks.amazonaws.com/serviceaccount/token
    AWS_ROLE_ARN: arn:aws:iam::884661243007:role/X/test-use1-example-runner-deployment
    volumes:
    - /var/run/secrets/eks.amazonaws.com/serviceaccount/token:/var/run/secrets/eks.amazonaws.com/serviceaccount/token

    steps:
    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    @@ -80,9 +78,3 @@ jobs:
    - name: Execute Python script
    run: |
    python .github/cicd.py

    # terraform init
    # terraform plan
    # TF_PLUGIN_CACHE_DIR=\$HOME/.terraform.d/plugin-cache timeout 30m terragrunt plan-all --terragrunt-parallelism 1 --terragrunt-non-interactive --terragrunt-strict-include --terragrunt-include-dir dyaws/us-east-1/test/kube-system/k8s/aws-node


  2. voodoodror created this gist Feb 3, 2021.
    88 changes: 88 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,88 @@
    name: CI

    on:
    pull_request:
    branches:
    - master
    # paths:
    # - "**.yaml"

    # Allows you to run this workflow manually from the Actions tab
    workflow_dispatch:

    jobs:
    build:
    runs-on: self-hosted

    env:
    REQUIRED_STATUS_CHECK: "true"
    GITHUB_SHA_COMMIT: ${{ github.event.pull_request.head.sha }}
    GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"

    container:
    image: python:3.9
    # env:
    # AWS_WEB_IDENTITY_TOKEN_FILE: /var/run/secrets/eks.amazonaws.com/serviceaccount/token
    # AWS_ROLE_ARN: arn:aws:iam::884661243007:role/X/test-use1-example-runner-deployment
    # volumes:
    # - /var/run/secrets/eks.amazonaws.com/serviceaccount/token:/var/run/secrets/eks.amazonaws.com/serviceaccount/token

    steps:
    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    - uses: actions/checkout@v2
    with:
    ref: ${{ github.event.pull_request.head.sha }}

    - name: Checkout master
    uses: actions/checkout@v2
    with:
    ref: 'master'
    clean: false

    - uses: webfactory/ssh-agent@v0.4.1
    with:
    ssh-private-key: ${{ secrets.INFRA_MODULES_DEPLOY_KEY }}

    - name: aws cli
    run: |
    curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
    unzip awscliv2.zip && echo 'zip extraction completed'
    chmod +x ./aws/install
    ./aws/install

    - run: aws sts get-caller-identity

    - run: git config user.name "GitHub Actions"
    - run: git config user.email "actions@users.noreply.github.com"

    - name: Add local bin path
    run: |
    echo $GITHUB_WORKSPACE >> $GITHUB_PATH

    - name: Download Terragrunt
    run: |
    terragrunt_version=v0.23.33
    wget -O terragrunt https://github.com/gruntwork-io/terragrunt/releases/download/${terragrunt_version}/terragrunt_linux_amd64
    chmod +x terragrunt

    # Terraform must be >=0.13
    - name: Download Terraform
    run: |
    terraform_version=0.12.26
    wget -O terraform.zip https://releases.hashicorp.com/terraform/${terraform_version}/terraform_${terraform_version}_linux_amd64.zip && unzip terraform.zip
    chmod +x terraform

    - name: Get Versions
    run: |
    terragrunt --version
    terraform --version

    - name: Execute Python script
    run: |
    python .github/cicd.py

    # terraform init
    # terraform plan
    # TF_PLUGIN_CACHE_DIR=\$HOME/.terraform.d/plugin-cache timeout 30m terragrunt plan-all --terragrunt-parallelism 1 --terragrunt-non-interactive --terragrunt-strict-include --terragrunt-include-dir dyaws/us-east-1/test/kube-system/k8s/aws-node