Skip to content

Commit

Permalink
DEVOPS-7868 1password get field and get kubeconfig actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Decard6 committed Jun 7, 2024
1 parent b39fa50 commit 6a9d5f6
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
32 changes: 32 additions & 0 deletions 1password/get-item-field/action.yaml
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
34 changes: 34 additions & 0 deletions 1password/get-kubeconfig/action.yaml
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

0 comments on commit 6a9d5f6

Please sign in to comment.