-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEVOPS-7868 1password get field and get kubeconfig actions
- Loading branch information
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: 'Get item field from 1Password' | ||
description: "Gets a field from specified 1Password vault/item" | ||
inputs: | ||
op-sa-token: | ||
required: true | ||
description: "1Password Service Account Token" | ||
op-vault: | ||
required: true | ||
description: "1Password Vault" | ||
op-item: | ||
required: true | ||
description: "1Password Item" | ||
op-field: | ||
required: true | ||
description: "1Password Item.Field" | ||
outputs: | ||
field: | ||
description: Value from 1Password Item.Field | ||
value: ${{ steps.get-item-field.outputs.field }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install 1Password CLI | ||
uses: 1password/install-cli-action@v1 | ||
|
||
- name: Get item field | ||
id: get-item-field | ||
shell: bash | ||
env: | ||
OP_SERVICE_ACCOUNT_TOKEN: ${{ inputs.op-sa-token }} | ||
run: echo "field=$(op item get ${{ inputs.op-item }} --vault=${{ inputs.op-vault }} --fields label=${{ inputs.op-field }})" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: 'Get Kubeconfig from 1Password' | ||
description: "Gets a kubeconfig from specified 1Password vault/item" | ||
inputs: | ||
op-sa-token: | ||
required: true | ||
description: "1Password Service Account Token" | ||
op-vault: | ||
required: true | ||
description: "1Password Vault" | ||
default: "Promil-preprod-gha-kubeconfigs" | ||
op-item: | ||
required: true | ||
description: "1Password Item" | ||
outputs: | ||
field: | ||
description: Value from 1Password Item.Field | ||
value: ${{ steps.decode-kubeconfig.outputs.kubeconfig }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Get Kubeconfig from 1Password | ||
id: get-kubeconfig | ||
uses: PiwikPRO/actions/1password/get-item-field@DEVOPS-7869 | ||
with: | ||
op-sa-token: ${{ inputs.op-sa-token }} | ||
op-vault: ${{ inputs.op-vault }} | ||
op-item: ${{ inputs.op-item }} | ||
op-field: kubeconfig | ||
|
||
- name: Decode kubeconfig | ||
id: decode-kubeconfig | ||
shell: bash | ||
run: echo "kubeconfig=$(echo '${{ steps.get-kubeconfig.outputs.field }}' | base64 --decode)" >> $GITHUB_OUTPUT |