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:
Oliver Sand
2021-08-12 17:56:09 +02:00
parent 02931f4b13
commit d7d1f6fb9a
4 changed files with 16 additions and 8 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-jenkins': patch
---
Make `isJenkinsAvailable` recognise both the old and the new Jenkins annotation.
+7 -6
View File
@@ -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 */
+3 -1
View File
@@ -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';
+1 -1
View File
@@ -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';