Add appengine-deploy action and refactor setup-gcloud

initial

Add test app and tests

add license

Update ReadMe and runner

Fix lint errors

Missed fixes

Update tests to run integration on PR

rename pkg -> setupGloudSDK

Update ts congig

Remove project id requirement

Update gcloud set project id func

Add unit tests for pkg

Add set project to action

rebuild

Fix gcloud typo

lint pkg and update project id dependency

Update tmp JSON writer

Add cleanup to integration tests

Update get input validation

fix json string

Fix test order and version name

add project id to test

remove clean up step

Update project url

Add no promote flag

test stderr vs stdout

Update pkg build

refactor setup-gcloud

clean up

Fix tool command for isAuthenticated

debugging

test command

Fix isInstalled method

Clean up
This commit is contained in:
averikitsch 2020-03-10 17:22:21 -07:00
parent 2c7422e8e9
commit d153f05d28
42 changed files with 38575 additions and 6601 deletions

View file

@ -1,5 +1,5 @@
name: appengine-deploy Integration
on: [push]
on: [push, pull_request]
jobs:
gcloud:
name: with setup-gcloud
@ -8,44 +8,53 @@ jobs:
- uses: actions/checkout@v2
- uses: ./setup-gcloud
with:
service_account_email: ${{ secrets.GET_SECRETMANAGER_SECRETS_SA_EMAIL }}
service_account_key: ${{ secrets.GET_SECRETMANAGER_SECRETS_SA_KEY_B64 }}
export_default_credentials: true
service_account_key: ${{ secrets.APPENGINE_DEPLOY_SA_KEY_JSON }}
- id: deploy
name: Deploy to App Engine
uses: ./appengine-deploy
with:
# secrets: |-
# token:${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_REF }}
# password:${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_VERSION_REF }}
- name: get output
# run: echo '${{ steps.secrets.outputs.token }}${{ steps.secrets.outputs.password }}'
project_id: ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }}
deliverables: ./appengine-deploy/test/app.yaml
version: gcloud
- name: Test Output
run: curl '${{ steps.deploy.outputs.url }}'
b64_json:
needs: gcloud
name: with base64 json creds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: deploy
name: Deploy to App Engine
uses: ./appengine-deploy
with:
credentials: ${{ secrets.GET_SECRETMANAGER_SECRETS_SA_KEY_JSON }}
# secrets: |-
# token:${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_REF }}
# password:${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_VERSION_REF }}
- name: get output
# run: echo '${{ steps.secrets.outputs.token }}${{ steps.secrets.outputs.password }}'
credentials: ${{ secrets.APPENGINE_DEPLOY_SA_KEY_B64 }}
deliverables: ./appengine-deploy/test/app.yaml
version: b64-json
promote: false # Allows for deletion
- name: Test Output
run: curl '${{ steps.deploy.outputs.url }}'
- name: Clean Up
run: |
gcloud app versions delete b64-json --quiet
json:
needs: [gcloud, b64_json]
name: with json creds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: deploy
name: Deploy to App Engine
uses: ./appengine-deploy
with:
credentials: ${{ secrets.GET_SECRETMANAGER_SECRETS_SA_KEY_JSON }}
# secrets: |-
# token:${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_REF }}
# password:${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_VERSION_REF }}
- name: get output
# run: echo '${{ steps.secrets.outputs.token }}${{ steps.secrets.outputs.password }}'
credentials: ${{ secrets.APPENGINE_DEPLOY_SA_KEY_JSON }}
deliverables: ./appengine-deploy/test/app.yaml
version: json
promote: false # Allows for deletion
- name: Test Output
run: curl '${{ steps.deploy.outputs.url }}'
- name: Clean Up
run: |
gcloud app versions delete json --quiet

View file

@ -21,10 +21,3 @@ jobs:
- name: npm lint
run: npm run lint
working-directory: ./appengine-deploy
- name: npm test
run: npm run test
working-directory: ./appengine-deploy
env:
TEST_GET_SECRETMANAGER_SECRETS_CREDENTIALS: ${{ secrets.GET_SECRETMANAGER_SECRETS_SA_KEY_JSON }}
TEST_GET_SECRETMANAGER_SECRETS_SECRET_VERSION_REF: ${{ secrets.GET_SECRETMANAGER_SECRETS_SECRET_VERSION_REF }}

View file

@ -25,7 +25,6 @@ jobs:
uses: ./setup-gcloud/
with:
version: '286.0.0'
service_account_email: ${{ secrets.SETUP_GCLOUD_IT_EMAIL }}
service_account_key: ${{ secrets.SETUP_GCLOUD_IT_KEY }}
- name: Integration Tests
@ -46,7 +45,6 @@ jobs:
uses: ./setup-gcloud/
with:
version: 'latest'
service_account_email: ${{ secrets.SETUP_GCLOUD_IT_EMAIL }}
service_account_key: ${{ secrets.SETUP_GCLOUD_IT_KEY }}
- name: Integration Tests
@ -67,7 +65,6 @@ jobs:
uses: ./setup-gcloud/
with:
version: 'latest'
service_account_email: ${{ secrets.SETUP_GCLOUD_IT_EMAIL }}
service_account_key: ${{ secrets.SETUP_GCLOUD_IT_KEY }}
export_default_credentials: true

View file

@ -31,7 +31,3 @@ jobs:
- name: Lint
working-directory: ./setup-gcloud
run: npm run lint
- name: Unit tests
working-directory: ./setup-gcloud
run: npm test

28
.github/workflows/setupGcloudSDK.yml vendored Normal file
View file

@ -0,0 +1,28 @@
name: setupGcloudSDK Unit
on: [push, pull_request]
jobs:
run:
name: setupGcloudSDK
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- name: Set Node.js 10.x
uses: actions/setup-node@master
with:
node-version: 10.x
- name: npm install
working-directory: ./setupGcloudSDK
run: npm install
- name: Lint
working-directory: ./setupGcloudSDK
run: npm run lint
- name: Unit tests
working-directory: ./setupGcloudSDK
run: npm test