@@ -43,23 +43,14 @@ jobs:
4343 - name : Import Existing Resources
4444 run : |
4545 cd infra/azure
46+ chmod +x ./import_resources.sh
4647 ENVIRONMENT=${{ env.ENVIRONMENT }} \
4748 SUBSCRIPTION_ID=${{ secrets.AZURE_SUBSCRIPTION_ID }} \
4849 TENANT_ID=${{ secrets.AZURE_TENANT_ID }} \
4950 OBJECT_ID=${{ secrets.AZURE_SP_OBJECT_ID }} \
5051 CI_MODE=true \
5152 ./import_resources.sh
5253
53- - name : Terraform Plan
54- run : |
55- cd infra/azure
56- terraform plan -var="environment=${{ env.ENVIRONMENT }}" \
57- -var="memgraph_username=${{ secrets.MEMGRAPH_USERNAME }}" \
58- -var="memgraph_password=${{ secrets.MEMGRAPH_PASSWORD }}" \
59- -var="subscription_id=${{ secrets.AZURE_SUBSCRIPTION_ID }}" \
60- -var="tenant_id=${{ secrets.AZURE_TENANT_ID }}" \
61- -var="object_id=${{ secrets.AZURE_SP_OBJECT_ID }}"
62-
6354 - name : Terraform Apply
6455 run : |
6556 cd infra/azure
@@ -107,33 +98,24 @@ jobs:
10798 done
10899 fi
109100
110- # Create a credentials hash to force pod restart when credentials change using maximum security approach
111- # Create a random file name to prevent predictable access
112- TEMP_FILE=$(mktemp)
113-
114- # Write credentials directly to file descriptor to prevent command line visibility
115- {
116- printf "%s" "${{ secrets.MEMGRAPH_USERNAME }}"
117- printf "%s" "${{ secrets.MEMGRAPH_PASSWORD }}"
118- } > "$TEMP_FILE"
119-
120- # Generate hash and immediately remove the file
121- CREDENTIALS_HASH=$(sha256sum "$TEMP_FILE" | awk '{print $1}')
122- rm -f "$TEMP_FILE"
123-
124- # Store hash in environment variable for later use
101+ # Create a credentials hash to force pod restart when credentials change
102+ CREDENTIALS_HASH=$(echo -n "${{ secrets.MEMGRAPH_USERNAME }}${{ secrets.MEMGRAPH_PASSWORD }}" | sha256sum | awk '{print $1}')
125103 echo "CREDENTIALS_HASH=$CREDENTIALS_HASH" >> $GITHUB_ENV
126104
127- # Apply the kubernetes secret with the new credentials
105+ # Create secret directly using kubectl command
128106 kubectl create secret generic memgraph-credentials \
129- --from-literal=username=${{ secrets.MEMGRAPH_USERNAME }} \
130- --from-literal=password=${{ secrets.MEMGRAPH_PASSWORD }} \
107+ --from-literal=username=" ${{ secrets.MEMGRAPH_USERNAME }}" \
108+ --from-literal=password=" ${{ secrets.MEMGRAPH_PASSWORD }}" \
131109 --dry-run=client -o yaml | kubectl apply -f -
110+
111+ echo "Memgraph credentials secret created successfully"
132112
133113 - name : Deploy to AKS
134114 run : |
135- # Replace the placeholder with the actual credentials hash
136- cat infra/k8s/memgraph.yaml | CREDENTIALS_HASH=${CREDENTIALS_HASH} envsubst > memgraph_deploy.yaml
115+ # Replace the placeholder with the actual credentials hash and environment
116+ cat infra/k8s/memgraph.yaml | \
117+ sed "s/\${CREDENTIALS_HASH}/$CREDENTIALS_HASH/g" | \
118+ sed "s/\${ENVIRONMENT}/${{ env.ENVIRONMENT }}/g" > memgraph_deploy.yaml
137119
138120 # Apply the updated deployment manifest
139121 kubectl apply -f memgraph_deploy.yaml
@@ -167,7 +149,7 @@ jobs:
167149 sleep 30
168150 fi
169151
170- # Wait for pod to be ready with increased timeout and check interval
152+ # Wait for pod to be ready with increased timeout
171153 if ! kubectl wait --for=condition=ready pod -l app=memgraph --timeout=10m; then
172154 echo "Error: Memgraph pod did not become ready within the timeout period."
173155 echo "Checking Memgraph pod logs:"
@@ -212,4 +194,14 @@ jobs:
212194 echo "Warning: Could not obtain external IP for Memgraph service within timeout."
213195 echo "Checking LoadBalancer service status:"
214196 kubectl describe service memgraph
197+ else
198+ MEMGRAPH_HOST="memgraph-aiagent-${{ env.ENVIRONMENT }}.${{ env.AZURE_LOCATION }}.cloudapp.azure.com"
199+ echo "=========================================================="
200+ echo "Memgraph Connection Information:"
201+ echo "Host: $MEMGRAPH_HOST"
202+ echo "Port: 7687 (Bolt), 7444 (HTTP API), 3000 (UI)"
203+ echo "Username: ${{ secrets.MEMGRAPH_USERNAME }}"
204+ echo "Password: [Configured in secrets]"
205+ echo "Connection URL: bolt://${{ secrets.MEMGRAPH_USERNAME }}@$MEMGRAPH_HOST:7687"
206+ echo "=========================================================="
215207 fi
0 commit comments