Use a single application for both the development environment and production environment by switching over the profile and settings

The development environment used by developers and the production environment used by Ops engineers may require different settings such as data storage locations and connection settings for external services. In such cases, when you want to switch the settings between the environments, it's recommended to pack the created scripts into an application for developers and Ops engineers to share.

By configuring an application per profile, you can easily switch the storage for output data, enabling flexible operation tailored to the environment.

In this section, you will create a script and switch application settings between the development environment and production environment by using the application feature, without editing the script.

Description

Create an application (Create file list) containing a script that gets a list of the files in the storage.

Set a schedule trigger and deploy it as an application for development. Then, share the application after confirming that it works correctly.

Deploy the application for production using the same steps.

The applications are then executed by the schedule trigger and the file lists are created in CSV format in the storage for each environment.

Procedures

Preparation

(1) Create a workspace

This tutorial uses the following workspaces:

  • Dev workspace

    This workspace is used by developers in the development environment.

  • Production workspace

    This workspace is used by Ops engineers in the production environment.

For the workspace creation method, refer to Create a workspace to work together.

(2) Create a profile

This tutorial uses the following profiles:

  • Dev profile

    This profile is used by developers in the development environment.

  • Production profile

    This profile is used by Ops engineers in the production environment.

For details about how to create profiles, refer to Creating a profile.

Note

Set the workspace name and profile name to be identical, because the profile name is used as the path for the storage (workspace).

The workspace name and profile name are case sensitive.

Developer

(1) Create an application

In this step, create an application to be used in both the development environment and production environment.

Create an application using the following steps:

Create a new application

  1. Select > APPLICATIONS > All.

  2. On the All page, select Add.

  3. In the step General, set the fields as shown below, and then select Next.

    Field name

    Setting (example)

    Name

    Create file list

    Description

    (Optional)

    Version

    0.0.1 (Appropriate version)

    Tags

    (Optional)

    Re-distribution policy

    On

  4. Select Add Trigger in the step Trigger Conditions.

  5. Set the fields as shown below.

    Field name

    Setting (example)

    Method

    Scheduler

    Trigger Name

    SCH01

    Script

    Create New

    = Remarks =

    You can also specify an existing script for Script.

  6. In the New Script dialog, set the fields as shown below, and then select OK.

    Field name

    Setting (example)

    Name

    Create file list script

    Template

    Empty Script

  7. In the step Trigger Conditions, select Edit Script from in Contained scripts and depended resources.

Create a new script

  1. In the Launch Designer dialog, set the fields as shown below, and then select Launch Designer.

    Field name

    Setting (example)

    Profile

    Dev

    Integrate service

    Select a HULFT Integrate service name.

  2. Right-click on the script name in the project explorer and select New > Script variable.

  3. Configure the settings on the New script variable screen as shown below.

  4. Open "Create file list script" from the project explorer.

  5. From the tool palette in Designer, drag File > CSV > Write CSV File onto the script canvas.

    Configure the Write CSV File operation as shown below.

    Field name

    Setting (example)

    File

    /${path}/List.csv

    Column list

    name

    size

    type

    updated

    = Remarks =
    • Add a column to the column list by selecting Add.

    • You can either enter the variable for the file path directly or select the variable from that is displayed after you select the text box.

  6. From the tool palette in Designer, drag File > File Operation > Get List of File Names onto the script canvas.

    Configure the Get List of File Names operation as shown below.

    Field name

    Setting (example)

    Directory path

    /${path}/

  7. From the tool palette, drag Basic > Processing > Assign Variables onto the script canvas.

  8. From the tool palette, drag Conversion > Basic > Mapping onto the script canvas.

  9. Link the component icons as follows:

  10. Double-click Assign Variables to open the mapping canvas, and map String > Basic > the Execution Profile logic to "path" under the output target.

    Use the Execution Profile logic, because the profile name is used as the path for the storage to output data. When you execute the script using the profile for either development or production, the execution profile name is assigned to the variable, and it becomes the storage path for that profile.

    Note

    Set the profile name and workspace name to be identical, because the profile name is used as the path for the storage (workspace).

    The profile name and workspace name are case sensitive.

  11. Go back to the script canvas, double-click the mapping to open the mapping canvas, and map the data of the input source and output target. Use Loop > Basic > Iterate specified node to repeat until the end of the data.

  12. Press Run script to confirm that the script works.

  13. Save the script and close Designer.

Complete the application settings

  1. Go back to the step Trigger Conditions on the All > Add page and select Next.

  2. In the step Test, set the fields as shown below, and then select Build.

    Field name

    Setting (example)

    Integrate service

    Select a HULFT Integrate service name.

    Profile

    Dev

  3. Select Test to perform test execution of the script.

  4. Once the test is successfully completed, select Next.

  5. In the step Summary, confirm that the settings are correct, and then select Finish.

(2) Deploy the application for development

With the following procedure, deploy the application for development.

  1. Select > APPLICATIONS > All.

  2. On the All page, select Detail for Create file list.

  3. Display the Dev tab in Profile and select Configure.

  4. Set the fields as shown below and select Test.

    Field name

    Setting (example)

    Integrate service

    Select a HULFT Integrate service name.

    Recurrence

    Minute

    Interval

    60

    Start time

    (Appropriate value)

    End time

    (Appropriate value)

    Start date

    Today (Appropriate date)

    End date

    Tomorrow (Appropriate date)

    Time zone

    (Appropriate value)

    Calendars

    (Optional)

  5. Once the test is successfully completed, select Apply.

  6. Select Deploy.

(3) View the execution results of the application for development

In this step, check the execution results of the application for development to make sure that the file list has been created in the storage for development.

Check the file list using the following procedure:

  1. Select > SERVICES > Storage.

  2. Display the Dev storage.

  3. Download List.csv and check the contents.

(4) Share the application

Share the application using the following procedure:

  1. Select > APPLICATIONS > All.

  2. On the All page, select Detail for Create file list.

  3. On the All > Create file list page, select Share from .

  4. Select OK in the Share Application dialog.

Once the script is successfully updated, the developer's work is complete.

Ops engineer

From here onward, an Ops engineer works on the production environment.

(1) Deploy the application for production

With the same procedure as Deploy the application for development, deploy the application using the Production profile.

(2) View the execution results of the application for production

With the same procedure as View the execution results of the application for development, check that List.csv has been created in the Production storage.

Even if you edit the original script, the deployed application is not affected.

To edit the script and apply it to the application, you must first undeploy the deployed application, press Configure, and then press Deploy.

This completes the procedure for switching the application settings between the development environment and production environment when executing an application.