# Ozone Backstage Plugin

## ozone

Welcome to the ozone plugin!

### Setup

1. Generate the service account token

   Create a role for your service account with the following permissions

   * `Applications.List`
   * `Applications.Get`
   * `Pipelines.List`
   * `Pipelines.Get`
   * `Pipelines.Execute`
   * `Releases.List`
   * `Releases.Get`
   * `Releases.Execute`
   * `PipelineRun.List`
   * `PipelineRun.Get`
   * `ReleaseRun.List`
   * `ReleaseRun.Get`
   * `Registries.List`
   * `Registries.Get`
   * `Repositories.List`
   * `Repositories.Get`

<figure><img src="/files/fMT1vdZwuHP9NYTfrTP0" alt=""><figcaption><p><em>Create Role</em></p></figcaption></figure>

Create a Service Account token From the ozone website, click on the `Account Management` on the sidebar and navigate to the `Service Account token` tab, Click on the `Create Service Account` button and choose the above created role, this will create a token. ![Screenshot 2023-06-12 at 12 34 17 PM](https://github.com/OzoneCloud/ozone-backstage/assets/13351472/eb59dab3-64d4-4bfe-b11d-01dc444e7303)

<figure><img src="/files/WpRXWrVCzASfflL2Yf3R" alt=""><figcaption><p><em>Creating a Token</em></p></figcaption></figure>

Use the token generated in your backstage configuration ![Screenshot 2023-06-12 at 12 36 00 PM](https://github.com/OzoneCloud/ozone-backstage/assets/13351472/ae21d7dc-8296-42d1-9770-b8f43ba132ec)

<figure><img src="/files/GuaVLvRowrenHd1X4AzE" alt=""><figcaption><p><em>Generated Token</em></p></figcaption></figure>

2. Add the dependency for ozone plugin

```bash
# From your Backstage root directory
yarn add --cwd packages/app @ozonenpm/plugin-ozone
```

3. Add proxy config

use the following proxy format to expose your api token

```yaml
proxy:
  ### Example for how to add a proxy endpoint for the frontend.
  ### A typical reason to do this is to handle HTTPS and CORS for internal services.
  # '/test':
  #   target: 'https://example.com'
  #   changeOrigin: true
  '/ozone':
    target: '<ozone-api-url>'
    headers:
      'authorization': '<your auth-token>'
    allowedHeaders:
      - x-workspace-id
```

### Usage

#### PipelineRun List plugin

Add the `EntityOzonePipelineRunContent` extension to the entity page in your app:

```tsx
// In packages/app/src/components/catalog/EntityPage.tsx
import {EntityOzonePipelineRunContent} from '@ozonenpm/plugin-ozone';

// For example in the CI/CD section
const cicdContent = (
  <EntitySwitch>
    <EntitySwitch.Case if={isozonePluginAvailable}>
      <EntityOzonePipelineRunContent />
    </EntitySwitch.Case>
```

**Screenshots**

<figure><img src="/files/Ooc1nP7x7PSyShVjyB2E" alt=""><figcaption><p><em>Pipeline runs list view</em></p></figcaption></figure>

<figure><img src="/files/nWwba8kWk7hyaWwh7UBN" alt=""><figcaption><p><em>Detailed pipeline run view</em></p></figcaption></figure>

#### Ozone Resource Plugin

Ozone plugin outside the catalog

* This will be dependent on the workspace selection
* This component will have Tabs of `Microservice`, `Repository`, `Registry`, `pipelines`
* On click of tabs will route to the lists accordingly

#### Screenshots

![Screenshot from 2023-04-19 17-06-07](https://user-images.githubusercontent.com/122984557/233064075-8cd11436-9ceb-48aa-b5d7-db80fae66133.png)

![Screenshot from 2023-04-19 17-06-11](https://user-images.githubusercontent.com/122984557/233064295-f0863ab7-27c5-40b7-96d4-3ee30d0d0942.png)

![Screenshot from 2023-04-19 17-06-14](https://user-images.githubusercontent.com/122984557/233064456-c43a5f95-5b21-4a19-9046-958ef6e2588e.png)

### Features

* Lists all the Builds,microservices,registry,repository for particular workspace
* Dive into one build to see the tasks and steps
* logs


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ozone.one/ozone-end-user-guide/~/changes/7YIrhOgqbpKF1lkWsq0G/guides/ozone-backstage-plugin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
