Ability to set property/variable from script (OD-2617)
Shivum opened 1 month ago

Hi, is it possible to set a variable/secret/property etc from a script? I want to automatically grab a version number from a file in the repo and use that for a docker image tag, but I'm not sure how to save that value into a variable. Is it just @somevariable = somevalue?

  • Robin Shen commented 1 month ago

    Do you need to set image tag for the build image step? If so, please follow below steps:

    1. Extract variable value into a file in workspace, say var.txt
    2. Specify tag of the image as for instance <image name>:@file:var.txt@
  • Shivum commented 1 month ago

    Do you need to set image tag for the build image step? If so, please follow below steps:

    1. Extract variable value into a file in workspace, say var.txt
    2. Specify tag of the image as for instance <image name>:@file:var.txt@

    So that would work in that situation, but I just got another similar situation. I have a parameter that stores an IP in the format of "xxx.xxx.xxx.xxx/24". In a later step, I need to use SCP to transfer a file to the IP in the parameter, but I need to remove the /24 (there are some work around I can think of) but could I not save the value into a variable to use in the scp step?

  • Robin Shen commented 1 month ago

    You will need to extract ip to a workspace file, and use @file:@ notion in SCP step

  • Shivum changed state to 'Closed' 1 month ago
    Previous Value Current Value
    Open
    Closed
issue 1/1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-2617
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover