How to use the @atomist/sdm.SdmGoalState.success function in @atomist/sdm

To help you get started, we’ve selected a few @atomist/sdm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atomist / sdm-core / lib / handlers / events / delivery / goals / FulfillGoalOnRequested.ts View on Github external
const result = await executeGoal(
                    {
                        projectLoader: this.configuration.sdm.projectLoader,
                        goalExecutionListeners: this.goalExecutionListeners,
                    },
                    {
                        ...implementation,
                        projectListeners: [...toArray(implementation.projectListeners || []), ...listeners],
                    },
                    goalInvocation);
                const terminatingStates = [
                    SdmGoalState.canceled,
                    SdmGoalState.failure,
                    SdmGoalState.skipped,
                    SdmGoalState.stopped,
                    SdmGoalState.success,
                    SdmGoalState.waiting_for_approval,
                ];
                if (!result || !result.state || terminatingStates.includes(result.state)) {
                    await reportEndAndClose(result, start, progressLog);
                }
                return {
                    ...result,
                    // successfully handled event even if goal failed
                    code: 0,
                };
            } catch (e) {
                e.message = `Goal executor threw exception: ${e.message}`;
                const egr: ExecuteGoalResult = {
                    code: 1,
                    message: e.message,
                    state: SdmGoalState.failure,
github atomist / sdm-core / lib / handlers / events / delivery / build / SetStatusOnBuildComplete.ts View on Github external
function buildStatusToSdmGoalState(buildStatus: BuildStatus): SdmGoalState {
    switch (buildStatus) {
        case "passed":
            return SdmGoalState.success;
        case "broken":
        case "failed":
        case "canceled":
            return SdmGoalState.failure;
        default:
            return SdmGoalState.in_process;
    }
}
github atomist / sdm-core / lib / machine / yaml / mapPushTests.ts View on Github external
const IsGoal: CreatePushTest = async (test, additionalTests, extensionTests) => {
    if (test.isGoal) {
        return isGoal(
            {
                name: typeof test.isGoal.name === "string" ? new RegExp(test.isGoal.name) : test.isGoal.name,
                state: test.isGoal.state || SdmGoalState.success,
                pushTest: test.isGoal.test ? await mapTest(test.isGoal.test, additionalTests, extensionTests) : undefined,
                output: typeof test.isGoal.output === "string" ? new RegExp(test.isGoal.output) : test.isGoal.output,
                data: typeof test.isGoal.data === "string" ? new RegExp(test.isGoal.data) : test.isGoal.data,
            });
    }
    return undefined;
};
github atomist / sdm-core / lib / handlers / events / delivery / build / FindArtifactOnImageLinked.ts View on Github external
id,
                    context,
                    addressChannels,
                    deployableArtifact,
                    credentials,
                };
                logger.info("About to invoke %d ArtifactListener registrations", params.registrations.length);
                await Promise.all(params.registrations
                    .map(toArtifactListenerRegistration)
                    .filter(async arl => !arl.pushTest || !!(await arl.pushTest.mapping(pli)))
                    .map(l => l.action(ai)));
            });
        }

        await updateGoal(context, artifactSdmGoal, {
            state: SdmGoalState.success,
            description: params.goal.successDescription,
            url: image.imageName,
        });
        logger.info("Updated artifact goal '%s'", artifactSdmGoal.name);
        return Success;
    }
}
github atomist / sdm-core / lib / handlers / events / delivery / goals / VoteOnGoalApprovalRequest.ts View on Github external
addressChannels: undefined,
                            preferences,
                            credentials,
                            configuration: this.configuration,
                            context,
                        });
                    }
                    await updateGoal(context, sdmGoal, {
                        state: SdmGoalState.requested,
                        description: !!sdmGoal.descriptions && !!sdmGoal.descriptions.requested
                            ? sdmGoal.descriptions.requested : goal.requestedDescription,
                        data: g.data,
                    });
                } else if (sdmGoal.state === SdmGoalState.approved) {
                    await updateGoal(context, sdmGoal, {
                        state: SdmGoalState.success,
                        description: !!sdmGoal.descriptions && !!sdmGoal.descriptions.completed
                            ? sdmGoal.descriptions.completed : goal.successDescription,
                    });
                }
                break;
            case GoalApprovalRequestVote.Denied:
                if (sdmGoal.state === SdmGoalState.pre_approved) {
                    const g: SdmGoalEvent = {
                        ...sdmGoal,
                        preApproval: undefined,
                    };
                    await updateGoal(context, g, {
                        state: SdmGoalState.waiting_for_pre_approval,
                        description: `${!!sdmGoal.descriptions && !!sdmGoal.descriptions.waitingForPreApproval ?
                            sdmGoal.descriptions.waitingForPreApproval : goal.waitingForPreApprovalDescription} \u00B7 start by @${sdmGoal.preApproval.userId} denied`,
                    });