Skip to content

Conversation

@moizpgedge
Copy link
Contributor

Summary

Adds a GitHub Actions workflow that can be manually triggered to test published Docker images from container repositories. The workflow supports testing multiple image tags and architectures (arm/x86) by pulling images, verifying them, and running cluster tests against them.

Changes

  • Add test-published-images.yml workflow with workflow_dispatch trigger
  • Support configurable inputs: branch, package repository, tags list, and architectures list
  • Implement image pulling and verification for specified architectures (arm/arm64 → linux/arm64, x86/amd64 → linux/amd64)
  • Set up local Docker registry and swarm environment for testing
  • Run cluster tests against published images using existing Makefile targets
  • Add error handling to continue testing other combinations if one fails
  • Include cleanup steps to ensure proper resource cleanup

Testing

  • Manual testing can be performed by:

    1. Navigate to Actions tab in GitHub
    2. Select "Test Published Images" workflow
    3. Click "Run workflow"
    4. Provide inputs:
      • Branch: main (or any branch)
      • Package Repository: pgedge-postgres-internal (or your repository name)
      • Tags: latest,v0.6.2 (comma-separated)
      • Architectures: arm,x86 (comma-separated)
    5. Verify workflow executes and tests run successfully
  • The workflow will:

    • Pull images from ghcr.io/pgedge/{package_repository}:{tag} for each architecture
    • Verify images are accessible and correct
    • Run make test-cluster-ci with the published images
    • Report success/failure for each combination

Checklist

  • Tests added or updated (unit and/or e2e, as needed) - N/A (workflow addition)
  • Documentation updated (if needed) - Demo workflow, documentation can be added later
  • Issue is linked (branch name or URL in PR description)
  • Changelog entry added for user-facing behavior changes - Not a user-facing change
  • Breaking changes (if any) are clearly called out in the PR description - No breaking changes

Notes for Reviewers

  • This is a demo version of the workflow intended for initial implementation and future enhancements
  • The image reference format (ghcr.io/pgedge/{package_repository}:{tag}) may need adjustment based on actual repository structure
  • Future enhancements could include:
    • Parallel execution using matrix strategy for faster testing
    • Support for additional test types (e2e, integration tests)
    • Artifact collection and test result reporting
    • Notification on test completion
    • Support for additional architectures
    • Custom image repository URL patterns
  • The workflow uses sequential testing of all combinations (simpler for demo, can be parallelized later)
  • All tests run in a single job to keep the demo simple and maintainable

- Add workflow_dispatch workflow to test images from published repositories
- Supports configurable branch, package repository, tags, and architectures
- Tests images for both arm and x86 architectures
- Runs cluster tests against published images
- Demo version ready for future enhancements
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a GitHub Actions workflow for testing published Docker images from container repositories. The workflow enables manual verification of published images across multiple tags and architectures before deployment.

Key Changes:

  • New workflow test-published-images.yml with manual trigger support for testing published images
  • Image testing across configurable tags and architectures (arm/arm64 and x86/amd64)
  • Integration with existing cluster test infrastructure using local registry

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Run cluster tests
echo "Running cluster tests for ${LOCAL_IMAGE}..."
if ! CONTROL_PLANE_VERSION="${tag}" \
make docker-swarm-init && \
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docker-swarm-init target is called after Docker Swarm has already been initialized in the 'Initialize Docker Swarm' step (line 56-57). This may cause an error or unexpected behavior if the Makefile target expects an uninitialized swarm. Consider removing this redundant initialization or restructuring the workflow to initialize swarm only once.

Suggested change
make docker-swarm-init && \

Copilot uses AI. Check for mistakes.
Comment on lines 150 to 152
if ! CONTROL_PLANE_VERSION="${tag}" \
make docker-swarm-init && \
make test-cluster-ci \
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test execution combines multiple commands with && which makes it difficult to determine which specific step failed (swarm init vs. actual tests). Consider separating these into distinct steps with individual error checking for clearer failure diagnostics.

Suggested change
if ! CONTROL_PLANE_VERSION="${tag}" \
make docker-swarm-init && \
make test-cluster-ci \
if ! CONTROL_PLANE_VERSION="${tag}" make docker-swarm-init; then
echo "ERROR: Swarm initialization failed for tag=${tag}, arch=${arch}"
OVERALL_SUCCESS=false
elif ! make test-cluster-ci \

Copilot uses AI. Check for mistakes.
…flow

- Pin all GitHub Actions to full-length commit SHAs for security
  - actions/checkout@34e1148
  - actions/setup-go@40f1582
  - docker/setup-buildx-action@8d2750c
- Remove redundant docker-swarm-init call in test execution loop
- Improve error diagnostics with explicit exit code capture and reporting
@moizpgedge moizpgedge requested a review from Copilot January 7, 2026 13:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 57 to 58
docker swarm init || true

Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using || true silently suppresses errors. If the swarm is already initialized, this is fine, but if initialization fails for other reasons (e.g., network issues), the error will be hidden. Consider checking if swarm is already active before attempting to initialize, or at minimum log why initialization was skipped.

Suggested change
docker swarm init || true
# Check if Docker Swarm is already active
if docker info --format '{{.Swarm.LocalNodeState}}' 2>/dev/null | grep -qi '^active$'; then
echo "Docker Swarm is already active; skipping initialization."
exit 0
fi
echo "Docker Swarm is not active; attempting to initialize..."
if ! docker swarm init; then
echo "ERROR: Docker Swarm initialization failed." >&2
exit 1
fi

Copilot uses AI. Check for mistakes.
Comment on lines 61 to 62
docker service create --name registry --publish published=5000,target=5000 registry:2 || \
docker service update --force registry || true
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error handling pattern is unclear. If service creation fails, attempting to update it may not be the correct recovery path. Consider checking if the service already exists first, then create or update accordingly, rather than relying on command failures.

Suggested change
docker service create --name registry --publish published=5000,target=5000 registry:2 || \
docker service update --force registry || true
if docker service ls --format '{{.Name}}' | grep -q '^registry$'; then
echo "Registry service already exists, updating..."
docker service update --force registry
else
echo "Creating registry service..."
docker service create --name registry --publish published=5000,target=5000 registry:2
fi

Copilot uses AI. Check for mistakes.
- Check Docker Swarm state before attempting initialization
- Properly handle and report errors instead of silently suppressing them
- Check if registry service exists before create/update operations
- Add clear logging for better debugging and transparency
@moizpgedge moizpgedge requested a review from Copilot January 7, 2026 13:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Run cluster tests
echo "Running cluster tests for ${LOCAL_IMAGE}..."
set +e # Don't exit on error, we'll handle it
CONTROL_PLANE_VERSION="${tag}" \
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name 'CONTROL_PLANE_VERSION' is misleading since it's being set to a Docker image tag value. Consider renaming to 'IMAGE_VERSION' or 'TEST_VERSION' to clarify its purpose.

Suggested change
CONTROL_PLANE_VERSION="${tag}" \
IMAGE_VERSION="${tag}" \

Copilot uses AI. Check for mistakes.
@moizpgedge moizpgedge closed this Jan 7, 2026
@moizpgedge moizpgedge deleted the Feat/GH_action branch January 7, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants