Deprecating the job template feature (#2798)

* deprecating the job template feature

* removing the code

* format
This commit is contained in:
Cheick Keita
2023-02-08 11:21:03 -08:00
committed by GitHub
parent d732028201
commit f13f52ab71
3 changed files with 9 additions and 19 deletions

View File

@ -1,4 +1,4 @@
# Declarative Job Templates # Declarative Job Templates -- Deprecated
Provide the ability to maintain job templates, akin to `onefuzz template Provide the ability to maintain job templates, akin to `onefuzz template
libfuzzer basic` at the service level. The templates include a job libfuzzer basic` at the service level. The templates include a job
@ -94,7 +94,7 @@ TaskConfig(
## Hardcoded vs Runtime-specified Container Names ## Hardcoded vs Runtime-specified Container Names
To support differentiating _always use "afl-linux" for tools_ vs _ask To support differentiating _always use "afl-linux" for tools_ vs _ask
what container to use for setup_, if the container name is blank in the what container to use for setup_, if the container name is blank in the
template, it will be provided as part of the `JobTemplateConfig` and in the template, it will be provided as part of the `JobTemplateConfig` and in the
resulting `JobTemplateRequest`. resulting `JobTemplateRequest`.

View File

@ -1,4 +1,4 @@
# Managing Declarative Job Templates # Managing Declarative Job Templates -- Deprecated
[Declarative Job Templates](declarative-templates.md), currently a preview [Declarative Job Templates](declarative-templates.md), currently a preview
feature, allow a user to define a reusable fuzzing pipeline as a template. feature, allow a user to define a reusable fuzzing pipeline as a template.
@ -6,7 +6,7 @@ Once saved, any user of the OneFuzz instance can create fuzzing jobs based on
the templates. the templates.
This is a walk-through guide for updating an existing job template, though This is a walk-through guide for updating an existing job template, though
the process is similar for creating templates from scratch. the process is similar for creating templates from scratch.
This process demonstrates adding [Microsoft Teams This process demonstrates adding [Microsoft Teams
notifications](notifications/teams.md) for new unique crash reports to an existing notifications](notifications/teams.md) for new unique crash reports to an existing
@ -27,9 +27,9 @@ notifications](notifications/teams.md) for new unique crash reports to an existi
onefuzz job_templates manage get libfuzzer_linux > libfuzzer_linux.json onefuzz job_templates manage get libfuzzer_linux > libfuzzer_linux.json
``` ```
3. With your preferred text editor, add the following to the `notifications` list: 3. With your preferred text editor, add the following to the `notifications` list:
```json ```json
{ {
"container_type": "unique_reports", "container_type": "unique_reports",
"notification": { "notification": {
"config": { "config": {
"url": "https://contoso.com/webhook-url-here" "url": "https://contoso.com/webhook-url-here"
@ -120,7 +120,7 @@ Now let's make use of our new template.
"job_id": "d3259dfe-fdad-45a0-bf90-a381b8dc1ee8", "job_id": "d3259dfe-fdad-45a0-bf90-a381b8dc1ee8",
"state": "init" "state": "init"
} }
$ $
``` ```
3. Verify a notification was set up for the unique reports container 3. Verify a notification was set up for the unique reports container
``` ```
@ -160,7 +160,7 @@ This example will demonstrate setting the following:
onefuzz job_templates manage get libfuzzer_linux > libfuzzer_linux_ado_areapath.json onefuzz job_templates manage get libfuzzer_linux > libfuzzer_linux_ado_areapath.json
``` ```
3. With your preferred text editor, add the following to the `notifications` list: 3. With your preferred text editor, add the following to the `notifications` list:
```json ```json
{ {
"container_type": "unique_reports", "container_type": "unique_reports",
"notification": { "notification": {
@ -234,7 +234,7 @@ This example will demonstrate setting the following:
onefuzz job_templates refresh onefuzz job_templates refresh
``` ```
Using `--help`, we can see the new optional and required arguments. Using `--help`, we can see the new optional and required arguments.
``` ```
$ onefuzz job_templates submit libfuzzer_linux_ado_areapath --help $ onefuzz job_templates submit libfuzzer_linux_ado_areapath --help
usage: onefuzz job_templates submit libfuzzer_linux_ado_areapath [-h] [-v] [--format {json,raw}] [--query QUERY] usage: onefuzz job_templates submit libfuzzer_linux_ado_areapath [-h] [-v] [--format {json,raw}] [--query QUERY]

View File

@ -1794,9 +1794,6 @@ class Onefuzz:
self.instance_config = InstanceConfigCmd(self) self.instance_config = InstanceConfigCmd(self)
self.validate_scriban = ValidateScriban(self) self.validate_scriban = ValidateScriban(self)
if self._backend.is_feature_enabled(PreviewFeature.job_templates.name):
self.job_templates = JobTemplates(self)
# these are externally developed cli modules # these are externally developed cli modules
self.template = Template(self, self.logger) self.template = Template(self, self.logger)
self.debug = Debug(self, self.logger) self.debug = Debug(self, self.logger)
@ -1830,9 +1827,6 @@ class Onefuzz:
if tenant_domain is not None: if tenant_domain is not None:
self._backend.config.tenant_domain = tenant_domain self._backend.config.tenant_domain = tenant_domain
if self._backend.is_feature_enabled(PreviewFeature.job_templates.name):
self.job_templates._load_cache()
def licenses(self) -> object: def licenses(self) -> object:
"""Return third-party licenses used by this package""" """Return third-party licenses used by this package"""
data = pkgutil.get_data("onefuzz", "data/licenses.json") data = pkgutil.get_data("onefuzz", "data/licenses.json")
@ -1860,9 +1854,6 @@ class Onefuzz:
# actuates the login process # actuates the login process
self.info.get() self.info.get()
# TODO: once job templates are out of preview, this should be enabled
if self._backend.is_feature_enabled(PreviewFeature.job_templates.name):
self.job_templates.refresh()
return "succeeded" return "succeeded"
def config( def config(
@ -1922,6 +1913,5 @@ class Onefuzz:
from .debug import Debug # noqa: E402 from .debug import Debug # noqa: E402
from .job_templates.main import JobTemplates # noqa: E402
from .status.cmd import Status # noqa: E402 from .status.cmd import Status # noqa: E402
from .template import Template # noqa: E402 from .template import Template # noqa: E402