Skip to content

Commit

Permalink
fix: bitbucket build status key dependent on build name
Browse files Browse the repository at this point in the history
  • Loading branch information
Tymoteusz Gach committed Nov 16, 2023
1 parent ad492d6 commit fbcc937
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lambda/shared/commitStatus.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {bitbucketApiCall, githubApiCall} from './api';
import {createHash} from 'crypto';

export const sendCommitStatus = async (
repositoryHost: string, repositoryName: string, token: string,
Expand Down Expand Up @@ -33,7 +34,8 @@ const sendBitbucketCommitStatus = async (
status: string, commitSha: string, buildName: string, buildUrl: string, description: string,
) => {
const response = await bitbucketApiCall(token, `repositories/${repositoryName}/commit/${commitSha}/statuses/build`, 'POST', {
key: 'AWS-PIPELINE-BUILD',
// hash function used, because build status key must be shorter than 40 characters
key: createHash('md5').update(buildName).digest('hex'),
state: status,
name: buildName,
description: description,
Expand Down

0 comments on commit fbcc937

Please sign in to comment.