vania-janet/multiturn-rag-retrieval-data huggingface dataset:
You can roll out feature flags to one or more target segments. You can set different flag values for different segments, if needed.



1. From the App Configuration console, go to Feature flags. This pane displays the list of feature flags available in the current environment of the App Configuration service instance.
2. Click Add targeting in the required feature flag row to display the Target flag to segments side-panel.

Zoom

![Target flag to segments](https://cloud.ibm.com/docs-content/v1/content/f3dada89f147af3b88388a2218ddbf64b3c41e5f/app-configuration/images/ac-feature-flag-to-segments.png)

Figure 6. Target feature flag to segments
3. The Feature rollout displays the default Rollout percentage slider define when creating the feature flag. Modify the rollout percentage value, if required.
4. In the Rules section, define the rule by specifying the following:



* In the Rollout percentage, you can define the value as an Override or Inherit from default. If the Override option is selected, then specify the Rollout percentage override value by using the slider.
* Select Segments from the list. If no segments are available to target, click Create segment. For more information about creating a segment, see [Create a segment](https://cloud.ibm.com/docs/app-configuration?topic=app-configuration-ac-segmentsac-create-segment).
* For the Enabled value, you can select Override and modify the value or select Inherit from flag.
* Click to Save rule



You can define more rules by clicking Add rule.
5. Click Add targeting.



If you try to target a feature flag that is not linked to a collection, a window is displayed to add a feature flag to a collection.





 Enabling a feature flag 

After you target a feature flag to a segment, click the toggle (ON/OFF) to enable or disable a feature flag.
Required field - input either as a flag or from file.

--disabled_value DISABLED_VALUE
: Value of the feature when it is disabled. Required field - input either as a flag or from file.

--tags TAGS
: Tags associated with the feature. Required field - input either as a flag or from file.

--enabled ENABLED
: The state of the feature flag.

--segment_rules SEGMENT_RULES
: Specify the targeting rules that are used to set different values for different segments.

--collections COLLECTIONS
: Collections array.

--file FILE
: Input through the file. File format Supported - JSON.





 Example 

To update description a feature with ID ibm-discount using flags ([click here](https://cloud.ibm.com/docs/app-configuration-cli-plugin?topic=app-configuration-cli-plugin-app-configuration-cliac-fileinput) for using commands with '--file' flag), run the following command:

ibmcloud ac feature update --environment_id "production" --name "Indian IBMers" --feature_id "ibm-discount" --description "Discount given to IBM Indian employees" --enabled_value true --disabled_value false --segment_rules '[{"rules":{"segments":"ibm_employees"]}],"value": true,"order": 1}]' --collections '[{"collection_id":"corporatediscount","enabled": true}]' --tags "discount,sale" --enabled true



 Output 

The command returns the following output:

updated_time 2021-02-02T18:06:03Z
description Discount given to IBM Indian employees
enabled_value true
disabled_value false
segment_rules <Array>
created_time 2021-02-02T17:52:46Z
name Indian IBMers
type BOOLEAN
enabled true
collections <Array>









 ibmcloud ac feature update-values
Re-create the Machine Catalog.<-- </section "id="section-troubleshooting-snapshot" "> --><-- <section "id="section-troubleshooting-functions" "> --> After multiple apply attempts for Volume Worker, Schematics shows an IBM Cloud Functions error After selecting Apply Plan more than once, you get an error similar to this: 2022/07/19 14:23:30 Terraform apply | Error: ERROR] Error creating IBM Cloud Function Action: The request content was malformed:
2022/07/19 14:23:30 Terraform apply | 'kind' must be a string defined in 'exec' (code 2992d8a65102f19991000a2c66a52b18)
2022/07/19 14:23:30 Terraform apply 
2022/07/19 14:23:30 Terraform apply | with module.volume_worker0] ! ! ! !
Why can't Code Engine pull an image? 

 What’s happening 

When you deploy a Code Engine app or run a job, you receive an error message that contains Unable to pull the image.

 Why it’s happening 

To troubleshoot this problem, confirm that the image exists and that you have access to the image. Check that the following conditions are met.



* To confirm that the image for your app or job exists, review the error message for information about the failure.
* To deploy applications or run jobs in Code Engine, you need to first create a container image that has all the runtime artifacts your application needs to run, such as runtime libraries. You can use many different methods to [create the container image](https://cloud.ibm.com/docs/codeengine?topic=codeengine-build-image), including building your app from source code by using the build container images feature available in Code Engine. Your image can be downloaded from either a public or private image registry. For more information about accessing private registries, see [Adding access to a private container registry](https://cloud.ibm.com/docs/codeengine?topic=codeengine-add-registry).
* If you use the [ibmcloud ce app create](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-application-create), [ibmcloud ce job create](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-job-create), or [ibmcloud ce jobrun submit](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-jobrun-submit) command in the Code Engine CLI, specify the name of the image that is used for your application or job by using the format REGISTRY/NAMESPACE/REPOSITORY:TAG where REGISTRY and TAG are optional. If REGISTRY is not specified, the default is docker.io. If TAG is not specified, the default is latest. Review these commands for more information about the format to use to specify the image registry.



 How to fix it
Why can't I submit a job run with the CLI? 

 What’s happening 

You cannot submit a job run with the CLI.

When you run the ibmcloud ce jobrun submit command, you receive the following error message:

Submitting job run 'JOB_NAME'...
FAILED
Failed to create job run

 Why it’s happening 

If you cannot submit a job run, determine whether one of the following cases is true.



1. The name of your job run is not unique within the project.
2. If you reference a job and the job doesn't exist, the job run is not submitted and an error occurs.
3. When you submit a job run with the jobrun submit command and you reference a job and you also specify an image on this command that is different from the image that is specified in the job, the job run is not submitted and an error occurs.
4. The job run resource size exceeds the maximum size, which is 10 KiB.



 How to fix it 

Try one of these solutions.



1. Use the [ibmcloud ce jobrun list](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-jobrun-list) command to list all defined job runs and check whether a job run with the same name exists. If a job run with the same name exists, use the ibmcloud ce jobrun delete --name JOBRUN_NAME command to delete the old job run. The name of the job run must be unique within your project. You cannot submit a job run with the same job run name again.
2. Use the [ibmcloud ce jobrun list](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-jobrun-list) command to list all defined jobs and confirm that you are referencing a defined job.
3. The image that is defined in your job cannot be overwritten by specifying a different image value when you submit a job run that refers to your job.
To create an step condition based on the HTTP status code, follow these steps:



1. For the value you want to test, click Expression.
2. In the expression field, type a dollar sign ($) to show the list of available variables.
3. Select any variable that is a response value from the extension. (It doesn't matter which variable you select, as long as it is an extension response variable).

The expression is automatically updated to show a reference to the variable you selected, in the format ${step_xxx_result_y.body.variablename}. For example, if you selected a response variable called body.id, the reference might be ${step_596_result_1.body.id}.
4. Inside the curly braces, ({}), edit this reference to remove .body.variablename. You should be left with something like ${step_596_result_1}.
5. After the closing curly brace (}), add .status. The resulting reference identifies the status code returned from the call to the extension (for example, ${step_596_result_1}.status).

For more information about writing expressions, see [Writing expressions](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-expressions).
6. Complete the expression by adding an operator and a comparison value, so the expression evaluates to a Boolean (true/false) value. For example, the following expression tests for HTTP status 408, which indicates a timeout error:

${step_549_result_1}.status==408







 Debugging failures 

If your calls to an extension are failing, you might want to debug the problem by seeing detailed information about what is being sent to and returned from the external API. To do this, you can use the extension inspector in the Preview pane:



1. On the Actions page, or in the action editor, click Preview to open the Preview pane.

You cannot access the extension inspector from the assistant preview on the Preview page, which shows only what a customer would see.
If your code is in a private repo, use an SSH URL for the code repo URL and either select the name of an existing code repo access or [create a code repo access](https://cloud.ibm.com/docs/codeengine?topic=codeengine-code-repositories). An example of an SSH URL is git@github.com:IBM/CodeEngine.git. Optionally, select a source branch name. If you do not provide a branch name and you leave the field empty, Code Engine automatically uses the default branch of the specified repository. You can enter any other branch name, tag, or commit ID. Click Next to continue.
6. In the Strategy section, select the [strategy](https://cloud.ibm.com/docs/codeengine?topic=codeengine-plan-buildbuild-strategy) that you want to use. If you select Dockerfile, you can also specify an alternative path for your Dockerfile. Select the size of your build under Build resources. Click Next to advance to the section to specify build output details.
7. In the Output section, enter the details of your container image. Select an existing registry access secret, or click Create registry access secret to add a new one. If you are building your image to a Container Registry instance that is in your account, you can select Code Engine managed secret and let Code Engine create and manage the secret for you. Then, select the namespace, repository, and tag of the image you want to build. You can choose to let Code Engine create and manage the namespace in Container Registry for you. If your image exists in Container Registry, you can select from the existing images, or enter a new repository or tag.
8. Click Done to finish the creation of the build.



After you create the build, you must [run the build](https://cloud.ibm.com/docs/codeengine?topic=codeengine-build-imagebuild-run).





 Creating a build configuration with the CLI (public repo)
This is an optional parameter if the feature flag is not configured with any targeting definition. If the targeting is configured, then entityAttributes should be provided for the rule evaluation. An attribute is a parameter that is used to define a segment. The SDK uses the attribute values to determine if the specified entity satisfies the targeting rules, and returns the appropriate feature flag value.







 Get single property 

const property = client.getProperty('property_id')

if(property) {
console.log('data', property);
console.log(Property Name ${property.getPropertyName()});
console.log(Property Id ${property.getPropertyId()});
console.log(Property Type ${property.getPropertyDataType()});
}





 Get all properties 

const properties = client.getProperties();

const property = properties["property_id"];

if(property) {
console.log(Property Name ${property.getPropertyName()});
console.log(Property Id ${property.getPropertyId()});
console.log(Property Type ${property.getPropertyDataType()});
}





 Evaluate a property 

Use the property.getCurrentValue(entityId, entityAttributes) method to evaluate the value of the property. This method returns the default property value or its overridden value based on the evaluation. The data type of returned value matches that of property.

const entityId = 'john_doe';
const entityAttributes = {
city: 'Bangalore',
country: 'India',
};

const propertyValue = property.getCurrentValue(entityId, entityAttributes);

Where:



* entityId: Id of the Entity. This will be a string identifier related to the Entity against which the property is evaluated. For any entity to interact with App Configuration, it must provide a unique entity ID.
If the build and push step failure problem isn't a problem with memory, a container registry secret, or a Dockerfile, then the problem is likely with the Docker build. The problem might be an error in the Dockerfile itself, for example, a syntax error, or in the correctness of the operation that it performs. The problem can also be in your source code, which might fail to compile, for example, if Java® code is included.

If you successfully built your project locally, but the same source code does not build in Code Engine, then you might have files available locally that are not in your Git repository. For example, for Node.js projects, it is common to run the npm install command locally so that project dependencies are downloaded and placed in the node_modules directory inside the project directory. It is a good practice to include the node_modules directory in the [.gitignore file](https://git-scm.com/docs/gitignore) to keep your Git repository small. A common mistake is to forget to also run npm install (or npm ci) in the Dockerfile. A Docker build that you run locally can access the local node_modules directory, if you copy the whole project into the container, for example, by using the COPY . /app command in the Dockerfile. But, the Code Engine build runs from a freshly checked-out Git repository and cannot access the node_modules directory. Therefore, you must run npm install (or npm ci) in the Dockerfile as part of the build.

A good practice is to include directories like node_modules also in a [.dockerignore file](https://docs.docker.com/engine/reference/builder/dockerignore-file) so that the Docker build that you run locally behaves the same as the Code Engine build.

Another reason for a project to be successfully built locally but to fail as Code Engine build are security limitations. As with applications and batch jobs, Code Engine does not allow arbitrary system operations within the Code Engine cluster. Most of those system operations are not relevant for Docker builds anyway.
How can you find the root cause of why Schematics apply is failing? 

  What’s happening 

You want to apply a Terraform template in IBM Cloud that runs scripts on a target resource. To run the script, you use the Terraform null_resource in your configuration file. However, when you run the Schematics apply action, the action fails and you receive an error message that can include internal, timeout, connection, or input errors.

  Why it’s happening 

When Schematics tries to run your script on the target resource, a script error occurs during the execution. Because Schematics cannot resolve errors that occur in user-provided scripts, the apply action is marked as failed.

  How to fix it 

To troubleshoot the error in the script, follow these steps:



1.  From the workspace Activity page, select the Schematics apply action that failed.
2.  Click Jobs to see the detailed log output.
3.  In the log file, find the last action that Schematics started before the error occurs. For example, in the following log output, Schematics tried to run a copy script in the instances_module module by using the Terraform null_resource.

2021/05/24 05:03:41 Terraform apply | module.instances_module.module.compute_remote_copy_rpms.null_resource.remote_copy[0]: Still creating... [5m0s elapsed]
2021/05/24 05:03:41 Terraform apply 
2021/05/24 05:03:42 Terraform apply 
2021/05/24 05:03:42 Terraform apply 
2021/05/24 05:03:42 Terraform apply | Error: timeout - last error: ssh: rejected: connect failed (Connection timed out)
4.  Find the script that is ran in the Terraform null_resource and analyze where the error might come from by using the error message from the Schematics log output.
5.  If you cannot resolve the error, contact the script owner to further troubleshoot the error.
}
}





 Get all features 

const features = appConfigClient.getFeatures();
const feature = features['feature_id'];

if (feature !== null) {
console.log(Feature Name ${feature.getFeatureName()} );
console.log(Feature Id ${feature.getFeatureId()} );
console.log(Feature Type ${feature.getFeatureDataType()} );
console.log(Is feature enabled? ${feature.isEnabled()} );
}





 Feature evaluation 

You can use the feature.getCurrentValue(entityId, entityAttributes) method to evaluate the value of the feature flag. This method returns a JSON object containing evaluated value, feature flag enabled status and evaluation details.

const entityId = '<entityId>';
const entityAttributes = {
city: 'Bangalore',
country: 'India',
};

const result = feature.getCurrentValue(entityId, entityAttributes);
console.log(result.value); // Evaluated value of the feature flag. The type of evaluated value will match the type of feature flag (Boolean, String, Numeric).
console.log(result.isEnabled); // enabled status.
console.log(result.details); // a JSON object containing detailed information of the evaluation. See below

// the result.details will have the following
console.log(result.details.valueType); // a string value. Example: DISABLED_VALUE
console.log(result.details.reason); // a string value. Example: Disabled value of the feature flag since the feature flag is disabled.
console.log(result.details.segmentName); // (only if applicable, else it is undefined) a string value containing the segment name for which the feature flag was evaluated.
ibmcloud ac feature update-values {--file FILE-PATH | --environment_id ENVIRONMENT_ID --name NAME --feature_id FEATURE_ID --description DESCRIPTION --enabled_value ENABLED_VALUE --disabled_value DISABLED_VALUE --tags TAGS --segment_rules SEGMENT_RULES}



 Command options 

--environment_id ENVIRONMENT_ID
: Environment ID

--name NAME
: Feature name. Required field - input either as a flag or from file.

--feature_id FEATURE_ID
: Feature ID. Required field - input either as a flag or from file.

--description DESCRIPTION
: Description of the feature. Required field - input either as a flag or from file.

--enabled_value ENABLED_VALUE
: Value of the feature when it is enabled. Required field - input either as a flag or from file.

--disabled_value DISABLED_VALUE
: Value of the feature when it is unavailable. Required field - input either as a flag or from file.

--tags TAGS
: Tags associated with the feature. Required field - input either as a flag or from file.

--segment_rules SEGMENT_RULES
: Specify the targeting rules that are used to set different values for different segments.

--file FILE
: Input through the file. File format Supported - JSON





 Example 

To update description a feature with ID ibm-discount using flags ([click here](https://cloud.ibm.com/docs/cli?topic=cli-app-configuration-cliac-fileinput) for using commands with '--file' flag), run the following command:

ibmcloud ac feature update-values --environment_id "production" --name "Indian IBMers" --feature_id "ibm-discount" --description "Discount given to IBM Indian employees" --enabled_value true --disabled_value false --segment_rules '[{"rules":{"segments":"ibm_employees"]}],"value": true,"order": 1}]' --tags "discount,sale"



 Output
See [create a configmap](https://cloud.ibm.com/docs/codeengine?topic=codeengine-configmap-create-ui).

From the console, you can reference only one individual key of a defined configmap per environment variable. If you need to reference more than one key of a configmap, then repeat the steps to define another environment variable that references a different key.



1. To reference a defined configmap from your app or job, [create an environment variable](https://cloud.ibm.com/docs/codeengine?topic=codeengine-envvarenvvar-create-ui). The environment variable can fully reference an existing configmap or reference an individual key in an existing configmap. For example, let's fully reference the myconfigmap configmap from the myapp application. When you fully reference a configmap (or secret), you can optionally specify a prefix. By using a prefix such as myconfigmap_, each key is prefixed with myconfigmap_.
2. After you create environment variables, you must restart your app or job for the changes to take effect. For apps, save and deploy your app to update the app with the environment variables that you defined. For jobs, submit your job to update the job with the environment variables that you defined.
3. After the application status changes to Ready, you can test the application. Click Test application and then click Send request in the Test application pane. To open the application in a web page, click Application URL. In this myapp example, because we specified a prefix for the fully referenced myconfigmap configmap, all the keys of this configmap are referenced as environment variables and are prefixed with myconfigmap_. For example, these environment variables display as myconfigmap_key1=value1 and myconfigmap_key2=value2.
appConfiguration.SetContext(collectionId, environmentId, AppConfiguration.ContextOptions{
BootstrapFile: "saflights/flights.json",
LiveConfigUpdateEnabled: false,
})

Where,



* BootstrapFile: Absolute path of the JSON file, which contains configuration details. Make sure to provide a proper JSON file. You can generate this file by using ibmcloud ac config command of the IBM Cloud App Configuration CLI.
* LiveConfigUpdateEnabled: Live configuration update from the server. Set this value to false if the new configuration values must not be fetched from the server. By default, this value is enabled.







 Examples for using property and feature-related APIs 

Refer to the listed examples for using the property and feature-related APIs.



 Get single feature 

feature, err := appConfigClient.GetFeature("online-check-in")
if err == nil {
fmt.Println("Feature Name", feature.GetFeatureName())
fmt.Println("Feature Id", feature.GetFeatureID())
fmt.Println("Feature Type", feature.GetFeatureDataType())

if (feature.IsEnabled()) {
// feature flag is enabled
} else {
// feature flag is disabled
}
}





 Get all features 

features, err := appConfigClient.GetFeatures()
if err == nil {
feature := features["online-check-in"]

fmt.Println("Feature Name", feature.GetFeatureName())
fmt.Println("Feature Id", feature.GetFeatureID())
fmt.Println("Feature Type", feature.GetFeatureDataType())
fmt.Println("Is feature enabled?", feature.IsEnabled())
}





 Feature evaluation