Skip to content

Commit

Permalink
Add custom ssh key setup to fix actions (#1097)
Browse files Browse the repository at this point in the history
* Add custom ssh key setup to fix actions

* add ssh key to test.yml

* Update .github/actions/setup-ssh/action.yml

Co-authored-by: Simon <footless@gmail.com>

* formatting?

Co-authored-by: Justin Thompson <justin@weave.works>
Co-authored-by: Simon <footless@gmail.com>
  • Loading branch information
3 people committed Nov 18, 2021
1 parent 2f4c835 commit 0ae045d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/actions/run-acceptance-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ runs:
shell: bash
run: |
make dependencies
- name: Set up ssh agent
uses: webfactory/ssh-agent@v0.5.3
- name: Set up ssh
uses: ./.github/actions/setup-ssh
with:
ssh-private-key: ${{ inputs.github-key }}
- name: Configure git settings
Expand Down
27 changes: 27 additions & 0 deletions .github/actions/setup-ssh/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Setup SSH'
description: 'Setup SSH keys and known hosts'
inputs:
ssh-private-key:
description: 'ssh keys to load'
required: true
runs:
using: "composite"
steps:
- name: Set up ssh agent
uses: webfactory/ssh-agent@v0.5.2
with:
ssh-private-key: ${{ inputs.ssh-private-key }}
- name: Add known_hosts
shell: bash
run: |
mkdir -p ~/.ssh
touch ~/.ssh/known_hosts
ssh-keygen -R github.com
cat > ~/.ssh/known_hosts <<- EOM
# github.com:22 SSH-2.0-babeld-a73e1397
github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
# github.com:22 SSH-2.0-babeld-a73e1397
github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
# github.com:22 SSH-2.0-babeld-a73e1397
github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
EOM
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ jobs:
- name: Download dependecies
run: |
make dependencies
- name: Set up ssh agent
uses: webfactory/ssh-agent@v0.5.3
- name: Set up ssh
uses: ./.github/actions/setup-ssh
with:
ssh-private-key: |
${{ secrets.WEAVE_GITOPS_TEST_WEAVEWORKS_WEAVE_GITOPS_BOT_SSH_KEY }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ jobs:
run: |
chmod +x bin/gitops-${{matrix.os}}-nightly
ls -la bin
- name: Set up ssh agent
uses: webfactory/ssh-agent@v0.5.3
- name: Set up ssh
uses: ./.github/actions/setup-ssh
with:
ssh-private-key: |
${{ secrets.WEAVE_GITOPS_TEST_WEAVEWORKS_WEAVE_GITOPS_BOT_SSH_KEY }}
Expand Down Expand Up @@ -214,8 +214,8 @@ jobs:
run: |
chmod +x bin/gitops-${{matrix.os}}-nightly
ls -la bin
- name: Set up ssh agent
uses: webfactory/ssh-agent@v0.5.3
- name: Set up ssh
uses: ./.github/actions/setup-ssh
with:
ssh-private-key: |
${{ secrets.WEAVE_GITOPS_TEST_WEAVEWORKS_WEAVE_GITOPS_BOT_SSH_KEY }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ jobs:
go-version: 1.16.x
- name: Checkout code
uses: actions/checkout@v2
- name: Set up ssh
uses: ./.github/actions/setup-ssh
with:
ssh-private-key: ${{ secrets.WEAVE_GITOPS_TEST_WEAVEWORKS_WEAVE_GITOPS_BOT_SSH_KEY }}
- name: Install UI Deps
run: npm ci
- name: UI Deps Audit
Expand Down

0 comments on commit 0ae045d

Please sign in to comment.