Uploaded image for project: 'JS - JobScheduler'
  1. JS - JobScheduler
  2. JS-1972

Values of variables in job assignments and in job resources should be made available from temporary files

    XMLWordPrintable

Details

    Description

      Current Situation

      • JS7 offers to assign arguments and environment variables to jobs and Job Resources.
        • Typically variables carry pairs of names and values, for example like this:
          • "variables": { "mailBody": 'Hi there,\n\nfind more information from https://js7.sh' }
            
        • Values for such variables technically can hold up to 8 MB data. However, assigning such long values to environment variables can break the OS shell's capabilities which results in truncated values being returned.

      Desired Behavior

      • It should be possible to access long values from a temporary file instead of direct assignment of the value to an environment variable.
      • The job script for example can use a $BODY environment variable that holds the absolute path to a temporary file providing the body of an e-mail.
        • the job can request the value of the variable to be made available from a temporary file when assigning an environment variable. The environment variable holds the path to the file:
          • "BODY": "fileContent( $js7Unique +++ 'mail-body.html', $mailBody )"
            
          • the fileContent() function returns the absolute path to the temporary file. Its first argument specifies the name of the file that is located in the Agent's work sub-directory. The second argument specifies the variable for which the value is written to the temporary file.
          • the $js7Unique internal variable specifies an identifier that is unique with an Agent instance. This guarantees that temporary files are not overwritten from a number of variables.
        • the job will automatically receive the path to a temporary file if the variable is configured from a Job Resource that makes use of the fileContent() function like this:
          •   "variables": {
                "mailBody": "fileContent( $js7Unique +++ 'mail-body.html', '<html><head/><body><p>Hi there,</p><br/><br/><p>find more information from <a href=\"https://js7.sh\">JS7</a></p></body></html>' )",
            
          • If the Job Resource Variable mailBody from the above example is assigned a job environment variable then automatically the path to a temporary file holding the variable's value is returned.

      Delimitation

      • Use of the fileContent() function is possible only
        • within the definition of a Job Resource Variable,
        • when assigning a shell job an environment variable
        • when assigning a JVM job an argument.
      • This feature includes to create a temporary file for each execution of a job referencing a variable by use of the fileContent() function.
      • With JS-1976 the lifecycle of Job Resources is considered and the temporary file is created/updated/deleted only if the respective Job Resource is deployed or removed

      Attachments

        Issue Links

          Activity

            People

              jz Joacim Zschimmer
              ap Andreas Püschel
              Andreas Püschel Andreas Püschel
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: