npm package: @ozonecloud/plugin-ozone
Description: Welcome to the ozone plugin!
Latest version: 1.0.2

# 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`

    ![Screenshot 2023-06-12 at 12 32 33 PM](https://2820868129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FJ1QLUaVS7MF41Qq2rr1N%2FScreenshot%202023-06-12%20at%2012.32.33%20PM.png?alt=media&token=07a6b66c-1534-47d6-a862-2d5930445b9d)
   
    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://2820868129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FQDOerdbKs2DKRSmgCmaw%2FScreenshot%202023-06-12%20at%2012.34.17%20PM.png?alt=media&token=cd4aa351-2d4e-402d-bcb5-e89d97cb20db)

    Use the token generated in your backstage configuration
    ![Screenshot 2023-06-12 at 12 36 00 PM](https://2820868129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FPLkrF0yCMgivmpUDWNv8%2FScreenshot%202023-06-12%20at%2012.34.52%20PM.png?alt=media&token=67d9aa55-6e3b-4151-9296-e7ddbaa51cd1)



2. Add the dependency for ozone plugin

```bash
# From your Backstage root directory
yarn add --cwd packages/app @ozonecloud/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: 'https://cd.ozone.one/api/service-account'
    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,isPipelinesAvailable} from '@ozonecloud/plugin-ozone';

// For example in the CI/CD section
const cicdContent = (
  <EntitySwitch>
    <EntitySwitch.Case if={isPipelinesAvailable}>
      <EntityOzonePipelineRunContent />
    </EntitySwitch.Case>
```
Add the annotation `ozone.com/microservice-slug` in your catalog
```yaml
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  namespace: default
  annotations:
    ozone.com/microservice-slug: hell-world-app
  name: hello-world-app
  description: 'A hello world application maintained on backstage'
spec:
  type: service
  lifecycle: production
  owner: user:guest
````

#### Screenshots
 ![Screenshot 2023-06-08 at 3 23 39 PM](https://2820868129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FBLOFdP74nJTnwFffZNOE%2F244346245-0b0ec612-e16c-4580-a854-ed2e43c952ab.png?alt=media&token=87a1624c-c832-458f-bb57-0718a6c97be5)
  
![Screenshot 2023-06-08 at 3 24 40 PM](https://2820868129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2F2b3LQ1np0VtrLTmljoxu%2F244346630-75027c18-1335-43a1-951c-0bf383ebeedb.png?alt=media&token=c5fbeb82-c0df-4dda-b3ee-3112e9654503)

### 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