Skip to content

Commit

Permalink
feat: add AAP backend plugin (janus-idp#511)
Browse files Browse the repository at this point in the history
* feat: add AAP backend plugin

* docs: adds AAP backend plugin to list of plugins in README
  • Loading branch information
invincibleJai committed Sep 20, 2023
1 parent 99bdd72 commit 1306f71
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tame-nails-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'backend': minor
---

Added `AAP_ENABLED` that enables AAP(Ansible Automation Platform) backend plugin. Once enabled it lists job templates and workflow job templates in software catalog
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Our current list of plugins within the showcase app include:
- [Gitlab Scaffolder actions](https://github.com/backstage/backstage/tree/master/plugins/scaffolder-backend-module-gitlab)
- [Utils Scaffolder actions](https://github.com/RoadieHQ/roadie-backstage-plugins/tree/main/plugins/scaffolder-actions/scaffolder-backend-module-utils)
- [Nexus Repository Manager plugin](https://github.com/janus-idp/backstage-plugins/tree/main/plugins/nexus-repository-manager)
- [AAP Backend plugin](https://github.com/janus-idp/backstage-plugins/tree/main/plugins/aap-backend)

## Getting Started

Expand Down
7 changes: 7 additions & 0 deletions app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ catalog:
# providerId:
# organization: "${GITHUB_ORG}"

# Plugin: AAP backend plugin
aap:
prod:
baseUrl: ${AAP_BASE_URL}
authorization: ${AAP_AUTH_TOKEN}

# Plugin: Kubernetes, OCM
kubernetes:
customResources:
Expand Down Expand Up @@ -319,3 +325,4 @@ enabled:
jenkins: ${JENKINS_ENABLED}
permission: ${PERMISSION_ENABLED}
metrics: ${METRICS_ENABLED}
aap: ${AAP_ENABLED}
13 changes: 13 additions & 0 deletions packages/app/src/components/catalog/EntityPage/Pages/Resource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ export const resourcePage = (
</Grid>
</ClusterContextProvider>
</EntitySwitch.Case>
<EntitySwitch.Case
if={isType(['job_template', 'workflow_job_template'])}
>
<Grid item md={6}>
<EntityAboutCard variant="gridItem" />
</Grid>
<Grid item md={6}>
<EntityLinksCard />
</Grid>
<Grid item md={6} xs={12}>
<EntityCatalogGraphCard variant="gridItem" height={400} />
</Grid>
</EntitySwitch.Case>
<EntitySwitch.Case>
<Grid item md={6}>
<EntityAboutCard variant="gridItem" />
Expand Down
1 change: 1 addition & 0 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@immobiliarelabs/backstage-plugin-gitlab-backend": "6.2.0",
"@janus-idp/backstage-plugin-keycloak-backend": "1.5.3",
"@janus-idp/backstage-plugin-ocm-backend": "3.2.1",
"@janus-idp/backstage-plugin-aap-backend": "1.2.2",
"@roadiehq/backstage-plugin-argo-cd-backend": "2.11.1",
"@roadiehq/scaffolder-backend-argocd": "1.1.14",
"@roadiehq/scaffolder-backend-module-utils": "1.10.2",
Expand Down
14 changes: 14 additions & 0 deletions packages/backend/src/plugins/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { GitlabDiscoveryEntityProvider } from '@backstage/plugin-catalog-backend
import { GitlabFillerProcessor } from '@immobiliarelabs/backstage-plugin-gitlab-backend';
import { KeycloakOrgEntityProvider } from '@janus-idp/backstage-plugin-keycloak-backend';
import { ManagedClusterProvider } from '@janus-idp/backstage-plugin-ocm-backend';
import { AapResourceEntityProvider } from '@janus-idp/backstage-plugin-aap-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';

Expand All @@ -26,6 +27,7 @@ export default async function createPlugin(
env.config.getOptionalBoolean('enabled.githubOrg') || false;
const isGitlabEnabled =
env.config.getOptionalBoolean('enabled.gitlab') || false;
const isAapEnabled = env.config.getOptionalBoolean('enabled.aap') || false;

if (isOcmEnabled) {
builder.addEntityProvider(
Expand Down Expand Up @@ -106,6 +108,18 @@ export default async function createPlugin(
);
}

if (isAapEnabled) {
builder.addEntityProvider(
AapResourceEntityProvider.fromConfig(env.config, {
logger: env.logger,
schedule: env.scheduler.createScheduledTaskRunner({
frequency: { minutes: 30 },
timeout: { minutes: 3 },
}),
}),
);
}

builder.setPlaceholderResolver('openapi', jsonSchemaRefPlaceholderResolver);
builder.setPlaceholderResolver('asyncapi', jsonSchemaRefPlaceholderResolver);

Expand Down
7 changes: 7 additions & 0 deletions showcase-docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ The easiest and fastest method for getting started: Backstage Showcase app, runn
- `${AZURE_ENABLED}` Set to `true` to enable the Azure DevOps Entity backend plugin.
- `${JENKINS_ENABLED}` Set to `true` to enable the Jenkins Entity backend plugin.
- `${METRICS_ENABLED}` Set to `true` to enable Prometheus metrics (metrics will be available on `http://localhost:7007/metrics`).
- `${AAP_ENABLED}` Set to `true` to enable the AAP backend plugin

- Setup the GitHub plugins (GitHub Issues and GitHub Pull Request)

Expand Down Expand Up @@ -272,6 +273,12 @@ The easiest and fastest method for getting started: Backstage Showcase app, runn

- `${NEXUS_REPOSITORY_MANAGER_TOKEN}` (Only for private Nexus Repository Manager instances): Nexus instance API token (see [documentation](https://help.sonatype.com/repomanager3/nexus-repository-administration/user-authentication/user-tokens)) with `nx-repository-view-*-*-read` [permissions](https://help.sonatype.com/repomanager3/nexus-repository-administration/access-control/privileges), or read permissions to view all the repositories you want to display in the plugin.

- Setup the AAP backend plugin

- This [URL](https://github.com/janus-idp/backstage-plugins/blob/main/plugins/aap-backend/README.md#installation-and-configuration) explains how to use the AAP backend plugin
- `${AAP_BASE_URL}`: URL for the Ansible Automation Platform(AAP). Mandatory if plugin is enabled
- `${AAP_AUTH_TOKEN}`: Ansible Automation Platform(AAP) [token](https://docs.ansible.com/automation-controller/latest/html/userguide/users.html#users-tokens) with enough permission to read job templates. Mandatory if plugin is enabled (e.g 'Bearer XXXX')

4. Run `yarn install` to install the dependencies

5. Start the application using `yarn start`
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4938,6 +4938,18 @@
resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98"
integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==

"@janus-idp/backstage-plugin-aap-backend@1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@janus-idp/backstage-plugin-aap-backend/-/backstage-plugin-aap-backend-1.2.2.tgz#911d6d0fb02395ef7be29c7c9493f38fc2772a52"
integrity sha512-5PJWuYWA/rsEUczfXN9m1i2xYtoSqM23BqibeLJvMIegOUGk9xL+8a4cRc5oJY1Nf4Ub3yKc3Rdi8ipwILdRBw==
dependencies:
"@backstage/backend-common" "^0.19.1"
"@backstage/backend-tasks" "^0.5.4"
"@backstage/catalog-model" "^1.4.1"
"@backstage/config" "^1.0.8"
"@backstage/plugin-catalog-node" "^1.4.0"
winston "^3.2.1"

"@janus-idp/backstage-plugin-analytics-provider-segment@1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@janus-idp/backstage-plugin-analytics-provider-segment/-/backstage-plugin-analytics-provider-segment-1.1.1.tgz#80d37e3901fc1e84d80a0e302156ae6d51309d25"
Expand Down

0 comments on commit 1306f71

Please sign in to comment.