@@ -95,16 +95,37 @@ jobs:
9595 echo "=== Git Config URL Rewrites ==="
9696 git config --global --get-regexp 'url\..*\.insteadof' || echo "No git URL rewrites found"
9797
98- # Write SSH keys to files for use inside Docker container
99- # The SSH agent runs on the runner but we need actual key files inside the
100- # Docker container to create SSH config with host aliases. We write the keys
101- # to .docker-ssh/ which gets copied into the container during build .
98+ # Prepare all SSH configuration files for Docker build
99+ # The SSH agent runs on the runner but we need actual key files and config
100+ # inside the Docker container. We pre-build everything here in the workflow
101+ # to keep the Dockerfile simple and free of CI-specific logic .
102102 - name : Prepare SSH keys for Docker build
103103 run : |
104104 mkdir -p .docker-ssh
105+
106+ # Write SSH private keys
105107 echo "${{ secrets.DEPLOY_KEY_FOR_OLMOEARTH_PRETRAIN_CLONE }}" > .docker-ssh/olmoearth_pretrain_key
106108 echo "${{ secrets.DEPLOY_KEY_FOR_OLMOEARTH_RUN_CLONE }}" > .docker-ssh/olmoearth_run_key
107- chmod 600 .docker-ssh/*
109+ chmod 600 .docker-ssh/*_key
110+
111+ # Create SSH config with host aliases
112+ cat > .docker-ssh/config << 'EOF'
113+ Host github-olmoearth-pretrain
114+ HostName github.com
115+ IdentityFile /root/.ssh/olmoearth_pretrain_key
116+ IdentitiesOnly yes
117+
118+ Host github-olmoearth-run
119+ HostName github.com
120+ IdentityFile /root/.ssh/olmoearth_run_key
121+ IdentitiesOnly yes
122+ EOF
123+
124+ # Create modified requirements files with host aliases
125+ sed 's|git@github\.com/allenai/olmoearth_pretrain|git@github-olmoearth-pretrain/allenai/olmoearth_pretrain|g' \
126+ requirements-olmoearth_pretrain.txt > .docker-ssh/requirements-olmoearth_pretrain.txt
127+ sed 's|git@github\.com/allenai/olmoearth_run|git@github-olmoearth-run/allenai/olmoearth_run|g' \
128+ requirements-olmoearth_run.txt > .docker-ssh/requirements-olmoearth_run.txt
108129
109130# # REMOVE BEFORE MERGE! ####
110131# - name: Clone olmoearth repositories and update requirements-extra.txt
0 commit comments