<commit_before>---
layout: single
title:  "Run Job (Manifest)"
sidebar:
  nav: guides
---

The `Run Job (Manifest)` stage can be used to execute a Kubernetes Job as part of your pipeline. This stage will deploy a `Job` manifest and wait until it completes, allowing you to gate your pipeline's continuation on the job's success or failure.

For example use cases, check out [this post](https://blog.spinnaker.io/extending-spinnaker-with-kubernetes-and-containers-5d16ec810d81) on the Spinnaker blog!

## Viewing execution logs

As with any job runner, logs are the primary form of feedback and it's important that viewing them is a first-class experience within Spinnaker. Since users of Spinnaker are all at various stages of Kubernetes adoption we've provided 2 ways to view logs within Spinnaker.


### Link to external system

Most Kubernetes deployments will have some utility for forwarding logs from containers and into external systems for log analysis. If you're using one of these platforms, you can configure your `Job` with the annotation `job.spinnaker.io/logs` and a templated URL to your logging system. This value of this annotation will be used to render a link in the UI. 

To make it easier to pinpoint the specific job, the annotation value can be templated with values from the deployed `Job` manifest. To use templates, use `{{ "{{ templateKey "}} }}` where `templateKey` is the path to the value you wish to use. The deployed manifest will be passed into the template as JSON. This functionality mirrors that of the [Annotation Driven UI](/guides/user/kubernetes-v2/annotations-ui/).

For example, if your `Job` is deployed with name `myjob-12345`, the annotation...

```
job.spinnaker.io/logs: 'https://internal-logging/jobs/{{ "{{ metadata.name "}}}}'
```

...will result in the value

```<commit_msg>fix(docs): Incorrect path in the manifest logs metadata value (#1462)<commit_after>---
layout: single
title:  "Run Job (Manifest)"
sidebar:
  nav: guides
---

The `Run Job (Manifest)` stage can be used to execute a Kubernetes Job as part of your pipeline. This stage will deploy a `Job` manifest and wait until it completes, allowing you to gate your pipeline's continuation on the job's success or failure.

For example use cases, check out [this post](https://blog.spinnaker.io/extending-spinnaker-with-kubernetes-and-containers-5d16ec810d81) on the Spinnaker blog!

## Viewing execution logs

As with any job runner, logs are the primary form of feedback and it's important that viewing them is a first-class experience within Spinnaker. Since users of Spinnaker are all at various stages of Kubernetes adoption we've provided 2 ways to view logs within Spinnaker.


### Link to external system

Most Kubernetes deployments will have some utility for forwarding logs from containers and into external systems for log analysis. If you're using one of these platforms, you can configure your `Job` with the annotation `job.spinnaker.io/logs` and a templated URL to your logging system. This value of this annotation will be used to render a link in the UI. 

To make it easier to pinpoint the specific job, the annotation value can be templated with values from the deployed `Job` manifest. To use templates, use `{{ "{{ templateKey "}} }}` where `templateKey` is the path to the value you wish to use. The deployed manifest will be passed into the template as JSON. This functionality mirrors that of the [Annotation Driven UI](/guides/user/kubernetes-v2/annotations-ui/).

For example, if your `Job` is deployed with name `myjob-12345`, the annotation...

```
job.spinnaker.io/logs: 'https://internal-logging/jobs/{{ "{{ manifest.metadata.name "}}}}'
```

...will result in the value

```
{'fraction_non_alphanumeric': 0.08097928436911488, 'fraction_numerical': 0.009147161689534571, 'mean_word_length': 4.443631039531478, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5825604', 'n_tokens_mistral': 1020, 'n_tokens_neox': 956, 'n_words': 517}