From e793bb5f44a1d02862db48ca208a73173c68f305 Mon Sep 17 00:00:00 2001 From: leehk Date: Wed, 16 Apr 2025 13:54:41 +0800 Subject: [PATCH 1/8] test ci workflows --- .github/workflows/build_new.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_new.yml b/.github/workflows/build_new.yml index 66600e7..885bcd7 100644 --- a/.github/workflows/build_new.yml +++ b/.github/workflows/build_new.yml @@ -105,4 +105,6 @@ jobs: "LOG_LEVEL": "DEBUG" } } - ] \ No newline at end of file + ] + + \ No newline at end of file From 1680455a1a5af82ad7d4e629e1d550e4087e9f6a Mon Sep 17 00:00:00 2001 From: leehk Date: Wed, 16 Apr 2025 13:56:12 +0800 Subject: [PATCH 2/8] update values --- .github/workflows/build_new.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_new.yml b/.github/workflows/build_new.yml index 885bcd7..6af05e9 100644 --- a/.github/workflows/build_new.yml +++ b/.github/workflows/build_new.yml @@ -67,8 +67,8 @@ jobs: # Call the reusable workflow for testing uses: ./.github/workflows/template_test.yml # Path to the reusable workflow file with: - projectName: ${{ env.PROJECT_NAME }} - repo: ${{ env.ARTIFACTORY_REPO }} + projectName: aimingmed-ai + repo: https://github.com/aimingmed # Pass test environment variables as JSON string testEnvs: > [ @@ -107,4 +107,3 @@ jobs: } ] - \ No newline at end of file From b3470e0eb9d31f5e565222ef18245e25f3697caa Mon Sep 17 00:00:00 2001 From: leehk Date: Wed, 16 Apr 2025 14:09:01 +0800 Subject: [PATCH 3/8] update --- .github/workflows/build_new.yml | 4 ++-- .github/workflows/template_test.yml | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_new.yml b/.github/workflows/build_new.yml index 6af05e9..a4b002c 100644 --- a/.github/workflows/build_new.yml +++ b/.github/workflows/build_new.yml @@ -91,8 +91,8 @@ jobs: "env": { "ENVIRONMENT": "dev", "TESTING": "1", - "DEEPSEEK_API_KEY": "${{ secrets.DEEPSEEK_API_KEY }}", - "TAVILY_API_KEY": "${{ secrets.TAVILY_API_KEY }}" + "DEEPSEEK_API_KEY": "", + "TAVILY_API_KEY": "" } }, diff --git a/.github/workflows/template_test.yml b/.github/workflows/template_test.yml index e73cce9..cf6d146 100644 --- a/.github/workflows/template_test.yml +++ b/.github/workflows/template_test.yml @@ -35,6 +35,7 @@ on: required: false type: string default: results.xml + jobs: compose_and_test: @@ -64,8 +65,12 @@ jobs: run: | # Load Inputs (parse JSON strings) $imagesJson = '${{ inputs.images }}' + $deepseekApiKey = '${{ secrets.DEEPSEEK_API_KEY }}' + $tavilyApiKey = '${{ secrets.TAVILY_API_KEY }}' # Substitute secrets *before* parsing JSON using environment variables # Be very careful with escaping if secrets contain special JSON characters + $imagesJson = $imagesJson -replace '"DEEPSEEK_API_KEY": ""', "`"DEEPSEEK_API_KEY`": `"$deepseekApiKey`"" + $imagesJson = $imagesJson -replace '"TAVILY_API_KEY": ""', "`"TAVILY_API_KEY`": `"$tavilyApiKey`"" Write-Host "Substituted Images JSON: $imagesJson" # Debugging - remove sensitive info if public $images = $imagesJson | ConvertFrom-Json From ab01c1c2cc007437e30f36d6fb0fb8cebc7ee6e4 Mon Sep 17 00:00:00 2001 From: leehk Date: Wed, 16 Apr 2025 14:15:09 +0800 Subject: [PATCH 4/8] not required --- .github/workflows/template_build.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/template_build.yml b/.github/workflows/template_build.yml index 43ffc59..42b99e0 100644 --- a/.github/workflows/template_build.yml +++ b/.github/workflows/template_build.yml @@ -28,11 +28,7 @@ on: commit_sha: required: true type: string - secrets: - DEEPSEEK_API_KEY: - required: true - TAVILY_API_KEY: - required: true + jobs: build-single-image: # This job executes the build steps for the specific image configuration passed via inputs From f1cc8258453caec30072ea852d547eb3c4e2b83c Mon Sep 17 00:00:00 2001 From: leehk Date: Wed, 16 Apr 2025 14:42:11 +0800 Subject: [PATCH 5/8] update --- .github/workflows/build_new.yml | 12 +++++------- .github/workflows/template_build.yml | 4 ++-- .github/workflows/template_test.yml | 9 +++++---- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build_new.yml b/.github/workflows/build_new.yml index a4b002c..4b5f36c 100644 --- a/.github/workflows/build_new.yml +++ b/.github/workflows/build_new.yml @@ -14,11 +14,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -# Global environment variables accessible in the calling job -env: - PROJECT_NAME: aimingmed-ai - REPO: https://github.com/aimingmed # Updated repo for aimingmed-ai - jobs: # This job defines the matrix and calls the reusable workflow for each image build build: @@ -45,6 +40,9 @@ jobs: - IMAGE_NAME: frontend-aimingmedai BUILD_CONTEXT: ./app/frontend DOCKERFILE: ./app/frontend/Dockerfile.test + - IMAGE_NAME: tests-aimingmedai + BUILD_CONTEXT: ./app/tests + DOCKERFILE: ./app/tests/Dockerfile # Call the reusable workflow uses: ./.github/workflows/template_build.yml # Path to the reusable workflow file @@ -52,7 +50,7 @@ jobs: with: # Pass values from the matrix context and global env project_name: aimingmed-ai - repo: https://github.com/aimingmed + image_repo: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/ image_name: ${{ matrix.image_config.IMAGE_NAME }} build_context: ${{ matrix.image_config.BUILD_CONTEXT }} dockerfile: ${{ matrix.image_config.DOCKERFILE }} @@ -68,7 +66,7 @@ jobs: uses: ./.github/workflows/template_test.yml # Path to the reusable workflow file with: projectName: aimingmed-ai - repo: https://github.com/aimingmed + image_repo: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/ # Pass test environment variables as JSON string testEnvs: > [ diff --git a/.github/workflows/template_build.yml b/.github/workflows/template_build.yml index 42b99e0..5755a36 100644 --- a/.github/workflows/template_build.yml +++ b/.github/workflows/template_build.yml @@ -10,7 +10,7 @@ on: project_name: required: true type: string - repo: + image_repo: required: true type: string image_name: @@ -72,7 +72,7 @@ jobs: # Define tags consistently using inputs id: tags run: | - echo "image_repo_path=ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/${{ inputs.image_name }}" >> $GITHUB_OUTPUT + echo "image_repo_path=${{ inputs.image_repo }}/${{ inputs.image_name }}" >> $GITHUB_OUTPUT echo "tag_build_id=${{ inputs.build_id }}" >> $GITHUB_OUTPUT echo "tag_commit_sha=${{ inputs.commit_sha }}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/template_test.yml b/.github/workflows/template_test.yml index cf6d146..2ce9e02 100644 --- a/.github/workflows/template_test.yml +++ b/.github/workflows/template_test.yml @@ -6,7 +6,7 @@ on: projectName: required: true type: string - repo: + image_repo: required: true type: string images: # JSON string defining services for compose @@ -43,7 +43,7 @@ jobs: runs-on: ubuntu-latest env: # Env vars needed for compose file generation/execution - REPO: ${{ inputs.repo }} + IMAGE_REPO: ${{ inputs.image_repo }} PROJECT_NAME: ${{ inputs.projectName }} TAG: ${{ github.run_id }} # Use run_id as the build tag @@ -85,7 +85,8 @@ jobs: foreach ($img in $images) { $serviceName = $img.name $svc = @{} - $svc.image = "${{ env.REPO }}/${{ env.PROJECT_NAME }}/$($serviceName):${{ env.TAG }}" # Use run_id tag + $svc.image = "${{ env.IMAGE_REPO }}/$($serviceName):${{ env.TAG }}" # Use run_id tag + if ($img.depends_on) { $svc.depends_on = $img.depends_on } @@ -164,7 +165,7 @@ jobs: $ENV_ARGS \ -v "$STAGING_DIR:$RESULTS_PATH" \ --rm \ - "${{ inputs.repo }}/${{ inputs.projectName }}/${{ inputs.testContainerName }}:${{ github.run_id }}" \ + "${{ env.IMAGE_REPO }}/$($serviceName)/${{ inputs.testContainerName }}:${{ github.run_id }}" \ "$test_dir" # Add error handling if needed (e.g., exit script if a test run fails) if [ $? -ne 0 ]; then From f83cc4d4ea01b1f321436797e6b6648a22195fa8 Mon Sep 17 00:00:00 2001 From: leehk Date: Wed, 16 Apr 2025 14:44:20 +0800 Subject: [PATCH 6/8] remove extra '/' --- .github/workflows/build_new.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_new.yml b/.github/workflows/build_new.yml index 4b5f36c..5e1a319 100644 --- a/.github/workflows/build_new.yml +++ b/.github/workflows/build_new.yml @@ -50,7 +50,7 @@ jobs: with: # Pass values from the matrix context and global env project_name: aimingmed-ai - image_repo: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/ + image_repo: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]') image_name: ${{ matrix.image_config.IMAGE_NAME }} build_context: ${{ matrix.image_config.BUILD_CONTEXT }} dockerfile: ${{ matrix.image_config.DOCKERFILE }} @@ -66,7 +66,7 @@ jobs: uses: ./.github/workflows/template_test.yml # Path to the reusable workflow file with: projectName: aimingmed-ai - image_repo: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/ + image_repo: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]') # Pass test environment variables as JSON string testEnvs: > [ From ba81565371ad1616952e07183556d6e0750c736f Mon Sep 17 00:00:00 2001 From: leehk Date: Wed, 16 Apr 2025 14:46:01 +0800 Subject: [PATCH 7/8] create gitkeep for empty tests folder --- app/tests/tests/integration/backend/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 app/tests/tests/integration/backend/.gitkeep diff --git a/app/tests/tests/integration/backend/.gitkeep b/app/tests/tests/integration/backend/.gitkeep new file mode 100644 index 0000000..e69de29 From 764c10b07e10132438483ba2eeaaed654b924feb Mon Sep 17 00:00:00 2001 From: leehk Date: Wed, 16 Apr 2025 14:48:45 +0800 Subject: [PATCH 8/8] add one more gitkeep --- app/tests/tests/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 app/tests/tests/.gitkeep diff --git a/app/tests/tests/.gitkeep b/app/tests/tests/.gitkeep new file mode 100644 index 0000000..e69de29