From 6250c66f592d87042fd715abb1cccb0be90d54e1 Mon Sep 17 00:00:00 2001 From: leehk Date: Wed, 16 Apr 2025 15:15:27 +0800 Subject: [PATCH 1/3] update to check --- .github/workflows/template_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/template_test.yml b/.github/workflows/template_test.yml index 2ce9e02..8f63c1a 100644 --- a/.github/workflows/template_test.yml +++ b/.github/workflows/template_test.yml @@ -78,14 +78,14 @@ jobs: $testComposePath = "${{ inputs.testComposeFilePath }}" # create compose structure (using YAML structure for Docker Compose v2+) - $compose = @{ version = "3.8"; services = @{}; networks = @{} } + $compose = @{ services = @{}; networks = @{} } $compose.networks.test = @{ external = $false; name = "test-network-${{ github.run_id }}" } # Use unique network name per run # Generate services Section Based on Images inputs foreach ($img in $images) { $serviceName = $img.name $svc = @{} - $svc.image = "${{ env.IMAGE_REPO }}/$($serviceName):${{ env.TAG }}" # Use run_id tag + $svc.image = "${{ inputs.image_repo }}/$($serviceName):${{ env.TAG }}" # Use run_id tag if ($img.depends_on) { $svc.depends_on = $img.depends_on @@ -165,7 +165,7 @@ jobs: $ENV_ARGS \ -v "$STAGING_DIR:$RESULTS_PATH" \ --rm \ - "${{ env.IMAGE_REPO }}/$($serviceName)/${{ inputs.testContainerName }}:${{ github.run_id }}" \ + "${{ inputs.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 d175a9e37d403d2ab08142ac1634e435843a4ae0 Mon Sep 17 00:00:00 2001 From: leehk Date: Wed, 16 Apr 2025 16:09:23 +0800 Subject: [PATCH 2/3] replace the image repo directly --- .github/workflows/template_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/template_test.yml b/.github/workflows/template_test.yml index 8f63c1a..84031c9 100644 --- a/.github/workflows/template_test.yml +++ b/.github/workflows/template_test.yml @@ -85,7 +85,7 @@ jobs: foreach ($img in $images) { $serviceName = $img.name $svc = @{} - $svc.image = "${{ inputs.image_repo }}/$($serviceName):${{ env.TAG }}" # Use run_id tag + $svc.image = "ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/$($serviceName):${{ env.TAG }}" # Use run_id tag if ($img.depends_on) { $svc.depends_on = $img.depends_on @@ -165,7 +165,7 @@ jobs: $ENV_ARGS \ -v "$STAGING_DIR:$RESULTS_PATH" \ --rm \ - "${{ inputs.image_repo }}/$($serviceName)/${{ inputs.testContainerName }}:${{ github.run_id }}" \ + "ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/$($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 28791d0bca8ae55d19273412b4bab373fd86d354 Mon Sep 17 00:00:00 2001 From: leehk Date: Wed, 16 Apr 2025 16:24:14 +0800 Subject: [PATCH 3/3] include permission --- .github/workflows/build_new.yml | 5 ++++- .github/workflows/template_test.yml | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_new.yml b/.github/workflows/build_new.yml index 5e1a319..3f14c6d 100644 --- a/.github/workflows/build_new.yml +++ b/.github/workflows/build_new.yml @@ -61,7 +61,10 @@ jobs: test: name: Run Tests needs: build # Ensure this job runs after the build job - + # Define necessary permissions if needed (e.g., for GitHub Packages) + permissions: + contents: read + packages: write # If pushing to GitHub Packages registry # Call the reusable workflow for testing uses: ./.github/workflows/template_test.yml # Path to the reusable workflow file with: diff --git a/.github/workflows/template_test.yml b/.github/workflows/template_test.yml index 84031c9..23e27b7 100644 --- a/.github/workflows/template_test.yml +++ b/.github/workflows/template_test.yml @@ -85,7 +85,7 @@ jobs: foreach ($img in $images) { $serviceName = $img.name $svc = @{} - $svc.image = "ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/$($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 @@ -165,7 +165,7 @@ jobs: $ENV_ARGS \ -v "$STAGING_DIR:$RESULTS_PATH" \ --rm \ - "ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/$($serviceName)/${{ inputs.testContainerName }}:${{ github.run_id }}" \ + "${{ env.IMAGE_REPO }}/${{ 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