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 IsDisabled property to worker description and skip if the value is True #10231

Merged
merged 5 commits into from
Jun 19, 2024

Conversation

kshyju
Copy link
Member

@kshyju kshyju commented Jun 13, 2024

Fixes #9932

Adding IsDisabled property to worker description. This allows language workers to enable/disable a worker based on profile conditions. This is an optional property. If not provided, the worker will not be skipped.

Here is a sample worker config which takes advantage of this property.

{
  "description": {
    "language": "bar"
  },
  "profiles": [
    {
      "profileName": "SpecificConditionProfile",
      "conditions": [
        {
          "conditionType": "environment",
          "conditionName": "NON_EXISTING_ENV_VAR",
          "conditionExpression": "(?i)true$"
        }
      ],
      "description": {
        "defaultExecutablePath": "%FUNCTIONS_WORKER_DIRECTORY%/2.bat",
        "defaultWorkerPath": "2.bat"
      }
    },
    {
      "profileName": "FallbackProfileToDisableWorker",
      "conditions": [
        {
          "conditionType": "environment",
          "conditionName": "EXISTING_ENV_VAR",
          "conditionExpression": "(?i)true$"
        }
      ],
      "description": {
        "defaultExecutablePath": "%FUNCTIONS_WORKER_DIRECTORY%/2.bat",
        "defaultWorkerPath": "2.bat",
        "isDisabled": true
      }
    }
  ]
}

Pull request checklist

IMPORTANT: Currently, changes must be backported to the in-proc branch to be included in Core Tools and non-Flex deployments.

Additional information

Additional PR information

@kshyju kshyju requested a review from a team as a code owner June 13, 2024 23:03
Copy link
Member

@fabiocav fabiocav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submitting some minor comments, but also had a design sync with @kshyju

@kshyju kshyju changed the title Skip Worker Descriptions with Unmet Profile Conditions Add IsDisabled property to worker description and skip if the value is True Jun 15, 2024
@kshyju
Copy link
Member Author

kshyju commented Jun 15, 2024

Submitting some minor comments, but also had a design sync with @kshyju

After syncing with fabio, I pushed an iteration where I changed the property to a more generic IsDisabled property which profiles can override. If the property value is True, that profile will be skipped.

@kshyju kshyju requested a review from fabiocav June 15, 2024 00:04
Copy link
Member

@fabiocav fabiocav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit comment, but the change looks good!

@kshyju kshyju merged commit c0219e6 into dev Jun 19, 2024
14 checks passed
@kshyju kshyju deleted the shkr/gh-9932-skip-profile branch June 19, 2024 00:25
kshyju added a commit that referenced this pull request Jun 25, 2024
… is True (#10231)

* Adding support to skip a worker description when none of the profile conditions are met.

* Adding release notes.

* Changes to switch to "IsDisabled" property on worker description.

* missed a file
kshyju added a commit that referenced this pull request Jun 27, 2024
… is True (#10231) (#10250)

* Adding support to skip a worker description when none of the profile conditions are met.

* Adding release notes.

* Changes to switch to "IsDisabled" property on worker description.

* missed a file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WorkerDescription creation should skip the worker config if profile evaluation fails
3 participants