How it-bens/container-registry-sync-action works
Project Type & Purpose
• This is a GitHub Action for container registry synchronization. Its main goal is to automate the copying of Docker image tags between registries, and it supports logins through both Docker and regclient methods.
• The README outlines the usage with YAML examples to help users integrate the action within CI/CD pipelines, while the file structure confirms a modular architecture (with tests, source modules, workflows, etc.).
File Structure for Key Components
• Top-Level Files: Files like action.yml, README.md, package.json, and tsconfig.json define the project configuration, build settings, and GitHub Action metadata.
• Source Code (src/): Contains the implementation split across multiple components:
• Action.ts and Inputs.ts: Define the action’s entry points and expected inputs.
• Login/ folder: Likely manages repository login logic for both source and target registries.
• Utils/ folder: Provides helper functions including GitHub Action integrations (exec, logging) and components for interacting with regclient.
• Distribution (dist/): Houses the compiled code which is ultimately used when the action runs.
• CI/CD Configuration (.github/workflows): Configurations for linting, CodeQL, release checks, etc.
• Tests: Organized test folders (__tests__) for validating all modules.
• Scripts and Build Configurations: rollup.config.ts and tsconfig files indicate how the code is bundled and compiled.
Main Components
a. GitHub Action Workflow Environment:
• Components like the CI/CD pipeline (triggered via GitHub workflows), representing environments like the runner and the action steps.
b. Core Action Components:
• Action Entrypoint: Represented by action.yml and src/Action.ts, which serves as the main controller for the GitHub Action.
• Input Processing: The Inputs.ts module that handles and validates configuration as provided by the user.
• Business Logic Modules:
• Login Module (src/Login): Manages authentication for both source and target registries.
• Utility Modules (src/Utils): Handling logging, command execution (e.g., regclient invocation), tag filtering, and image synchronization logic.
c. External Dependencies:
• regclient/regctl: The external CLI tool required to perform image copy operations between registries.
d. CI/CD & Testing Components:
• Tests & Fixtures: Represented to show the robust testing framework implemented to ensure reliability.
Relationships & Data Flow
• The workflow starts when a user triggers the GitHub Action. The action reads inputs from the workflow YAML configuration.
• The Inputs module validates configurations and passes them to the core action component.
• The Login module is used to authenticate with the container registries based on the provided credentials.
• The action then delegates to the utility modules to fetch available image tags using regclient, apply glob-based filtering, and trigger the synchronization (copying images) between registries.
• External dependencies like regclient are invoked as subprocesses (or via a library wrapper) with appropriate parameters.