Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { HandleEvent } from "@atomist/automation-client/lib/HandleEvent";
import {
AddressChannels,
addressChannelsFor,
BuildListener,
BuildListenerInvocation,
CredentialsResolver,
RepoRefResolver,
} from "@atomist/sdm";
import { OnBuildComplete } from "../../../../typings/types";
/**
* Invoke listeners on complete build. Not a part of our delivery flow:
* just observational.
*/
@EventHandler("Invoke listeners on build complete", GraphQL.subscription("OnBuildComplete"))
export class InvokeListenersOnBuildComplete implements HandleEvent {
constructor(private readonly listeners: BuildListener[],
private readonly repoRefResolver: RepoRefResolver,
private readonly credentialsFactory: CredentialsResolver) {
}
public async handle(event: EventFired,
context: HandlerContext,
params: this): Promise {
const build = event.data.Build[0];
const repo = build.commit.repo;
const id = this.repoRefResolver.toRemoteRepoRef(repo, {});
const credentials = this.credentialsFactory.eventHandlerCredentials(context, id);
const addressChannels: AddressChannels = addressChannelsFor(repo, context);
import { EventHandler } from "@atomist/automation-client/lib/decorators";
import { HandleEvent } from "@atomist/automation-client/lib/HandleEvent";
import {
CredentialsResolver,
PreferenceStoreFactory,
RepoRefResolver,
resolveCredentialsPromise,
UserJoiningChannelListener,
UserJoiningChannelListenerInvocation,
} from "@atomist/sdm";
import * as schema from "../../../typings/types";
/**
* A user joined a channel
*/
@EventHandler("On user joining channel", GraphQL.subscription("OnUserJoiningChannel"))
export class OnUserJoiningChannel implements HandleEvent {
@Value("")
public configuration: Configuration;
constructor(private readonly listeners: UserJoiningChannelListener[],
private readonly repoRefResolver: RepoRefResolver,
private readonly credentialsFactory: CredentialsResolver,
private readonly preferenceStoreFactory: PreferenceStoreFactory) {
}
public async handle(event: EventFired,
context: HandlerContext): Promise {
const joinEvent = event.data.UserJoinedChannel[0];
const repos = joinEvent.channel.repos.map(
repo => this.repoRefResolver.toRemoteRepoRef(repo, {}));
import { HandleEvent } from "@atomist/automation-client/lib/HandleEvent";
import {
addressChannelsFor,
CredentialsResolver,
PreferenceStoreFactory,
RepoRefResolver,
resolveCredentialsPromise,
TagListener,
TagListenerInvocation,
} from "@atomist/sdm";
import * as schema from "../../../typings/types";
/**
* A new tag has been created
*/
@EventHandler("On tag", GraphQL.subscription("OnTag"))
export class OnTag implements HandleEvent {
@Value("")
public configuration: Configuration;
constructor(private readonly listeners: TagListener[],
private readonly repoRefResolver: RepoRefResolver,
private readonly credentialsFactory: CredentialsResolver,
private readonly preferenceStoreFactory: PreferenceStoreFactory) {}
public async handle(event: EventFired,
context: HandlerContext): Promise {
const tag = event.data.Tag[0];
const repo = tag.commit.repo;
const id = this.repoRefResolver.toRemoteRepoRef(repo, {});
SdmGoalKey,
SoftwareDeliveryMachineConfiguration,
updateGoal,
} from "@atomist/sdm";
import { isGoalRelevant } from "../../../../internal/delivery/goals/support/validateGoal";
import { verifyGoal } from "../../../../internal/signing/goalSigning";
import {
OnAnySuccessfulSdmGoal,
SdmGoalState,
} from "../../../../typings/types";
/**
* Move downstream goals from 'planned' to 'requested' when preconditions are met.
*/
@EventHandler("Move downstream goals from 'planned' to 'requested' when preconditions are met",
GraphQL.subscription("OnAnySuccessfulSdmGoal"))
export class RequestDownstreamGoalsOnGoalSuccess implements HandleEvent {
@Value("")
public configuration: SoftwareDeliveryMachineConfiguration;
constructor(private readonly name: string,
private readonly implementationMapper: GoalImplementationMapper,
private readonly repoRefResolver: RepoRefResolver,
private readonly credentialsResolver: CredentialsResolver,
private readonly preferenceStoreFactory: PreferenceStoreFactory) {
}
public async handle(event: EventFired,
context: HandlerContext): Promise {
const sdmGoal = event.data.SdmGoal[0] as SdmGoalEvent;
} from "@atomist/automation-client";
import {
addressChannelsFor,
ArtifactListenerInvocation,
ArtifactListenerRegisterable,
findSdmGoalOnCommit,
Goal,
PushListenerInvocation,
SdmGoalState,
SoftwareDeliveryMachineOptions,
toArtifactListenerRegistration,
updateGoal,
} from "@atomist/sdm";
import { OnImageLinked } from "../../../../typings/types";
@EventHandler("Scan when artifact is found", GraphQL.subscription("OnImageLinked"))
export class FindArtifactOnImageLinked implements HandleEvent {
/**
* The goal to update when an artifact is linked.
* When an artifact is linked to a commit, the build must be done.
*/
constructor(public goal: Goal,
private readonly registrations: ArtifactListenerRegisterable[],
private readonly options: SoftwareDeliveryMachineOptions) {
}
public async handle(event: EventFired,
context: HandlerContext,
params: this): Promise {
const imageLinked = event.data.ImageLinked[0];
const commit = imageLinked.commit;
} from "@atomist/automation-client";
import {
addressChannelsFor,
CredentialsResolver,
DeploymentListener,
DeploymentListenerInvocation,
RepoRefResolver,
StagingDeploymentGoal,
} from "@atomist/sdm";
import { OnSuccessStatus } from "../../../../typings/types";
/**
* React to a deployment.
*/
@EventHandler("React to a successful deployment",
GraphQL.subscription({
name: "OnSuccessStatus",
variables: {
context: StagingDeploymentGoal.context,
},
}),
)
export class OnDeployStatus implements HandleEvent {
constructor(private readonly listeners: DeploymentListener[],
private readonly repoRefResolver: RepoRefResolver,
private readonly credentialsFactory: CredentialsResolver) {}
public async handle(event: EventFired,
context: HandlerContext, params: this): Promise {
const status = event.data.Status[0];
const commit = status.commit;
AddressChannels,
addressChannelsFor,
ChannelLinkListener,
ChannelLinkListenerInvocation,
CredentialsResolver,
PreferenceStoreFactory,
ProjectLoader,
RepoRefResolver,
resolveCredentialsPromise,
} from "@atomist/sdm";
import * as schema from "../../../typings/types";
/**
* A new channel has been linked to a repo
*/
@EventHandler("On channel link", GraphQL.subscription("OnChannelLink"))
export class OnChannelLink implements HandleEvent {
@Value("")
public configuration: Configuration;
constructor(
private readonly projectLoader: ProjectLoader,
private readonly repoRefResolver: RepoRefResolver,
private readonly listeners: ChannelLinkListener[],
private readonly credentialsFactory: CredentialsResolver,
private readonly preferenceStoreFactory: PreferenceStoreFactory) {
}
public async handle(event: EventFired,
context: HandlerContext): Promise {
const repo = event.data.ChannelLink[0].repo;
import {
addressChannelsFor,
CredentialsResolver,
PreferenceStoreFactory,
ProjectLoader,
PullRequestListener,
PullRequestListenerInvocation,
RepoRefResolver,
resolveCredentialsPromise,
} from "@atomist/sdm";
import * as schema from "../../../typings/types";
/**
* A pull request has been raised
*/
@EventHandler("On pull request", GraphQL.subscription("OnPullRequest"))
export class OnPullRequest implements HandleEvent {
@Value("")
public configuration: Configuration;
constructor(
private readonly projectLoader: ProjectLoader,
private readonly repoRefResolver: RepoRefResolver,
private readonly listeners: PullRequestListener[],
private readonly credentialsFactory: CredentialsResolver,
private readonly preferenceStoreFactory: PreferenceStoreFactory) {
}
public async handle(event: EventFired,
context: HandlerContext): Promise {
const pullRequest = event.data.PullRequest[0];