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

Bastion ssh #216

Merged
merged 18 commits into from
Dec 7, 2023
25 changes: 25 additions & 0 deletions .github/actions/open-ssh-tunnel/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: deploy-helm
description: "Helm deploy"

inputs:
bastion_user:
description: username@host for the ssh tunnel
required: true
type: string
bastion_ssh_key:
description: private ssh key content
required: true
type: string

runs:
using: "composite"
steps:
- run: |
mkdir .ssh;
BASTION_USER=${{ inputs.bastion_user}};
echo ${{ inputs.bastion_ssh_key }} | base64 -d > .ssh/github_bastion;
chmod 600 .ssh/github_bastion;
ssh-keyscan ${BASTION_USER#*@} > .ssh/known_hosts 2> /dev/null;
chmod 644 .ssh/known_hosts;
ssh -i .ssh/github_bastion ${{ inputs.bastion_user }} -o UserKnownHostsFile=.ssh/known_hosts -D 1080 -f -q -N;
shell: bash
12 changes: 12 additions & 0 deletions .github/workflows/reusable.build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ on:
SSH_PRIVATE_KEY:
description: ssh key to private submodule
required: false
BASTION_USER:
description: ssh bastion user@server
required: true
BASTION_SSH_KEY:
description: bastion ssh key
required: true

jobs:

Expand Down Expand Up @@ -131,6 +137,12 @@ jobs:
with:
ref: ${{ inputs.commit }}

- name: Open ssh tunnel
uses: paulscherrerinstitute/scicat-ci/.github/actions/open-ssh-tunnel@bastion_ssh
with:
bastion_user: '${{ secrets.BASTION_USER }}'
bastion_ssh_key: '${{ secrets.BASTION_SSH_KEY }}'

- name: Deploy to k8s using helm
id: helm-deploy
uses: paulscherrerinstitute/scicat-ci/.github/actions/deploy-helm@main
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/scicat-search-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ jobs:
COMPONENT_CONFIG=helm/configs/search-api/component-config.json
secrets:
KUBECONFIG: ${{ secrets.KUBECONFIG }}
BASTION_USER: ${{ secrets.BASTION_USER }}
BASTION_SSH_KEY: ${{ secrets.BASTION_SSH_KEY }}
Loading