Make isJenkinsAvailable recognise both the old and the new Jenkins annotation
Signed-off-by: Oliver Sand <oliver.sand@sda-se.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-jenkins': patch
|
||||
---
|
||||
|
||||
Make `isJenkinsAvailable` recognise both the old and the new Jenkins annotation.
|
||||
@@ -13,18 +13,19 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { MissingAnnotationEmptyState } from '@backstage/core-components';
|
||||
import { useEntity } from '@backstage/plugin-catalog-react';
|
||||
import React from 'react';
|
||||
import { Route, Routes } from 'react-router';
|
||||
import { useEntity } from '@backstage/plugin-catalog-react';
|
||||
import { JENKINS_ANNOTATION, LEGACY_JENKINS_ANNOTATION } from '../constants';
|
||||
import { buildRouteRef, rootRouteRef } from '../plugin';
|
||||
import { DetailedViewPage } from './BuildWithStepsPage/';
|
||||
import { JENKINS_ANNOTATION } from '../constants';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { CITable } from './BuildsPage/lib/CITable';
|
||||
import { MissingAnnotationEmptyState } from '@backstage/core-components';
|
||||
import { DetailedViewPage } from './BuildWithStepsPage/';
|
||||
|
||||
export const isJenkinsAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[JENKINS_ANNOTATION]);
|
||||
Boolean(entity.metadata.annotations?.[JENKINS_ANNOTATION]) ||
|
||||
Boolean(entity.metadata.annotations?.[LEGACY_JENKINS_ANNOTATION]);
|
||||
|
||||
type Props = {
|
||||
/** @deprecated The entity is now grabbed from context instead */
|
||||
|
||||
@@ -13,4 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export const JENKINS_ANNOTATION = 'jenkins.io/github-folder';
|
||||
|
||||
export const LEGACY_JENKINS_ANNOTATION = 'jenkins.io/github-folder';
|
||||
export const JENKINS_ANNOTATION = 'jenkins.io/job-full-name';
|
||||
|
||||
@@ -26,5 +26,5 @@ export {
|
||||
isJenkinsAvailable,
|
||||
isJenkinsAvailable as isPluginApplicableToEntity,
|
||||
} from './components/Router';
|
||||
export { JENKINS_ANNOTATION } from './constants';
|
||||
export { JENKINS_ANNOTATION, LEGACY_JENKINS_ANNOTATION } from './constants';
|
||||
export * from './api';
|
||||
|
||||
Reference in New Issue
Block a user