Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEVOPS-7881 add mask #107

Merged
merged 1 commit into from
Jun 27, 2024
Merged
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
32 changes: 0 additions & 32 deletions 1password/get-item-field/action.yaml
Decard6 marked this conversation as resolved.
Show resolved Hide resolved

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
Loading