44 DEBUG : napi:*
55 APP_NAME : python-node
66 MACOSX_DEPLOYMENT_TARGET : ' 10.13'
7+ CARGO_NET_GIT_FETCH_WITH_CLI : ' true'
78
89permissions :
910 contents : write
2324 - docs/**
2425 pull_request :
2526
27+ concurrency :
28+ group : ${{ github.workflow }}-${{ github.ref }}-ci
29+ cancel-in-progress : true
30+
2631jobs :
2732 build :
2833 strategy :
9095 run : |
9196 set -x
9297
98+ export CARGO_NET_GIT_FETCH_WITH_CLI=true
99+
93100 # Install apt dependencies
94101 apt-get update -y
95102 apt-get install -y openssh-client
@@ -98,16 +105,41 @@ jobs:
98105 corepack disable
99106 npm i -gf pnpm
100107
101- # Set up SSH key (to checkout private repos with cargo)
108+ # Set up SSH keys (to checkout private repos with cargo)
102109 mkdir -p ~/.ssh
103- chmod -R 400 ~/.ssh
104- touch ~/.ssh/config ~/.ssh/known_hosts
105- eval `ssh-agent -s`
106- echo "${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }}" | tr -d '\r' | ssh-add -
107- echo "${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }}" | tr -d '\r' | ssh-add -
108- ssh-add -l
110+ chmod 700 ~/.ssh
111+
112+ # Save SSH keys to files with specific names
113+ echo "${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }}" | tr -d '\r' > ~/.ssh/id_rsa_http_handler
114+ echo "${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }}" | tr -d '\r' > ~/.ssh/id_rsa_http_rewriter
115+ chmod 600 ~/.ssh/id_rsa_*
116+
117+ # Add GitHub to known hosts
109118 ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
110119
120+ # Create wrapper script for git to use correct SSH key based on repo
121+ cat > ~/.ssh/git-ssh-wrapper.sh <<'EOF'
122+ #!/bin/bash
123+ if [[ "$@" == *"http-handler"* ]]; then
124+ ssh -i ~/.ssh/id_rsa_http_handler -o StrictHostKeyChecking=no "$@"
125+ elif [[ "$@" == *"http-rewriter"* ]]; then
126+ ssh -i ~/.ssh/id_rsa_http_rewriter -o StrictHostKeyChecking=no "$@"
127+ else
128+ ssh -o StrictHostKeyChecking=no "$@"
129+ fi
130+ EOF
131+ chmod +x ~/.ssh/git-ssh-wrapper.sh
132+
133+ # Export GIT_SSH to use our wrapper
134+ export GIT_SSH=~/.ssh/git-ssh-wrapper.sh
135+
136+ # Test access to both repositories
137+ echo "Testing access to repositories:"
138+ echo "http-handler:"
139+ GIT_SSH=~/.ssh/git-ssh-wrapper.sh git ls-remote ssh://git@github.com/platformatic/http-handler.git HEAD || echo "Failed to access http-handler"
140+ echo "http-rewriter:"
141+ GIT_SSH=~/.ssh/git-ssh-wrapper.sh git ls-remote ssh://git@github.com/platformatic/http-rewriter.git HEAD || echo "Failed to access http-rewriter"
142+
111143 ${{ matrix.settings.build }}
112144 - name : Build
113145 run : ${{ matrix.settings.build }}
@@ -232,6 +264,8 @@ jobs:
232264 run : |
233265 set -x
234266
267+ export CARGO_NET_GIT_FETCH_WITH_CLI=true
268+
235269 # Install apt dependencies
236270 apt-get update -y
237271 apt-get install -y openssh-client curl
@@ -240,16 +274,41 @@ jobs:
240274 curl https://sh.rustup.rs -sSf | bash -s -- -y -t ${{ matrix.settings.target }}
241275 source "$HOME/.cargo/env"
242276
243- # Set up SSH key (to checkout private repos with cargo)
277+ # Set up SSH keys (to checkout private repos with cargo)
244278 mkdir -p ~/.ssh
245- chmod -R 400 ~/.ssh
246- touch ~/.ssh/config ~/.ssh/known_hosts
247- eval `ssh-agent -s`
248- echo "${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }}" | tr -d '\r' | ssh-add -
249- echo "${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }}" | tr -d '\r' | ssh-add -
250- ssh-add -l
279+ chmod 700 ~/.ssh
280+
281+ # Save SSH keys to files with specific names
282+ echo "${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }}" | tr -d '\r' > ~/.ssh/id_rsa_http_handler
283+ echo "${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }}" | tr -d '\r' > ~/.ssh/id_rsa_http_rewriter
284+ chmod 600 ~/.ssh/id_rsa_*
285+
286+ # Add GitHub to known hosts
251287 ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
252288
289+ # Create wrapper script for git to use correct SSH key based on repo
290+ cat > ~/.ssh/git-ssh-wrapper.sh <<'EOF'
291+ #!/bin/bash
292+ if [[ "$@" == *"http-handler"* ]]; then
293+ ssh -i ~/.ssh/id_rsa_http_handler -o StrictHostKeyChecking=no "$@"
294+ elif [[ "$@" == *"http-rewriter"* ]]; then
295+ ssh -i ~/.ssh/id_rsa_http_rewriter -o StrictHostKeyChecking=no "$@"
296+ else
297+ ssh -o StrictHostKeyChecking=no "$@"
298+ fi
299+ EOF
300+ chmod +x ~/.ssh/git-ssh-wrapper.sh
301+
302+ # Export GIT_SSH to use our wrapper
303+ export GIT_SSH=~/.ssh/git-ssh-wrapper.sh
304+
305+ # Test access to both repositories
306+ echo "Testing access to repositories:"
307+ echo "http-handler:"
308+ GIT_SSH=~/.ssh/git-ssh-wrapper.sh git ls-remote ssh://git@github.com/platformatic/http-handler.git HEAD || echo "Failed to access http-handler"
309+ echo "http-rewriter:"
310+ GIT_SSH=~/.ssh/git-ssh-wrapper.sh git ls-remote ssh://git@github.com/platformatic/http-rewriter.git HEAD || echo "Failed to access http-rewriter"
311+
253312 cargo test --target ${{ matrix.settings.target }}
254313 - name : Test bindings
255314 uses : addnab/docker-run-action@v3
0 commit comments