Skip to content

Commit

Permalink
DEVOPS-7881 add mask
Browse files Browse the repository at this point in the history
  • Loading branch information
Decard6 committed Jun 25, 2024
1 parent f147575 commit 7958480
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 72 deletions.
32 changes: 0 additions & 32 deletions 1password/get-item-field/action.yaml

This file was deleted.

18 changes: 11 additions & 7 deletions 1password/get-kubeconfig/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,20 @@ outputs:
runs:
using: "composite"
steps:
- name: Install 1Password CLI
uses: 1password/install-cli-action@v1

- name: Get Kubeconfig from 1Password
id: get-kubeconfig
uses: PiwikPRO/actions/1password/get-item-field@master
with:
op-sa-token: ${{ inputs.op-sa-token }}
op-vault: ${{ inputs.op-vault }}
op-item: ${{ inputs.op-item }}
op-field: kubeconfig
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ inputs.op-sa-token }}
shell: bash
run: |
encoded=$(op item get ${{ inputs.op-item }} --vault=${{ inputs.op-vault }} --fields label=kubeconfig| tr -d "\n" )
echo "::add-mask::$encoded"
echo "encoded<<EOF"$'\n'"$encoded"$'\n'EOF >> "$GITHUB_OUTPUT"
- name: Decode kubeconfig
id: decode-kubeconfig
shell: bash
run: echo "kubeconfig<<EOF"$'\n'"$(echo '${{ steps.get-kubeconfig.outputs.field }}' | tr -d "\"" | base64 --decode)"$'\n'EOF >> "$GITHUB_OUTPUT"
run: echo "kubeconfig<<EOF"$'\n'"$(echo '${{ steps.get-kubeconfig.outputs.encoded }}' | tr -d "\"" | base64 --decode)"$'\n'EOF >> "$GITHUB_OUTPUT"
33 changes: 0 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
- [Benchmarking](#benchmarking)
- [Platform outdated dependencies notifier](#platform-outdated-dependencies-notifier)
- [1Password](#1Password)
- [Get item field](#get-item-field)
- [Get kubeconfig](#get-kubeconfig)
<!--toc:end-->

Expand Down Expand Up @@ -646,38 +645,6 @@ jobs:
```

### 1Password
#### Get item field
`1password/get-item-field` action is a Github Action that fetches specified field from 1Password item.

Example usage:
```yaml
on:
pull_request:
push:
branches: ["master"]
name: Test actions
jobs:
test-get-field:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Get field
id: get-field
uses: PiwikPRO/actions/1password/get-item-field@master
with:
op-sa-token: <token-from-secrets>
op-vault: foo
op-item: bar
op-field: xyz
- name: Echo get-field
shell: bash
run: echo ${{ steps.get-field.outputs.field }}
```

#### Get kubeconfig
`1password/get-kubeconfig` action is a Github Action that fetches `kubeconfig` field from 1Password item and base64 decodes it.

Expand Down

0 comments on commit 7958480

Please sign in to comment.