Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add copy-param as an IF builtin #853

Closed
5 tasks
jmcook1186 opened this issue Jun 20, 2024 · 0 comments · Fixed by #854
Closed
5 tasks

Add copy-param as an IF builtin #853

jmcook1186 opened this issue Jun 20, 2024 · 0 comments · Fixed by #854
Assignees
Milestone

Comments

@jmcook1186
Copy link
Contributor

What
Adds a new builtin for copying existing parameters to new keys int he inputs array

Why
Useful for renaming parameters, fixes pipelines that replicate the behaviour of e.g. sci-e where specific naming patterns were expected but not provided by earlier plugins. Alternative to the mapping feature that will come later.

Context
This is an easy way to fix pipeline errors where specific parameters are required, in advance of the mapping feature that will be implemented in the next sprint. It's worth having both options as the ability to copy parameters and optionally rename is generally useful for other purposes too.

Prerequisites/resources
none

SoW (scope of work)

  • add builtin for copy-param
  • documentation updated
  • test cases added
  • linked from if-docs

Acceptance criteria

  • Copy param copies a given parameter to a new key and optionally deletes the original from the inputs array.

GIVEN the builtin is available
WHEN I run if-run -m copy-yml
AND copy.yml contains

name: copy-param
description:
tags:
initialize:
  plugins:
    copy-param:
      path: builtin
      method: Copy
      global-config:
        keep-existing: true
        from: original
        to: copy
tree:
  children:
    child-1:
      pipeline:
        - copy-param
      inputs:
        - timestamp: "2023-12-12T00:00:00.000Z"
          original: 'hello'

THEN the output should be:

name: copy-param
description: null
tags: null
initialize:
  plugins:
    copy-param:
      path: builtin
      method: Copy
      global-config:
        keep-existing: true
        from: original
        to: copy
execution:
  command: >-
    /home/user/.npm/_npx/1bf7c3c15bf47d04/node_modules/.bin/ts-node
    /home/user/Code/if/src/index.ts -m manifests/examples/copy.yaml -s
  environment:
    if-version: 0.4.0
    os: linux
    os-version: 5.15.0-107-generic
    node-version: 21.4.0
    date-time: 2024-06-20T13:03:12.427Z (UTC)
    dependencies:
      - '@babel/[email protected]'
      - '@babel/[email protected]'
      - '@commitlint/[email protected]'
      - '@commitlint/[email protected]'
      - '@grnsft/[email protected]'
      - '@jest/[email protected]'
      - '@types/[email protected]'
      - '@types/[email protected]'
      - '@types/[email protected]'
      - '@types/[email protected]'
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
  status: success
tree:
  children:
    child-1:
      pipeline:
        - copy-param
      inputs:
        - timestamp: '2023-12-12T00:00:00.000Z'
          original: hello
      outputs:
        - timestamp: '2023-12-12T00:00:00.000Z'
          original: hello
          copy: hello
@jmcook1186 jmcook1186 self-assigned this Jun 20, 2024
@jmcook1186 jmcook1186 added this to IF Jun 20, 2024
@jmcook1186 jmcook1186 moved this to In Progress in IF Jun 20, 2024
@jmcook1186 jmcook1186 moved this from In Progress to Pending Review in IF Jun 20, 2024
@zanete zanete added this to the Improve Trust milestone Jun 20, 2024
@zanete zanete assigned manushak and unassigned manushak Jun 24, 2024
@github-project-automation github-project-automation bot moved this from Pending Review to Done in IF Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants