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

[ui] example job with actions #19153

Merged
merged 4 commits into from
Dec 4, 2023
Merged

Conversation

philrenaud
Copy link
Contributor

@philrenaud philrenaud commented Nov 22, 2023

An example job in the UI templates to show off actions and how they work.

image image image

Copy link

github-actions bot commented Nov 22, 2023

Ember Test Audit comparison

main d84df43 change
passes 1540 1540 0
failures 0 0 0
flaky 0 0 0
duration 10m 52s 673ms 11m 02s 009ms +09s 336ms

Copy link
Contributor

@lgfa29 lgfa29 left a comment

Choose a reason for hiding this comment

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

I'm a bit on the fence about the last action. While cool, the awk script is quite complex and I think a bit distracting for the purpose of the job.

If you want to curl something Nomad related you could add some ASCII art to https://github.com/hashicorp/nomad/tree/main/website/public/data

Base automatically changed from 19066-actions-service-sidebar to main November 27, 2023 04:46
@philrenaud
Copy link
Contributor Author

Note: used roughly this example job for the tutorial proposed at https://github.com/hashicorp/tutorials/pull/1814

Copy link
Contributor

@lgfa29 lgfa29 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-picks but LGTM!

image = "redis:3.2"
ports = ["db"]
command = "/bin/sh"
args = ["-c", "redis-server --port \${NOMAD_PORT_db} & /local/db_log.sh"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Like above, we can probably use port mapping to keep this a bit cleaner and avoid the extra args, but if you want to use dynamic ports something like this would be a bit easier to understand?

job "example" {
  group "cache" {
    network {
      port "db" {}
    }

    task "redis" {
      driver = "docker"

      config {
        image   = "redis:7"
        ports   = ["db"]
        args    = ["/etc/redis/redis.conf"]
        volumes = ["local/conf:/etc/redis"]
      }

      template {
        data        = <<EOF
port {{env "NOMAD_PORT_db"}}
EOF
        destination = "local/conf/redis.conf"
      }
    }
  }
}

Then the redis-cli -p \${NOMAD_PORT_db} DBSIZE command in db_log.sh could be another action?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I realize it's not practical or desired for a real-world redis server on Nomad, but it seemed cool to illustrate db size output live when you make edits via action.

In the (pending) actions tutorial (PR), I hoped this would be something easily demonstrable to a user.

@philrenaud philrenaud force-pushed the f-ui/example-job-action-block branch from 05090ca to d84df43 Compare December 4, 2023 18:21
@philrenaud philrenaud merged commit 646445d into main Dec 4, 2023
@philrenaud philrenaud deleted the f-ui/example-job-action-block branch December 4, 2023 18:40
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/1.7.x backport to 1.7.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants