cloudbuild

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-08-19 13:16:21 +02:00
parent 93b552b34c
commit 71ce2d1c62
11 changed files with 30 additions and 58 deletions
@@ -20,6 +20,7 @@ import {
} from '../api/types';
import { createApiRef } from '@backstage/core-plugin-api';
/** @public */
export const cloudbuildApiRef = createApiRef<CloudbuildApi>({
id: 'plugin.cloudbuild.service',
});
+16
View File
@@ -14,10 +14,12 @@
* limitations under the License.
*/
/** @public */
export interface ActionsListWorkflowRunsForRepoResponseData {
builds: ActionsGetWorkflowResponseData[];
}
/** @public */
export type ActionsGetWorkflowResponseData = {
id: string;
status: string;
@@ -41,6 +43,7 @@ export type ActionsGetWorkflowResponseData = {
timing: Timing2;
};
/** @public */
export interface Step {
name: string;
args: string[];
@@ -54,16 +57,19 @@ export interface Step {
pullTiming: PullTiming;
}
/** @public */
export interface Timing2 {
BUILD: BUILD;
FETCHSOURCE: FETCHSOURCE;
}
/** @public */
export interface SourceProvenance {
resolvedStorageSource: {};
fileHashes: {};
}
/** @public */
export interface Options {
machineType: string;
substitutionOption: string;
@@ -71,6 +77,7 @@ export interface Options {
dynamicSubstitutions: boolean;
}
/** @public */
export interface Substitutions {
COMMIT_SHA: string;
SHORT_SHA: string;
@@ -79,45 +86,54 @@ export interface Substitutions {
REVISION_ID: string;
}
/** @public */
export interface Results {
buildStepImages: string[];
buildStepOutputs: string[];
}
/** @public */
export interface BUILD {
startTime: string;
endTime: string;
}
/** @public */
export interface FETCHSOURCE {
startTime: string;
endTime: string;
}
/** @public */
export interface StorageSource {
bucket: string;
object: string;
}
/** @public */
export interface Source {
storageSource: StorageSource;
}
/** @public */
export interface Volume {
name: string;
path: string;
}
/** @public */
export interface Timing {
startTime: string;
endTime: string;
}
/** @public */
export interface PullTiming {
startTime: string;
endTime: string;
}
/** @public */
export interface ResolvedStorageSource {
bucket: string;
object: string;
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useEffect } from 'react';
import { useWorkflowRuns, WorkflowRun } from '../useWorkflowRuns';
import { WorkflowRunsTable } from '../WorkflowRunsTable';
@@ -72,6 +73,7 @@ const WidgetContent = ({
);
};
/** @public */
export const LatestWorkflowRunCard = (props: { branch: string }) => {
const { branch = 'master' } = props;
const { entity } = useEntity();
@@ -100,6 +102,7 @@ export const LatestWorkflowRunCard = (props: { branch: string }) => {
);
};
/** @public */
export const LatestWorkflowsForBranchCard = (props: { branch: string }) => {
const { branch = 'master' } = props;
const { entity } = useEntity();
@@ -13,4 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { LatestWorkflowRunCard, LatestWorkflowsForBranchCard } from './Cards';
@@ -23,9 +23,11 @@ import { WorkflowRunsTable } from './WorkflowRunsTable';
import { CLOUDBUILD_ANNOTATION } from './useProjectName';
import { MissingAnnotationEmptyState } from '@backstage/core-components';
/** @public */
export const isCloudbuildAvailable = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[CLOUDBUILD_ANNOTATION]);
/** @public */
export const Router = () => {
const { entity } = useEntity();
@@ -17,6 +17,7 @@
import useAsync from 'react-use/lib/useAsync';
import { Entity } from '@backstage/catalog-model';
/** @public */
export const CLOUDBUILD_ANNOTATION = 'google.com/cloudbuild-project-slug';
export const useProjectName = (entity: Entity) => {
+4
View File
@@ -23,6 +23,7 @@ import {
createComponentExtension,
} from '@backstage/core-plugin-api';
/** @public */
export const cloudbuildPlugin = createPlugin({
id: 'cloudbuild',
apis: [
@@ -39,6 +40,7 @@ export const cloudbuildPlugin = createPlugin({
},
});
/** @public */
export const EntityCloudbuildContent = cloudbuildPlugin.provide(
createRoutableExtension({
name: 'EntityCloudbuildContent',
@@ -47,6 +49,7 @@ export const EntityCloudbuildContent = cloudbuildPlugin.provide(
}),
);
/** @public */
export const EntityLatestCloudbuildRunCard = cloudbuildPlugin.provide(
createComponentExtension({
name: 'EntityLatestCloudbuildRunCard',
@@ -57,6 +60,7 @@ export const EntityLatestCloudbuildRunCard = cloudbuildPlugin.provide(
}),
);
/** @public */
export const EntityLatestCloudbuildsForBranchCard = cloudbuildPlugin.provide(
createComponentExtension({
name: 'EntityLatestCloudbuildsForBranchCard',