Skip to content

Commit

Permalink
Update version id per commit id.
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Benusovich <[email protected]>
  • Loading branch information
dbenusov committed Nov 5, 2024
1 parent d291588 commit 6ea8f10
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/deploy-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,14 @@ jobs:
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag image $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
# Use the commit SHA for a unique image tag
IMAGE_TAG=${{ github.sha }}
# You can also limit the tag length if needed
SHORT_IMAGE_TAG=$(echo "$IMAGE_TAG" | cut -c1-8) # Use the first 8 characters
docker tag image $IMAGE_ID:$SHORT_IMAGE_TAG
docker push $IMAGE_ID:$SHORT_IMAGE_TAG
basic-server-review:
runs-on: ubuntu-latest
Expand All @@ -130,9 +136,10 @@ jobs:
- name: 'Deploy'
id: 'deploy'
run: |-
IMAGE_TAG=${{ github.sha }}
gcloud components install beta --quiet
gcloud run deploy basic-server \
--image=docker.io/flyingmonkeys1996/collision-mapper:latest \
--image=docker.io/flyingmonkeys1996/collision-mapper:$IMAGE_TAG \
--allow-unauthenticated \
--port=8080 \
--service-account=320300059816-compute@developer.gserviceaccount.com \
Expand Down Expand Up @@ -160,13 +167,14 @@ jobs:
- id: 'gcloud'
name: 'gcloud'
run: |-
IMAGE_TAG=${{ github.sha }}
gcloud components install beta --quiet
gcloud run deploy data-analyzer \
--image=docker.io/flyingmonkeys1996/collision-mapper:latest \
--image=docker.io/flyingmonkeys1996/collision-mapper:$IMAGE_TAG \
--allow-unauthenticated \
--port=8080 \
--service-account=320300059816-compute@developer.gserviceaccount.com \
--set-env-vars='APP=opt/applications/data-analyzer-server.jar,POSTGRES_USER=${{ env.POSTGRES_USER }},POSTGRES_PASSWORD=${{ env.POSTGRES_PASSWORD }},USE_SSL=true' \
--set-env-vars='APP=opt/applications/data-analyzer-server.jar,POSTGRES_USER=${{ env.POSTGRES_USER }},POSTGRES_PASSWORD=${{ env.POSTGRES_PASSWORD }},USE_SSL=true,COLLECTOR_URL=https://data-collector-320300059816.us-central1.run.app' \
--region=us-central1 \
--project=collision-mappter \
--vpc-connector=projects/collision-mappter/locations/us-central1/connectors/collision-mapper \
Expand All @@ -190,9 +198,10 @@ jobs:
- id: 'gcloud'
name: 'gcloud'
run: |-
IMAGE_TAG=${{ github.sha }}
gcloud components install beta --quiet
gcloud run deploy data-collector \
--image=docker.io/flyingmonkeys1996/collision-mapper:latest \
--image=docker.io/flyingmonkeys1996/collision-mapper:$IMAGE_TAG \
--allow-unauthenticated \
--port=8080 \
--service-account=320300059816-compute@developer.gserviceaccount.com \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory
import java.util.*
import kotlin.time.DurationUnit

private val collector_url = System.getenv("COLLECTOR_URL") ?: "localhost:8886"
private val collector_url = System.getenv("COLLECTOR_URL") ?: "http://localhost:8886"
private val work_finder = AnalyzerWorkFinder(collector_url)

val durationGauge = Gauge.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class AnalyzerWorkFinder(val collector_url: String) : WorkFinder<AnalyzerTask> {
runBlocking {
try {
// Send GET request
val response: HttpResponse = client.get("http://$collector_url/health-check")
val response: HttpResponse = client.get("$collector_url/health-check")
// Check if response contains the text
val body: String = response.bodyAsText()
status = body.contains("Ready")
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ services:
PORT: 8887
APP: /opt/applications/data-analyzer-server.jar
DATABASE_HOST: "host.docker.internal"
COLLECTOR_URL: "host.docker.internal:8886"
COLLECTOR_URL: "http://host.docker.internal:8886"
depends_on:
postgres:
condition: service_healthy
Expand Down

0 comments on commit 6ea8f10

Please sign in to comment.