How to use the @atomist/automation-client.logger.info function in @atomist/automation-client

To help you get started, we’ve selected a few @atomist/automation-client 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 / src / internal / delivery / goals / support / github / gitHubStatusSetters.ts View on Github external
return async (inv: GoalCompletionListenerInvocation) => {
        const {id, completedGoal, allGoals, credentials} = inv;
        logger.info("Completed goal: '%s' with '%s' in set '%s'",
            goalKeyString(completedGoal), completedGoal.state, completedGoal.goalSetId);

        if (completedGoal.state === "failure") {
            logger.info("Setting GitHub status to failed on %s" + id.sha);
            return createStatus(credentials, id as GitHubRepoRef, {
                context: "sdm/atomist",
                description: `Atomist SDM Goals: ${completedGoal.description}`,
                target_url: "https://app.atomist.com", // TODO: deep link!
                state: "failure",
            });
        }
        if (allSuccessful(allGoals)) {
            logger.info("Setting GitHub status to success on %s", id.sha);
            return createStatus(credentials, id as GitHubRepoRef, {
                context: "sdm/atomist",
                description: `Atomist SDM Goals: all succeeded`,
                target_url: "https://app.atomist.com", // TODO: deep link!
                state: "success",
            });
        }
github atomist / sdm-pack-spring / lib / maven / deploy / mavenDeployer.ts View on Github external
};
    }

    // default to maven errors
    const maybeMavenErrors = mavenErrors(log);
    if (maybeMavenErrors) {
        logger.info("recognized maven error");
        return {
            relevantPart: maybeMavenErrors,
            message: "Maven errors",
        };
    }

    // or it could be this problem here
    if (log.match(/Error checking out artifact/)) {
        logger.info("Recognized artifact error");
        return {
            relevantPart: log,
            message: "I lost the local cache. Please rebuild",
            includeFullLog: false,
        };
    }

    logger.info("Did not find anything to recognize in the log");
    return undefined;
};
github atomist / sdm-core / lib / handlers / events / delivery / deploy / k8s / RequestK8sDeploys.ts View on Github external
return async (goalInvocation: GoalInvocation) => {
        const { sdmGoal, id, credentials } = goalInvocation;
        const image = sdmGoal.push.after.image;

        if (!image) {
            logger.warn(`No image found on commit ${sdmGoal.sha}; can't deploy`);
            return Promise.resolve(failure(new Error("No image linked")));
        }

        logger.info(`Requesting deploy. Triggered by ${sdmGoal.name} ${sdmGoal.state} ${sdmGoal.description}`);
        // we want this to communicate via the status directly.
        await createStatus(credentials, id as GitHubRepoRef, {
            context: k8AutomationDeployContext(target),
            state: "pending",
            description: "Requested deploy by k8-automation",
        });
        return Success;
    };
}
github atomist / sdm / src / handlers / events / delivery / goals / launchGoal.ts View on Github external
await eventHandler.processEvent(event, async results => {
                const resolved = await results;
                logger.info("Processing goal completed with results %j", resolved);
                setTimeout(() => process.exit(0), 10000);
            });
        }
github atomist / sdm / src / common / delivery / deploy / deploy.ts View on Github external
export function setStatus(credentials: ProjectOperationCredentials,
                          id: RemoteRepoRef,
                          state: StatusState,
                          context: GitHubStatusContext,
                          targetUrl: string,
                          description?: string): Promise {
    logger.info("Setting deploy status for %s to %s at %s", context, state, targetUrl);
    return createStatus((credentials as TokenCredentials).token, id as GitHubRepoRef, {
        state,
        target_url: targetUrl,
        context,
        description,
    });
}
github atomist / sdm / lib / api-helper / goal / chooseAndSetGoals.ts View on Github external
async function chooseGoalsForPushOnProject(rules: { goalSetter: GoalSetter },
                                           pi: PushListenerInvocation): Promise {
    const { goalSetter } = rules;
    const { push, id } = pi;

    try {
        const determinedGoals: Goals = await goalSetter.mapping(pi);

        if (!determinedGoals) {
            logger.info("No goals set by push '%s' to '%s/%s/%s'", push.after.sha, id.owner, id.repo, push.branch);
            return determinedGoals;
        } else {
            const filteredGoals: Goal[] = [];
            const plannedGoals = await planGoals(determinedGoals, pi);
            plannedGoals.goals.forEach(g => {
                if ((g as any).dependsOn) {
                    const preConditions = (g as any).dependsOn as Goal[];
                    if (preConditions) {
                        const filteredPreConditions = preConditions.filter(pc => plannedGoals.goals.some(ag =>
                            ag.uniqueName === pc.uniqueName &&
                            ag.environment === pc.environment));
                        if (filteredPreConditions.length > 0) {
                            filteredGoals.push(new GoalWithPrecondition(g.definition, ...filteredPreConditions));
                        } else {
                            filteredGoals.push(new Goal(g.definition));
                        }
github atomist / sdm / lib / api-helper / listener / executeAutoInspects.ts View on Github external
const reviews: ProjectReview[] = inspectionReviewsAndResults.filter(r => !!r.review)
            .map(r => r.review);
        const responsesFromReviewListeners = await gatherResponsesFromReviewListeners(goalInvocation.progressLog,
            reviews, options.listeners, cri);
        const reviewCommentCount = _.flatten((reviews || []).map(r => r.comments || [])).length;

        const allReviewResponses = responsesFromOnInspectionResult.concat(responsesFromReviewListeners);
        const result = {
            code: allReviewResponses.some(rr => !!rr && rr === PushImpactResponse.failGoals) ? 1 : 0,
            state: allReviewResponses.some(rr => !!rr && rr === PushImpactResponse.requireApprovalToProceed)
                ? SdmGoalState.waiting_for_approval : undefined,
            description: reviewCommentCount > 0 ?
                `Code inspections raised ${reviewCommentCount} review ${reviewCommentCount > 1 ? "comments" : "comment"}` : undefined,
        };
        logger.info("Review responses are %j, result=%j", responsesFromReviewListeners, result);
        return result;
    };
}
github atomist / sdm / src / pack / dry-run / support / NewBranchWithStatus.ts View on Github external
constructor(public branch: string,
                public message: string,
                private readonly creds: ProjectOperationCredentials,
                private readonly status: Status) {
        logger.info("Created NewBranchWithStatus: %j", this);
    }
github atomist / sdm-core / lib / pack / build-aware-transform / support / buildAwareBuildListener.ts View on Github external
break;

            case "failed" :
            case "broken":
                logger.info("Raising issue for failed build aware build on '%j' on branch '%s',", bu.id, branch);
                let issueBody = "Details:\n\n";
                issueBody += !!build.buildUrl ? `[Build log](${build.buildUrl})` : "No build log available";
                issueBody += `\n\n[Branch with failure](${bu.id.url}/tree/${branch} "Failing branch ${branch}")`;
                await opts.issueRouter.raiseIssue(bu.credentials, bu.id, {
                    title: `Failed to ${description}`,
                    body: issueBody,
                });
                break;

            default :
                logger.info("Unexpected build status [%s] issue for failed build aware build on '%j' on branch '%s'",
                    bu.build.status, bu.id, branch);
                break;
        }
    };
}
github atomist / sdm / src / internal / artifact / github / GitHubReleaseArtifactStore.ts View on Github external
public async checkout(url: string, id: RemoteRepoRef, creds: ProjectOperationCredentials): Promise {
        logger.info("Attempting to download artifact [%s] for %j", url, id);
        const tmpDir = tmp.dirSync({unsafeCleanup: true});
        const cwd = tmpDir.name;
        const lastSlash = url.lastIndexOf("/");
        const filename = url.substring(lastSlash + 1);
        const re = /([a-zA-Z0-9_]+)-(.*)/;
        const match = re.exec(filename);
        const name = match[1];
        const version = match[2].replace(/.jar$/, "");

        const outputPath = cwd + "/" + filename;
        logger.info("Attempting to download url %s to %s", url, outputPath);
        await downloadFileAs(creds, url, outputPath);
        logger.info("Successfully download url %s to %s", url, outputPath);
        return {
            cwd,
            filename,
            name,
            version,
            id,
        };
    }
}