From 7c77edc530d165a9c2d533265b81bbbc3072d801 Mon Sep 17 00:00:00 2001 From: Phil Renaud Date: Wed, 8 Nov 2023 15:28:39 -0500 Subject: [PATCH] Nicer comment styles in example jobs --- .changelog/19037.txt | 3 ++ ui/app/utils/default_jobs/hello-world.js | 44 +++++++++---------- ui/app/utils/default_jobs/parameterized.js | 12 ++--- .../utils/default_jobs/service-discovery.js | 8 ++-- ui/app/utils/default_jobs/variables.js | 16 +++---- 5 files changed, 43 insertions(+), 40 deletions(-) create mode 100644 .changelog/19037.txt diff --git a/.changelog/19037.txt b/.changelog/19037.txt new file mode 100644 index 00000000000..8670f1d6359 --- /dev/null +++ b/.changelog/19037.txt @@ -0,0 +1,3 @@ +```release-note:improvement +ui: nicer comment styles in UI example jobs +``` diff --git a/ui/app/utils/default_jobs/hello-world.js b/ui/app/utils/default_jobs/hello-world.js index 1c7d95a21b5..ee5fd16bdab 100644 --- a/ui/app/utils/default_jobs/hello-world.js +++ b/ui/app/utils/default_jobs/hello-world.js @@ -4,24 +4,24 @@ */ export default `job "hello-world" { - // Specifies the datacenter where this job should be run - // This can be omitted and it will default to ["*"] + # Specifies the datacenter where this job should be run + # This can be omitted and it will default to ["*"] datacenters = ["*"] meta { - // User-defined key/value pairs that can be used in your jobs. - // You can also use this meta block within Group and Task levels. + # User-defined key/value pairs that can be used in your jobs. + # You can also use this meta block within Group and Task levels. foo = "bar" } - // A group defines a series of tasks that should be co-located - // on the same client (host). All tasks within a group will be - // placed on the same host. + # A group defines a series of tasks that should be co-located + # on the same client (host). All tasks within a group will be + # placed on the same host. group "servers" { - // Specifies the number of instances of this group that should be running. - // Use this to scale or parallelize your job. - // This can be omitted and it will default to 1. + # Specifies the number of instances of this group that should be running. + # Use this to scale or parallelize your job. + # This can be omitted and it will default to 1. count = 1 network { @@ -35,9 +35,9 @@ export default `job "hello-world" { port = "www" } - // Tasks are individual units of work that are run by Nomad. + # Tasks are individual units of work that are run by Nomad. task "web" { - // This particular task starts a simple web server within a Docker container + # This particular task starts a simple web server within a Docker container driver = "docker" config { @@ -48,20 +48,20 @@ export default `job "hello-world" { } template { - data = <Hello, Nomad! - + data = <<-EOF +

Hello, Nomad!

+ EOF destination = "local/index.html" } - // Specify the maximum resources required to run the task + # Specify the maximum resources required to run the task resources { cpu = 50 memory = 64 diff --git a/ui/app/utils/default_jobs/parameterized.js b/ui/app/utils/default_jobs/parameterized.js index 7225de78081..c3c09f32ed3 100644 --- a/ui/app/utils/default_jobs/parameterized.js +++ b/ui/app/utils/default_jobs/parameterized.js @@ -4,22 +4,22 @@ */ export default `job "parameterized-job" { - // Specifies the datacenter where this job should be run - // This can be omitted and it will default to ["*"] + # Specifies the datacenter where this job should be run + # This can be omitted and it will default to ["*"] datacenters = ["*"] - // Unlike service jobs, Batch jobs are intended to run until they exit successfully. + # Unlike service jobs, Batch jobs are intended to run until they exit successfully. type = "batch" - // Run the job only on Linux or MacOS. + # Run the job only on Linux or MacOS. constraint { attribute = "\${attr.kernel.name}" operator = "set_contains_any" value = "darwin,linux" } - // Allow the job to be parameterized, and allow any meta key with - // a name starting with "i" to be specified. + # Allow the job to be parameterized, and allow any meta key with + # a name starting with "i" to be specified. parameterized { meta_optional = ["MY_META_KEY"] } diff --git a/ui/app/utils/default_jobs/service-discovery.js b/ui/app/utils/default_jobs/service-discovery.js index b533d3f8952..614da80e0ab 100644 --- a/ui/app/utils/default_jobs/service-discovery.js +++ b/ui/app/utils/default_jobs/service-discovery.js @@ -4,8 +4,8 @@ */ export default `job "service-discovery-example" { - // Specifies the datacenter where this job should be run - // This can be omitted and it will default to ["*"] + # Specifies the datacenter where this job should be run + # This can be omitted and it will default to ["*"] datacenters = ["*"] group "client" { @@ -53,8 +53,8 @@ EOF name = "nomad-service-discovery-example-server" provider = "nomad" port = "www" - // If you're running Nomad in dev mode, uncomment the following address_mode line to allow this service to be discovered - // address_mode = "driver" + # If you're running Nomad in dev mode, uncomment the following address_mode line to allow this service to be discovered + # address_mode = "driver" check { type = "http" diff --git a/ui/app/utils/default_jobs/variables.js b/ui/app/utils/default_jobs/variables.js index 4e93051a07b..7db9c8f1097 100644 --- a/ui/app/utils/default_jobs/variables.js +++ b/ui/app/utils/default_jobs/variables.js @@ -4,19 +4,19 @@ */ /* eslint-disable */ -export default `// Use Nomad Variables to modify this job's output: -// run "nomad var put nomad/jobs/variables-example name=YOUR_NAME" to get started +export default `# Use Nomad Variables to modify this job's output: +# run "nomad var put nomad/jobs/variables-example name=YOUR_NAME" to get started job "variables-example" { - // Specifies the datacenter where this job should be run - // This can be omitted and it will default to ["*"] + # Specifies the datacenter where this job should be run + # This can be omitted and it will default to ["*"] datacenters = ["*"] group "web" { network { - // Task group will have an isolated network namespace with - // an interface that is bridged with the host + # Task group will have an isolated network namespace with + # an interface that is bridged with the host port "www" { to = 8001 } @@ -38,8 +38,8 @@ job "variables-example" { ports = ["www"] } - // Create a template resource that will be used to render the html file - // using the Nomad variable at "nomad/jobs/variables-example" + # Create a template resource that will be used to render the html file + # using the Nomad variable at "nomad/jobs/variables-example" template { data = "hello, {{ with nomadVar \\" nomad/jobs/variables-example \\" }}{{ .name }}{{ end }}" destination = "local/index.html"