Skip to content

Conversation

graham-chainlink
Copy link
Collaborator

@graham-chainlink graham-chainlink commented Sep 18, 2025

Problem Statement

Currently for pipelines, when user wants to run a pipeline, they have to create an input yaml file and manually enter the field names and values, if the config required for the changeset is complicated, user have to do some typing and mistakes can happen (eg wrong type, incorrect field name etc) and it gets trickier if config resolver is being used too, this mundane and error prone task can be automated and give our users a better experience.

Description

This commit introduces a new template-input command that generates YAML input templates from Go struct types for durable pipeline changesets. The command uses reflection to analyze changeset input types and produces well-formatted YAML templates with type comments to guide users in creating valid input files.

# Generate template for single changeset
go run main.go durable-pipeline template-input \
  --environment testnet \
  --changeset 0001_my_changeset

# Generate template for multiple changesets
go run main.go durable-pipeline template-input \
  --environment testnet \
  --changeset changeset1,changeset2,changeset3

# Configure depth limit for nested structures (avoiding infinite recursion)
go run main.go durable-pipeline template-input \
  --environment testnet \
  --changeset 0001_my_changeset \
  --depth 3

Example

Registry

	# with resolver
	registry.Add("deploy_link_token", cldf_changeset.ConfigureLegacy(commonChangeset.DeployLinkToken).WithConfigResolver(resolvers.DeployLinkTokenResolver))

	registry.Add("deploy_link_token_2",
		cldf_changeset.ConfigureLegacy(commonChangeset.DeployLinkToken).WithEnvInput())
# Save to file
go run main.go durable-pipeline template-input --environment testnet --changeset deploy_link_token,deploy_link_token_2 > input.yaml

Input.yaml

# Generated via template-input command
environment: testnet
domain: exemplar
changesets:
  # Config Resolver: github.com/smartcontractkit/chainlink-deployments/domains/exemplar/resolvers.DeployLinkTokenResolver
  # Input type: resolvers.DeployLinkTokenInput
  - deploy_link_token:
      # Optional: Chain overrides (uncomment if needed)
      # chainOverrides:
      #   - 1  # Chain selector 1
      #   - 2  # Chain selector 2
      payload:
        chains:
          - # string

  # ----------------------------------------
  # Input type: []uint64
  - deploy_link_token_2:
      # Optional: Chain overrides (uncomment if needed)
      # chainOverrides:
      #   - 1  # Chain selector 1
      #   - 2  # Chain selector 2
      payload:
        # Array of uint64
        - # uint64

More Complex Example:

# Generated via template-input command
environment: testnet
domain: data-streams
changesets:
  # Input type: jobs.DistributeLLOJobSpecsConfig
  - 0001_my_changeset:
      # Optional: Chain overrides (uncomment if needed)
      # chainOverrides:
      #   - 1  # Chain selector 1
      #   - 2  # Chain selector 2
      payload:
        chainselectorevm: # uint64
        filter: 
          donID: # uint64
          donName: # string
          envLabel: # string
          numOracleNodes: # uint32
          numBootstrapNodes: # uint32
        fromblock: # uint64
        configmode: # string
        channelconfigstoreaddr: # common.Address
        channelconfigstorefromblock: # uint64
        configuratoraddress: # string
        labels: 
          - key: # string
            value: # string
        servers: 
          example_key: # string
        nodenames: 
          - # string
        transmitters: 
          - type: # string
            opts: 
              triggercapabilityname: ...
              triggercapabilityversion: ...
              triggertickerminresolutionms: ...
              triggersendchannelbuffersize: ...

JIRA: https://smartcontract-it.atlassian.net/browse/CLD-655

Copy link

changeset-bot bot commented Sep 18, 2025

🦋 Changeset detected

Latest commit: a7f1907

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
chainlink-deployments-framework Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@graham-chainlink graham-chainlink force-pushed the ggoh/template-input branch 4 times, most recently from aaf0717 to ca0c01c Compare September 18, 2025 06:51
@graham-chainlink graham-chainlink marked this pull request as ready for review September 18, 2025 07:04
@graham-chainlink graham-chainlink requested a review from a team as a code owner September 18, 2025 07:04
@graham-chainlink graham-chainlink force-pushed the ggoh/template-input branch 2 times, most recently from 04ba341 to 225364d Compare September 19, 2025 02:12
@graham-chainlink graham-chainlink force-pushed the ggoh/template-input branch 2 times, most recently from 03d5d51 to 49ed323 Compare September 19, 2025 06:38
This commit introduces a new template-input command that generates YAML input templates from Go struct types for durable pipeline changesets. The command uses reflection to analyze changeset input types and produces well-formatted YAML templates with type comments to guide users in creating valid input files.

```
go run main.go durable-pipeline template-input \
  --environment testnet \
  --changeset 0001_my_changeset

go run main.go durable-pipeline template-input \
  --environment testnet \
  --changeset changeset1,changeset2,changeset3

go run main.go durable-pipeline template-input \
  --environment testnet \
  --changeset 0001_my_changeset \
  --depth 3
 ```

 Example
 ```
 # Save to file
 go run main.go durable-pipeline template-input --environment testnet --changeset 0001_my_changeset > inputs.yaml
 ```

Input.yaml
```
 # Generated via template-input command
 environment: testnet
 domain: myproject
 changesets:
   # Input type: myproject.DeploymentConfig
   - 0001_deploy_contracts:
       # Optional: Chain overrides (uncomment if needed)
       # chainOverrides:
       #   - 1  # Chain selector 1
       #   - 2  # Chain selector 2
       payload:
         contract_name: # string
         initial_supply: # uint64
         owner_address: # common.Address
         feature_flags:
           - # string
         metadata:
           example_key: # int
         advanced_config:
           timeout: # time.Duration
           retry_count: # uint8
```
@cl-sonarqube-production
Copy link

@graham-chainlink graham-chainlink added this pull request to the merge queue Sep 19, 2025
Merged via the queue into main with commit 9e6bc1d Sep 19, 2025
15 checks passed
@graham-chainlink graham-chainlink deleted the ggoh/template-input branch September 19, 2025 08:35
github-merge-queue bot pushed a commit that referenced this pull request Sep 19, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## [email protected]

### Minor Changes

-
[#437](#437)
[`2224427`](2224427)
Thanks [@jkongie](https://github.com/jkongie)! - **[BREAKING]**
Refactored `LoadOffchainClient` to use functional options

    ## Function Signature Changed

    **Before:**

    ```go
func LoadOffchainClient(ctx, domain, env, config, logger,
useRealBackends)
    ```

    **After:**

    ```go
    func LoadOffchainClient(ctx, domain, cfg, ...opts)
    ```

    ## Migration Required

    -   `logger` → `WithLogger(logger)` option (optional, has default)
- `useRealBackends` → `WithDryRun(!useRealBackends)` ⚠️ **inverted
logic**
- `env` → `WithCredentials(creds)` option (optional, defaults to TLS)
    -   `config` → `config.Offchain.JobDistributor`

    **Example:**

    ```go
    // Old
    LoadOffchainClient(ctx, domain, "testnet", config, logger, false)

    // New
    LoadOffchainClient(ctx, domain, config.Offchain.JobDistributor,
        WithLogger(logger),
        WithDryRun(true), // Note: inverted!
    )

    ```

-
[#428](#428)
[`e172683`](e172683)
Thanks [@jkongie](https://github.com/jkongie)! - Adds a test engine
runtime for executing changesets in unit/integration tests

-
[#443](#443)
[`9e6bc1d`](9e6bc1d)
Thanks [@graham-chainlink](https://github.com/graham-chainlink)! - feat:
introduce template-input command for generating YAML input

This commit introduces a new template-input command that generates YAML
input templates from Go struct types for durable pipeline changesets.
The command uses reflection to analyze changeset input types and
produces well-formatted YAML templates with type comments to guide users
in creating valid input files.

-
[#440](#440)
[`7f1af5d`](7f1af5d)
Thanks [@RodrigoAD](https://github.com/RodrigoAD)! - add support for sui
in mcms commands

---------

Co-authored-by: app-token-issuer-engops[bot] <144731339+app-token-issuer-engops[bot]@users.noreply.github.com>
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.

3 participants