Skip to content

Commit

Permalink
Merge pull request #14 from TIBCOSoftware/v1.0.1
Browse files Browse the repository at this point in the history
V1.0.1 Changes
  • Loading branch information
sgantaya authored Jan 4, 2024
2 parents 3f8cb92 + b49f281 commit 57d41cb
Show file tree
Hide file tree
Showing 15 changed files with 129 additions and 56 deletions.
8 changes: 0 additions & 8 deletions app-config.production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,6 @@ integrations:
# apiBaseUrl: https://ghe.example.net/api/v3
# token: ${GHE_TOKEN}

## If needed uncomment these lines to add the default(example) entities to your software catalog
#catalog:
# locations:
# - type: file
# target: ./tibco-examples/tibco-examples.yaml
# rules:
# - allow: [Group, Template, System, Domain]

catalog:
locations: []

Expand Down
2 changes: 1 addition & 1 deletion app-config.template-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ backend:
user: postgres
password: example

## Uncomment the below github integrations config to add a PAT to try out\
## Uncomment the below github integrations config to add a PAT to try out
## new component creation using one of the available templates.
# integrations:
# github:
Expand Down
11 changes: 7 additions & 4 deletions app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ techdocs:
auth:
# see https://backstage.io/docs/auth/ to learn about auth providers
environment: development
## uncomment 3 lines below and add organization name in place of <YOUR-ORG-NAME>\
## to only allow members of a <YOUR-ORG-NAME> to sign in through gitHub.
# uncomment 3 lines below and add organization name in place of <YOUR-ORG-NAME> to support sign in through gitHub
# signIn:
# github:
# organizations: ['<YOUR-ORG-NAME>']
Expand All @@ -95,7 +94,7 @@ auth:
clientSecret: ${AUTH_GITHUB_CLIENT_SECRET}
oauth2Proxy:
development: {}
enableAuthProviders: [guest]
enableAuthProviders: [oauth2Proxy]
# Available providers:
# for local deployments
# [github, oauth2Proxy, guest]
Expand All @@ -111,6 +110,10 @@ scaffolder:
name: TIBCO® Developer Hub # Defaults to `Scaffolder`
email: [email protected] # Defaults to `[email protected]`
defaultCommitMessage: 'Initial commit' # Defaults to 'Initial commit'

catalog:
locations: []
# GitHub rate limits API requests to 5,000 per hour (or more for Enterprise accounts).
# For more information, visit https://backstage.io/docs/integrations/github/discovery/#github-api-rate-limits-1
# You can set the refresh rate of catalog (in milliseconds) for catalog API to fetch changes from GitHub, by using the below config.
# The allowed range is [100,900]
# catalogRefreshDelayInSec: 300
2 changes: 1 addition & 1 deletion build/platform/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ ENV NODE_ENV production
ENV HUB_CONFIGFILE "app-config.production.yaml"

ARG BID
ENV APP_CONFIG_app_buildInfo_version="${BID}"
ENV APP_CONFIG_app_buildVersion="${BID}"

CMD node packages/backend --config "${HUB_CONFIGFILE}"
4 changes: 2 additions & 2 deletions build/platform/charts/tibco-developer-hub/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.27
version: 1.0.32

appVersion: "1.0.0"
appVersion: "1.0.1"

dependencies:
- name: common
Expand Down
2 changes: 1 addition & 1 deletion build/platform/charts/tibco-developer-hub/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ backstage:
jfrogRepository: tibco-platform-local-docker/dx/tibco-hub

# -- Backstage image tag (immutable tags are recommended)
tag: "278"
tag: "319"

# -- Specify a imagePullPolicy.
# Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
Expand Down
2 changes: 1 addition & 1 deletion build/platform/provision-samples/recipe.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ recipe:
helmCharts:
- name: tibco-developer-hub
namespace: ${NAMESPACE}
version: 1.0.27
version: 1.0.32
repository:
chartMuseum:
host: ${HELM_REPO}
Expand Down
2 changes: 1 addition & 1 deletion build/platform/provision-samples/tibco-hub-cp-recipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"install": true
},
"name": "tibco-developer-hub",
"version": "1.0.27",
"version": "1.0.32",
"namespace": "${NAMESPACE}",
"repository": {
"chartMuseum": {
Expand Down
29 changes: 16 additions & 13 deletions config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,16 @@ export interface Config {
* Build information.
* Control the display of the build information in the Homepage UI.
*/
buildInfo?: {
/**
* Version number to display
* @visibility frontend
*/
version?: string | number;
/**
* Show build number. False by default. Has to be set explicitly as true to enable it.
* @visibility frontend
*/
show?: boolean;
};
/**
* Version number to display
* @visibility frontend
*/
buildVersion?: string | number;
/**
* Show build number. False by default. Has to be set explicitly as true to enable it.
* @visibility frontend
*/
showBuildVersion?: boolean;
};
// enable and configure loading org entities into catalog
orgCatalog?: {
Expand Down Expand Up @@ -80,8 +78,13 @@ export interface Config {
items: WalkThrough[];
};
/**
* Control plain link for the Developer Hub
* Control plain link for the TIBCO® Developer Hub
* @visibility frontend
*/
cpLink?: string;
/**
* Frontend root URL
* @visibility frontend
*/
catalogRefreshDelayInSec?: number;
}
22 changes: 16 additions & 6 deletions docs/app-config-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,23 @@ Example config:
app:
title: The TIBCO Hub
baseUrl: http://localhost:3000
buildInfo:
version: some.version.number
show: true
showBuildVersion: true
```
The CI/CD pipeline automatically adds the build number to all docker images.
## Catalog Refresh Delay
GitHub rate limits API requests to 5,000 per hour (or more for Enterprise accounts). The default catalog backend refreshes data every 100 seconds, which issues an API request for each discovered location.
This means if you have more than ~140 catalog entities, you may get throttled by rate limiting. You can change the refresh rate of the catalog in by using the example config:
```yaml
catalogRefreshDelayInSec: 300
```
Allowed range is 100 to 900 milliseconds. Increase the rate limit to avoid throttling from GitHub API.
## Walk Through
Show the Walk-through card on home page if the config is present.
Expand All @@ -43,13 +53,13 @@ walkThrough:
## Cp Link
Control plane link for the Developer Hub.
Control plane link for the TIBCO® Developer Hub.
Example config:
```yaml
cpLink: 'https://control-plane.domain.com'
```
No need to provide this in configuration.
This is filled automatically while provisioing TIBCO® Developer Hub for a data plane.
```
This is filled automatically while provisioning TIBCO® Developer Hub for a data plane.
15 changes: 5 additions & 10 deletions packages/app/src/components/home/BuildInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ import { configApiRef, useApi } from '@backstage/core-plugin-api';

export function BuildInfo() {
const configApi = useApi(configApiRef);
const buildInfoConf = configApi.getOptionalConfig('app.buildInfo');
const showBuildNumber =
buildInfoConf &&
buildInfoConf.getOptionalBoolean('show') !== false &&
buildInfoConf.has('version');
const buildInfoConf = configApi.getOptional('app.buildVersion');
const showBuildVersion = configApi.getOptionalBoolean('app.showBuildVersion');
const showBuildNumber = buildInfoConf && showBuildVersion;

if (showBuildNumber) {
return (
<Box sx={{ color: 'text.secondary' }}>
Build: {buildInfoConf.getOptional<string | number>('version')}
</Box>
);
return <Box sx={{ color: 'text.secondary' }}>Build: {buildInfoConf}</Box>;
}
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,24 @@ export const Introduction = () => {
<div className="tpdh-intro-title">What is the TIBCO® Developer Hub ?</div>
<p className="tpdh-intro-desc">
Welcome to the TIBCO® Developer Hub. This is a one-stop shop for
developers on TIBCO Platform, here you can find and share documentation
and assets with other developers. Aso you can create new TIBCO assets
based on templates, you can manage and view your build pipelines and
running components
developers on the TIBCO Platform, where you can find and share
documentation and assets with other developers. Also, you can create new
TIBCO assets from templates and manage your build pipelines and running
components.
</p>
<Grid container spacing={3} className="tpdh-intro-buttons">
<Grid item>
<Link to="/create">
<button type="button" className="pl-button pl-button--primary">
Get Started
Get started
</button>
</Link>
</Grid>
<Grid item>
<Link to="/docs">
<Link
to="https://docs.tibco.com/go/platform-cp/1.0.1/doc/html#cshid=developer_hub_overview"
target="_blank"
>
<button type="button" className="pl-button pl-button--secondary">
See how it works
</button>
Expand Down
42 changes: 42 additions & 0 deletions packages/backend/src/plugins/auth-providers/oauth2Proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,47 @@ export function oAuth2ProxyProviderFactory(env: PluginEnvironment) {
});
},
},
authHandler: async result => {
let DEV_JWT_TOKEN: string | undefined;
try {
DEV_JWT_TOKEN = env.config
.getOptionalConfig('oauth2-jwt-token')
?.getOptionalString('token');
} catch (e) {
env.logger.error(
'oauth2-jwt-token.token passed in app.config must be a string',
);
env.logger.error(e);
}

let token: string =
result.getHeader('x-atmosphere-token')?.toString() || '';
if (!token && DEV_JWT_TOKEN) {
token = DEV_JWT_TOKEN;
}
if (!token) {
throw new Error('Missing x-atmosphere-token in header');
}
if (typeof token !== 'string') {
throw new Error(
'Invalid x-atmosphere-token in header, x-atmosphere-token must be a string',
);
}
let decoded: any;
try {
decoded = jwtDecode(token);
} catch (error) {
throw new Error('Unable to decode JWT token');
}
if (!(decoded && decoded.fn)) {
throw new Error('Invalid JWT token, missing fn');
}
const displayName = decoded.fn + (decoded.ln ? ` ${decoded.ln}` : '');
return {
profile: {
displayName,
},
};
},
});
}
25 changes: 25 additions & 0 deletions packages/backend/src/plugins/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,31 @@ export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
const builder = await CatalogBuilder.create(env);
const config = env.config;
let catalogRefreshDelay: number | undefined = config?.getOptionalNumber(
'catalogRefreshDelayInSec',
);

if (catalogRefreshDelay) {
if (typeof catalogRefreshDelay === 'number') {
if (catalogRefreshDelay < 100) {
catalogRefreshDelay = 100;
console.warn(
'Catalog Refresh Delay cannot be less than 100, resetting it to 100',
);
} else if (catalogRefreshDelay > 900) {
catalogRefreshDelay = 900;
console.warn(
'Catalog Refresh Delay cannot be greater than 900, resetting it to 900',
);
}
builder.setProcessingIntervalSeconds(catalogRefreshDelay);
} else {
console.error(
'Catalog Refresh Delay must be a number between 100 and 900',
);
}
}

builder.addProcessor(new ScaffolderEntitiesProcessor());

Expand Down
4 changes: 2 additions & 2 deletions tibco-examples/docs-system/catalog-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ spec:
# kind: Group
# metadata:
# name: tibco-developer-hub
# description: The TIBCO® Developer Hub
# description: TIBCO® Developer Hub
# spec:
# type: department
# profile:
# displayName: The TIBCO® Developer Hub
# displayName: TIBCO® Developer Hub
# email: [email protected]
# picture: https://en.wikipedia.org/wiki/Finance#/media/File:Philippine-stock-market-board.jpg
# parent: DocGeneration
Expand Down

0 comments on commit 57d41cb

Please sign in to comment.