Merge pull request #6807 from SDA-SE/feat/is-jenkins

Make `isJenkinsAvailable` recognise both the old and the new Jenkins annotation
This commit is contained in:
Oliver Sand
2021-08-12 20:56:54 +02:00
committed by GitHub
5 changed files with 23 additions and 9 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-jenkins': patch
---
Make `isJenkinsAvailable` recognise both the old and the new Jenkins annotation.
+6 -1
View File
@@ -43,7 +43,7 @@ export { isJenkinsAvailable as isPluginApplicableToEntity };
// Warning: (ae-missing-release-tag) "JENKINS_ANNOTATION" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const JENKINS_ANNOTATION = 'jenkins.io/github-folder';
export const JENKINS_ANNOTATION = 'jenkins.io/job-full-name';
// Warning: (ae-missing-release-tag) "JenkinsApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
@@ -143,6 +143,11 @@ export const LatestRunCard: ({
variant?: InfoCardVariants | undefined;
}) => JSX.Element;
// Warning: (ae-missing-release-tag) "LEGACY_JENKINS_ANNOTATION" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const LEGACY_JENKINS_ANNOTATION = 'jenkins.io/github-folder';
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "Router" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
+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 */
+4 -1
View File
@@ -13,4 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const JENKINS_ANNOTATION = 'jenkins.io/github-folder';
export const JENKINS_ANNOTATION = 'jenkins.io/job-full-name';
// @deprecated The legacy annotation used for identifing Jenkins jobs, use
// JENKINS_ANNOTATION instead.
export const LEGACY_JENKINS_ANNOTATION = 'jenkins.io/github-folder';
+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';