Skip to content
Closed
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
335 changes: 193 additions & 142 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,34 @@ concurrency:
cancel-in-progress: true

jobs:
install_and_compile:
name: 'install_and_compile'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v2'

- uses: 'actions/setup-node@v2'
with:
node-version: '12.x'

- name: 'npm ci'
run: 'npm ci'

- name: 'npm build'
run: 'npm run build'

- name: 'verify compiled'
shell: 'bash'
run: |-
if [ -n "$(git status --porcelain)" ]; then
echo "TypeScript is not compiled!"
git diff
exit 1
fi


unit:
name: 'unit'
needs: install_and_compile
# install_and_compile:
# name: 'install_and_compile'
# runs-on: 'ubuntu-latest'
# steps:
# - uses: 'actions/checkout@v2'

# - uses: 'actions/setup-node@v2'
# with:
# node-version: '12.x'

# - name: 'npm ci'
# run: 'npm ci'

# - name: 'npm build'
# run: 'npm run build'

# - name: 'verify compiled'
# shell: 'bash'
# run: |-
# if [ -n "$(git status --porcelain)" ]; then
# echo "TypeScript is not compiled!"
# git diff
# exit 1
# fi


experiment1:
name: 'experiment1'
runs-on: 'ubuntu-latest'

steps:
Expand All @@ -51,27 +50,15 @@ jobs:
with:
node-version: '12.x'

- name: 'npm ci'
run: 'npm ci'

- name: 'npm lint'
run: 'npm run lint'

- name: 'npm test'
run: 'npm run test'

- id: 'auth-default'
name: 'auth-default'
uses: './'
with:
credentials_json: ''

credentials_json:
name: 'credentials_json'
needs: install_and_compile
runs-on: '${{ matrix.os }}'
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-latest'
- 'windows-latest'
- 'macos-latest'
experiment2:
name: 'experiment2'
runs-on: 'ubuntu-latest'

steps:
- uses: 'actions/checkout@v2'
Expand All @@ -83,60 +70,10 @@ jobs:
- id: 'auth-default'
name: 'auth-default'
uses: './'
with:
credentials_json: '${{ secrets.AUTH_SA_KEY_JSON }}'

- id: 'setup-gcloud'
name: 'setup-gcloud'
uses: 'google-github-actions/setup-gcloud@master'

- id: 'gcloud'
name: 'gcloud'
shell: 'bash'
run: |-
gcloud secrets versions access "latest" --secret "${{ secrets.OIDC_AUTH_TEST_SECRET_NAME }}"

- id: 'auth-access-token'
name: 'auth-access-token'
uses: './'
with:
credentials_json: '${{ secrets.AUTH_SA_KEY_B64 }}'
token_format: 'access_token'

- id: 'access-token'
name: 'access-token'
shell: 'bash'
run: |-
curl https://secretmanager.googleapis.com/v1/projects/${{ steps.auth-access-token.outputs.project_id }}/secrets/${{ secrets.OIDC_AUTH_TEST_SECRET_NAME }}/versions/latest:access \
--silent \
--show-error \
--fail \
--header "Authorization: Bearer ${{ steps.auth-access-token.outputs.access_token }}"

- id: 'auth-id-token'
name: 'auth-id-token'
uses: './'
with:
credentials_json: '${{ secrets.AUTH_SA_KEY_JSON }}'
token_format: 'id_token'
id_token_audience: 'https://secretmanager.googleapis.com/'
id_token_include_email: true


workload_identity_federation:
name: 'workload_identity_federation'
needs: install_and_compile
runs-on: '${{ matrix.os }}'
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-latest'
- 'windows-latest'
- 'macos-latest'

permissions:
id-token: 'write'
experiment3:
name: 'experiment3'
runs-on: 'ubuntu-latest'

steps:
- uses: 'actions/checkout@v2'
Expand All @@ -149,43 +86,157 @@ jobs:
name: 'auth-default'
uses: './'
with:
workload_identity_provider: '${{ secrets.WIF_PROVIDER_NAME }}'
service_account: '${{ secrets.OIDC_AUTH_SA_EMAIL }}'

- id: 'setup-gcloud'
name: 'setup-gcloud'
uses: 'google-github-actions/setup-gcloud@master'

- id: 'gcloud'
name: 'gcloud'
shell: 'bash'
run: |-
gcloud secrets versions access "latest" --secret "${{ secrets.OIDC_AUTH_TEST_SECRET_NAME }}"

- id: 'auth-access-token'
name: 'auth-access-token'
uses: './'
with:
workload_identity_provider: '${{ secrets.WIF_PROVIDER_NAME }}'
service_account: '${{ secrets.OIDC_AUTH_SA_EMAIL }}'
token_format: 'access_token'

- id: 'access-token'
name: 'access-token'
shell: 'bash'
run: |-
curl https://secretmanager.googleapis.com/v1/projects/${{ steps.auth-access-token.outputs.project_id }}/secrets/${{ secrets.OIDC_AUTH_TEST_SECRET_NAME }}/versions/latest:access \
--silent \
--show-error \
--fail \
--header "Authorization: Bearer ${{ steps.auth-access-token.outputs.access_token }}"

- id: 'auth-id-token'
name: 'auth-id-token'
uses: './'
with:
workload_identity_provider: '${{ secrets.WIF_PROVIDER_NAME }}'
service_account: '${{ secrets.OIDC_AUTH_SA_EMAIL }}'
token_format: 'id_token'
id_token_audience: 'https://secretmanager.googleapis.com/'
id_token_include_email: true
credentials_json: ${{secrets.NOT_A_REAL_SECRET}}



# unit:
# name: 'unit'
# needs: install_and_compile
# runs-on: 'ubuntu-latest'

# steps:
# - uses: 'actions/checkout@v2'

# - uses: 'actions/setup-node@v2'
# with:
# node-version: '12.x'

# - name: 'npm ci'
# run: 'npm ci'

# - name: 'npm lint'
# run: 'npm run lint'

# - name: 'npm test'
# run: 'npm run test'


# credentials_json:
# name: 'credentials_json'
# needs: install_and_compile
# runs-on: '${{ matrix.os }}'
# strategy:
# fail-fast: false
# matrix:
# os:
# - 'ubuntu-latest'
# - 'windows-latest'
# - 'macos-latest'

# steps:
# - uses: 'actions/checkout@v2'

# - uses: 'actions/setup-node@v2'
# with:
# node-version: '12.x'

# - id: 'auth-default'
# name: 'auth-default'
# uses: './'
# with:
# credentials_json: '${{ secrets.AUTH_SA_KEY_JSON }}'

# - id: 'setup-gcloud'
# name: 'setup-gcloud'
# uses: 'google-github-actions/setup-gcloud@master'

# - id: 'gcloud'
# name: 'gcloud'
# shell: 'bash'
# run: |-
# gcloud secrets versions access "latest" --secret "${{ secrets.OIDC_AUTH_TEST_SECRET_NAME }}"

# - id: 'auth-access-token'
# name: 'auth-access-token'
# uses: './'
# with:
# credentials_json: '${{ secrets.AUTH_SA_KEY_B64 }}'
# token_format: 'access_token'

# - id: 'access-token'
# name: 'access-token'
# shell: 'bash'
# run: |-
# curl https://secretmanager.googleapis.com/v1/projects/${{ steps.auth-access-token.outputs.project_id }}/secrets/${{ secrets.OIDC_AUTH_TEST_SECRET_NAME }}/versions/latest:access \
# --silent \
# --show-error \
# --fail \
# --header "Authorization: Bearer ${{ steps.auth-access-token.outputs.access_token }}"

# - id: 'auth-id-token'
# name: 'auth-id-token'
# uses: './'
# with:
# credentials_json: '${{ secrets.AUTH_SA_KEY_JSON }}'
# token_format: 'id_token'
# id_token_audience: 'https://secretmanager.googleapis.com/'
# id_token_include_email: true


# workload_identity_federation:
# name: 'workload_identity_federation'
# needs: install_and_compile
# runs-on: '${{ matrix.os }}'
# strategy:
# fail-fast: false
# matrix:
# os:
# - 'ubuntu-latest'
# - 'windows-latest'
# - 'macos-latest'

# permissions:
# id-token: 'write'

# steps:
# - uses: 'actions/checkout@v2'

# - uses: 'actions/setup-node@v2'
# with:
# node-version: '12.x'

# - id: 'auth-default'
# name: 'auth-default'
# uses: './'
# with:
# workload_identity_provider: '${{ secrets.WIF_PROVIDER_NAME }}'
# service_account: '${{ secrets.OIDC_AUTH_SA_EMAIL }}'

# - id: 'setup-gcloud'
# name: 'setup-gcloud'
# uses: 'google-github-actions/setup-gcloud@master'

# - id: 'gcloud'
# name: 'gcloud'
# shell: 'bash'
# run: |-
# gcloud secrets versions access "latest" --secret "${{ secrets.OIDC_AUTH_TEST_SECRET_NAME }}"

# - id: 'auth-access-token'
# name: 'auth-access-token'
# uses: './'
# with:
# workload_identity_provider: '${{ secrets.WIF_PROVIDER_NAME }}'
# service_account: '${{ secrets.OIDC_AUTH_SA_EMAIL }}'
# token_format: 'access_token'

# - id: 'access-token'
# name: 'access-token'
# shell: 'bash'
# run: |-
# curl https://secretmanager.googleapis.com/v1/projects/${{ steps.auth-access-token.outputs.project_id }}/secrets/${{ secrets.OIDC_AUTH_TEST_SECRET_NAME }}/versions/latest:access \
# --silent \
# --show-error \
# --fail \
# --header "Authorization: Bearer ${{ steps.auth-access-token.outputs.access_token }}"

# - id: 'auth-id-token'
# name: 'auth-id-token'
# uses: './'
# with:
# workload_identity_provider: '${{ secrets.WIF_PROVIDER_NAME }}'
# service_account: '${{ secrets.OIDC_AUTH_SA_EMAIL }}'
# token_format: 'id_token'
# id_token_audience: 'https://secretmanager.googleapis.com/'
# id_token_include_email: true
1 change: 1 addition & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ inputs:
The Google Cloud JSON service account key to use for authentication. This
is mutually exclusive with "workload_identity_provider".
required: false
default: ~
create_credentials_file:
description: |-
If true, the action will securely generate a credentials file which can be
Expand Down
Loading