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

feat(plugins): jenkins plugin implemented #215

Merged
merged 9 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Path to sources
sonar.exclusions=**/Dockerfile,**/**/components/AutoLogout/**,**/packages/app/src/*.test.tsx,**/packages/backend/src/plugins/sourceloop-ms.ts,**/packages/backend/src/utility.ts,**/packages/app/src/assets/icons/CustomIcons.tsx,**/packages/app/src/components/Root/LogoFull.tsx,**/packages/app/src/components/catalog/EntityPage.tsx, packages/app/src/components/search/SearchPage.tsx,**/packages/backend/src/plugins/catalog.ts
sonar.exclusions=**/Dockerfile,**/**/components/AutoLogout/**,**/packages/app/src/*.test.tsx,**/packages/backend/src/plugins/sourceloop-ms.ts,**/packages/backend/src/utility.ts,**/packages/app/src/assets/icons/CustomIcons.tsx,**/packages/app/src/components/Root/LogoFull.tsx,**/packages/app/src/components/catalog/EntityPage.tsx, packages/app/src/components/search/SearchPage.tsx,**/packages/backend/src/plugins/catalog.ts,**/plugins/jenkins-with-reporting/src/components/BuildsPage/**,**/plugins/jenkins-with-reporting/src/components/Cards/**,**/plugins/jenkins-with-reporting/src/components/JobRunsTable/**,

91 changes: 50 additions & 41 deletions app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ backend:
listen:
port: 7007
csp:
connect-src: [ "'self'", 'http:', 'https:' ]
img-src: [ '*' ]
connect-src: ["'self'", 'http:', 'https:']
img-src: ['*']
# Content-Security-Policy directives follow the Helmet format: https://helmetjs.github.io/#reference
# Default Helmet Content-Security-Policy values can be removed by setting the key to false
cors:
origin: ${FRONTEND_BASE_URL}
methods: [ GET, POST, PUT, DELETE ]
methods: [GET, POST, PUT, DELETE]
credentials: true
database:
# config options: https://node-postgres.com/api/client
Expand All @@ -31,7 +31,8 @@ backend:
host: ${POSTGRES_HOST}
port: ${POSTGRES_PORT}
user: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}
password:
${POSTGRES_PASSWORD}
# https://node-postgres.com/features/ssl
#ssl: require # see https://www.postgresql.org/docs/current/libpq-ssl.html Table 33.1. SSL Mode Descriptions (e.g. require)
#ca: # if you have a CA file and want to verify it you can uncomment this section
Expand All @@ -44,7 +45,7 @@ integrations:
github:
- host: github.com
token: ${GITHUB_TOKEN}
orgs: [ sourcefuse ]
orgs: [sourcefuse]
apps:
- appId: ${INTEGRATION_GITHUB_APP_ID}
webhookUrl: ${INTEGRATION_GITHUB_WEBHOOK_URL}
Expand Down Expand Up @@ -114,9 +115,17 @@ proxy:
'/sonarqube':
target: https://sonarcloud.io/api
allowedMethods: ['GET']
auth: "${SONARCLOUD_TOKEN}:"
auth: '${SONARCLOUD_TOKEN}:'
credentials: require

jenkins:
instances:
- name: default
baseUrl: ${JENKINS_BASEURL1}
username: ${JENKINS_USERNAME1}
projectCountLimit: ${JENKINS_PROJECTCOUNTLIMIT1}
apiKey: ${JENKINS_API_TOKEN1}

catalog:
providers:
githubOrg:
Expand Down Expand Up @@ -145,164 +154,164 @@ catalog:
# validateLocationsExist: true # optional boolean

rules:
- allow: [ Component, System, API, Group, User, Resource, Location ]
- allow: [Component, System, API, Group, User, Resource, Location]
locations:
# Backstage example templates
- type: url
target: https://github.com/backstage/software-templates/blob/main/scaffolder-templates/react-ssr-template/template.yaml
rules:
- allow: [ Template ]
- allow: [Template]

- type: url
target: https://github.com/backstage/software-templates/blob/main/scaffolder-templates/docs-template/template.yaml
rules:
- allow: [ Template ]
- allow: [Template]

- type: url
target: https://github.com/backstage/software-templates/blob/main/scaffolder-templates/create-react-app/template.yaml
rules:
- allow: [ Template ]
- allow: [Template]

- type: url
target: https://github.com/sourcefuse/sf-software-templates/blob/main/scaffolder-templates/microservice-repo-bootstrap/template.yaml
rules:
- allow: [ Template ]
- allow: [Template]

- type: url
target: https://github.com/sourcefuse/typescript-lambda-boilerplate/blob/main/templates/api-gw-lambda.yaml
rules:
- allow: [ Template ]
- allow: [Template]

- type: url
target: https://github.com/sourcefuse/arc-mono-repo-infra-template/blob/main/templates/template.yaml
rules:
- allow: [ Template ]
- allow: [Template]

- type: url
target: https://github.com/sourcefuse/terraform-aws-arc-cloudfront/blob/main/catalog-info.yaml
rules:
- allow: [ Component ]
tags: [ Backend ]
- allow: [Component]
tags: [Backend]

- type: url
target: https://github.com/sourcefuse/terraform-k8s-app/blob/main/catalog-info.yaml
rules:
- allow: [ Component ]
tags: [ Backend ]
- allow: [Component]
tags: [Backend]

- type: url
target: https://github.com/sourcefuse/terraform-aws-arc-db/blob/main/catalog-info.yaml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/terraform-aws-arc-tags/blob/main/catalog-info.yaml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/terraform-sourceloop-apps/blob/main/catalog-info.yml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/terraform-aws-arc-cloudfront/blob/main/catalog-info.yaml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/terraform-aws-arc-ecs/blob/main/catalog-info.yaml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/terraform-aws-arc-network/blob/main/catalog-info.yml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/terraform-aws-arc-eks/blob/main/catalog-info.yml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/terraform-aws-arc-bootstrap/blob/main/catalog-info.yml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/terraform-aws-arc-cloud-custodian/blob/main/catalog-info.yml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/terraform-aws-arc-opensearch/blob/main/catalog-info.yml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/loopback4-vault/blob/master/catalog-info.yaml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/loopback4-s3/blob/master/catalog-info.yaml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/loopback4-audit-log/blob/master/catalog-info.yaml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/loopback4-notifications/blob/master/catalog-info.yaml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/loopback4-helmet/blob/master/catalog-info.yaml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/loopback4-soft-delete/blob/master/catalog-info.yaml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/loopback4-kafka-client/blob/master/catalog-info.yaml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/loopback4-ratelimiter/blob/master/catalog-info.yaml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/loopback4-authorization/blob/master/catalog-info.yaml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/loopback4-authentication/blob/master/catalog-info.yaml
rules:
- allow: [ Component ]
- allow: [Component]

- type: url
target: https://github.com/sourcefuse/telemed-app-ui/blob/main/template.yaml
rules:
- allow: [ Template ]
- allow: [Template]
- type: url
target: https://github.com/sourcefuse/telemed-app-api/blob/main/template.yaml
rules:
- allow: [ Template ]
- allow: [Template]

# kubernetes:
# see https://backstage.io/docs/features/kubernetes/configuration for kubernetes configuration options
# see https://backstage.io/docs/features/kubernetes/configuration for kubernetes configuration options
# see https://backstage.io/docs/permissions/getting-started for more on the permission framework

## setting this to `false` will disable permissions
permission:
enabled: true
enabled: false
2 changes: 2 additions & 0 deletions packages/app/package.json
sadarunnisa-sf marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"dependencies": {
"@backstage-community/plugin-github-actions": "^0.6.16",
"@backstage-community/plugin-github-pull-requests-board": "^0.2.1",
"@backstage-community/plugin-jenkins": "^0.12.1",
"@backstage-community/plugin-sonarqube": "^0.8.0",
"@backstage-community/plugin-tech-radar": "^0.7.4",
"@backstage/app-defaults": "^1.5.11",
Expand All @@ -47,6 +48,7 @@
"@backstage/plugin-techdocs-react": "^1.2.8",
"@backstage/plugin-user-settings": "^0.8.12",
"@backstage/theme": "^0.5.7",
"@internal/backstage-plugin-jenkins-with-reporting": "^0.1.0",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@roadiehq/backstage-plugin-github-pull-requests": "^2.5.14",
Expand Down
46 changes: 39 additions & 7 deletions packages/app/src/components/catalog/EntityPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,24 @@ import {
EntityGithubPullRequestsContent,
EntityGithubPullRequestsOverviewCard,
} from '@roadiehq/backstage-plugin-github-pull-requests';
import { SnykOverview, EntitySnykContent, isSnykAvailable } from 'backstage-plugin-snyk';
import {
SnykOverview,
EntitySnykContent,
isSnykAvailable,
} from 'backstage-plugin-snyk';
import { EntitySonarQubeCard } from '@backstage-community/plugin-sonarqube';

import {
EntityKubernetesContent,
isKubernetesAvailable,
} from '@backstage/plugin-kubernetes';

import {
EntityJenkinsContent,
EntityLatestJenkinsRunCard,
isJenkinsAvailable,
} from '@internal/backstage-plugin-jenkins-with-reporting';

const techdocsContent = (
<EntityTechdocsContent>
<TechDocsAddons>
Expand All @@ -79,7 +89,6 @@ const cicdContent = (
// This is an example of how you can implement your company's logic in entity page.
// You can for example enforce that all components of type 'service' should use GitHubActions
<EntitySwitch>

<EntitySwitch.Case>
<EmptyState
title="No CI/CD available for this entity"
Expand All @@ -101,8 +110,8 @@ const cicdContent = (

const entityWarningContent = (
<>
<SnykOverview />
<EntitySwitch>
<SnykOverview />
<EntitySwitch>
<EntitySwitch.Case if={hasRelationWarnings}>
<Grid item xs={12}>
<EntityRelationWarning />
Expand Down Expand Up @@ -130,6 +139,14 @@ const entityWarningContent = (
<EntityProcessingErrorsPanel />
</Grid>
</EntitySwitch.Case>
<EntitySwitch.Case if={isJenkinsAvailable}>
<Grid item sm={6}>
<EntityLatestJenkinsRunCard
branch="main,master,dev"
variant="gridItem"
/>
</Grid>
</EntitySwitch.Case>
</EntitySwitch>
</>
);
Expand Down Expand Up @@ -173,6 +190,14 @@ const serviceEntityPage = (
{cicdContent}
</EntityLayout.Route>

<EntityLayout.Route path="/jenkins" title="jenkins">
<EntitySwitch>
<EntitySwitch.Case if={isJenkinsAvailable}>
<EntityJenkinsContent />
</EntitySwitch.Case>
</EntitySwitch>
</EntityLayout.Route>

<EntityLayout.Route path="/api" title="API">
<Grid container spacing={3} alignItems="stretch">
<Grid item md={6}>
Expand All @@ -184,7 +209,6 @@ const serviceEntityPage = (
</Grid>
</EntityLayout.Route>


<EntityLayout.Route
path="/kubernetes"
title="Kubernetes"
Expand Down Expand Up @@ -219,8 +243,8 @@ const serviceEntityPage = (
// Uncomment the line below if you'd like to only show the tab on entities with the correct annotations already set
// if={isGithubPullRequestsAvailable}
>
<EntityGithubPullRequestsContent />
</EntityLayout.Route>
<EntityGithubPullRequestsContent />
</EntityLayout.Route>
</EntityLayout>
);

Expand All @@ -234,6 +258,14 @@ const websiteEntityPage = (
{cicdContent}
</EntityLayout.Route>

<EntityLayout.Route path="/jenkins" title="jenkins">
<EntitySwitch>
<EntitySwitch.Case if={isJenkinsAvailable}>
<EntityJenkinsContent />
</EntitySwitch.Case>
</EntitySwitch>
</EntityLayout.Route>

<EntityLayout.Route path="/dependencies" title="Dependencies">
<Grid container spacing={3} alignItems="stretch">
<Grid item md={6}>
Expand Down
Loading
Loading