Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ name: "Pipeline"

on:
pull_request:
branches: [ "main" ]
branches:
- main
- aws/ec2
push:
branches: [ "main" ]
branches:
- main

jobs:
test:
Expand Down Expand Up @@ -37,7 +40,7 @@ jobs:
if: ${{ github.event_name == 'pull_request' }}
needs:
- test
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-18.04"
steps:
- uses: actions/checkout@v2

Expand All @@ -51,6 +54,14 @@ jobs:
source scripts/pipeline_utils.sh
init_terraform github heroku aws

- name: "Adds directory for infra data"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
source scripts/pipeline_utils.sh
setup_data

- name: "Generate terraform plan"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -87,7 +98,7 @@ jobs:

deploy:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-18.04"
steps:
- uses: actions/checkout@v2

Expand All @@ -101,6 +112,14 @@ jobs:
source scripts/pipeline_utils.sh
init_terraform github heroku aws

- name: "Adds directory for infra data"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
source scripts/pipeline_utils.sh
setup_data

- name: "Apply terraform plan"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.terraform/
.vscode/
data/

.env
9 changes: 9 additions & 0 deletions scripts/pipeline_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,12 @@ apply_terraform() {
terraform -chdir="src/$i" apply -auto-approve -input=false
done
}

setup_data() {
echo "Created data directory"
mkdir -p src/aws/data
cd src/aws/data

echo "Copying test data to test data directory"
aws s3 cp s3://gambley-infra-data/public_keys/id_gambley.pub .
}