Skip to content

Remove ssh config from deployment#161

Merged
jnu merged 6 commits into
mainfrom
secret
Apr 13, 2026
Merged

Remove ssh config from deployment#161
jnu merged 6 commits into
mainfrom
secret

Conversation

@jnu

@jnu jnu commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

SSH parameters used to be necessary in the build pipeline since we pulled in dependencies from private repos. These repos are now full open source so the SSH configuration is no longer necessary.

Comment on lines 34 to 42
username: blindchargingapi
password: ${{ secrets.AZURE_REGISTRY_PASSWORD }}

- name: Set up SSH
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: |
${{ secrets.SSH_ALLIGATER_DEPLOY_PRIVATE_KEY }}
${{ secrets.SSH_BC2_DEPLOY_PRIVATE_KEY }}

# The webfactory/ssh-agent step generates a .gitconfig and .ssh/config
# that need to be 1) copied into the build context, and 2) injected into
# the Dockerfile so that the build can access private repositories.
- name: Patch git and ssh in Dockerfile
env:
DIR: ${{github.workspace}}
run: |
CONFIG_DIR=terraform/research/custom-config
mkdir -p $CONFIG_DIR
cp -r ~/.gitconfig ~/.ssh $CONFIG_DIR/
ed -s $DIR/terraform/research/Dockerfile <<EOF
/WORKDIR/
i
COPY custom-config/.gitconfig /root/.gitconfig
COPY custom-config/.ssh /root/.ssh
RUN sed 's|/home/runner|/root|g' -i.bak /root/.ssh/config
.
w
q
EOF
ls -l $CONFIG_DIR/.ssh
cat $CONFIG_DIR/.ssh/config
cat $CONFIG_DIR/.gitconfig

- name: Build and push research image
uses: docker/build-push-action@v6
with:
# Use the configured ssh-agent in the build for private repos.
ssh: default=${{ env.SSH_AUTH_SOCK }}
# Override default context to use the checkout with Dockerfile modifications.
context: ${{github.workspace}}/terraform/research
file: ${{github.workspace}}/terraform/research/Dockerfile
# Apply new version tag and replace any existing `latest` tag.
push: true
tags: blindchargingapi.azurecr.io/blind-charging-research:latest

This comment was marked as outdated.

Comment thread .github/workflows/research.yml Outdated
Comment on lines +40 to +41
context: .
file: terraform/research/Dockerfile

This comment was marked as outdated.

Comment on lines 95 to 103
username: blindchargingapi
password: ${{ secrets.AZURE_REGISTRY_PASSWORD }}

- name: Set up SSH
uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: |
${{ secrets.SSH_ALLIGATER_DEPLOY_PRIVATE_KEY }}
${{ secrets.SSH_BC2_DEPLOY_PRIVATE_KEY }}

# The webfactory/ssh-agent step generates a .gitconfig and .ssh/config
# that need to be 1) copied into the build context, and 2) injected into
# the Dockerfile so that the build can access private repositories.
- name: Patch git and ssh in Dockerfile
env:
DIR: ${{github.workspace}}
run: |
mkdir -p custom-config
cp -r ~/.gitconfig ~/.ssh custom-config/
ed -s $DIR/Dockerfile <<EOF
/WORKDIR/
i
COPY custom-config/.gitconfig /root/.gitconfig
COPY custom-config/.ssh /root/.ssh
RUN sed 's|/home/runner|/root|g' -i.bak /root/.ssh/config
.
w
q
EOF
ls -l custom-config/.ssh
cat custom-config/.ssh/config
cat custom-config/.gitconfig

- name: Build and push API image
uses: docker/build-push-action@v6
with:
# Use the configured ssh-agent in the build for private repos.
ssh: default=${{ env.SSH_AUTH_SOCK }}
# Override default context to use the checkout with Dockerfile modifications.
context: ${{github.workspace}}
file: ${{github.workspace}}/Dockerfile
# Apply new version tag, as well as a tag based on release channel.
push: true
tags: blindchargingapi.azurecr.io/blind-charging-api:${{ needs.tag.outputs.api_release_channel }},blindchargingapi.azurecr.io/blind-charging-api:${{ needs.tag.outputs.api_version }}

This comment was marked as outdated.

@jnu jnu merged commit 482f0cf into main Apr 13, 2026
6 checks passed
@jnu jnu deleted the secret branch April 13, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant