-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/centos-repository-switch' of https://github.com…
…/opendevstack/ods-quickstarters into feature/centos-repository-switch
- Loading branch information
Showing
16 changed files
with
217 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ jobs: | |
changelog: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected].0 | ||
- uses: actions/[email protected].1 | ||
- uses: dangoslen/changelog-enforcer@v3 | ||
with: | ||
changeLogPath: 'CHANGELOG.md' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ jobs: | |
steps: | ||
- | ||
name: Checkout repository | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].1 | ||
- | ||
name: Build docker image | ||
working-directory: common/jenkins-agents/golang/docker | ||
|
@@ -24,7 +24,7 @@ jobs: | |
steps: | ||
- | ||
name: Checkout repository | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].1 | ||
- | ||
name: Build docker image | ||
working-directory: common/jenkins-agents/jdk/docker | ||
|
@@ -41,7 +41,7 @@ jobs: | |
steps: | ||
- | ||
name: Checkout repository | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].1 | ||
- | ||
name: Build docker image | ||
working-directory: common/jenkins-agents/nodejs16/docker | ||
|
@@ -57,7 +57,7 @@ jobs: | |
steps: | ||
- | ||
name: Checkout repository | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].1 | ||
- | ||
name: Build docker image | ||
working-directory: common/jenkins-agents/nodejs18/docker | ||
|
@@ -73,7 +73,7 @@ jobs: | |
steps: | ||
- | ||
name: Checkout repository | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].1 | ||
- | ||
name: Build docker image | ||
working-directory: common/jenkins-agents/nodejs20/docker | ||
|
@@ -89,7 +89,7 @@ jobs: | |
steps: | ||
- | ||
name: Checkout repository | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].1 | ||
- | ||
name: Build docker image | ||
working-directory: common/jenkins-agents/nodejs22/docker | ||
|
@@ -105,7 +105,7 @@ jobs: | |
steps: | ||
- | ||
name: Checkout repository | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].1 | ||
- | ||
name: Build docker image | ||
working-directory: common/jenkins-agents/python/docker | ||
|
@@ -118,7 +118,7 @@ jobs: | |
steps: | ||
- | ||
name: Checkout repository | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].1 | ||
- | ||
name: Build docker image | ||
working-directory: common/jenkins-agents/rust/docker | ||
|
@@ -138,7 +138,7 @@ jobs: | |
steps: | ||
- | ||
name: Checkout repository | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].1 | ||
- | ||
name: Build docker image | ||
working-directory: common/jenkins-agents/terraform/docker | ||
|
@@ -151,7 +151,7 @@ jobs: | |
steps: | ||
- | ||
name: Checkout repository | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].1 | ||
- | ||
name: Build docker image | ||
working-directory: common/jenkins-agents/terraform-2306/docker | ||
|
@@ -164,7 +164,7 @@ jobs: | |
steps: | ||
- | ||
name: Checkout repository | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].1 | ||
- | ||
name: Build docker image | ||
working-directory: common/jenkins-agents/scala/docker | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { createHash } from 'crypto'; | ||
import { writeFile } from 'fs/promises'; | ||
import * as sharp from 'sharp'; | ||
import { ScreenshotEvidenceData, ScreenshotEvidenceResult } from './screenshot.types'; | ||
|
||
const SCREENSHOT_METADATA = { | ||
height: 50, | ||
margin: 10, | ||
textAlign: 'left', | ||
textColor: '#000', | ||
textSize: 'large', | ||
backgroundColor: '#fff', | ||
maxNameLength: 100, | ||
} as const; | ||
const EVIDENCE_HASH_ALGORITHM = 'sha256' as const; | ||
|
||
export const addEvidenceMetaToScreenshot = async (data: ScreenshotEvidenceData): Promise<ScreenshotEvidenceResult> => { | ||
const metadata: [string, string][] = [ | ||
['Timestamp', data.takenAt], | ||
['Testname', data.name.substring(0, SCREENSHOT_METADATA.maxNameLength)], | ||
['Step', data.step.toString()], | ||
['Screenshot', data.subStep.toString()], | ||
['Build number', process.env.BUILD_NUMBER ?? '-'], | ||
['Git commit', process.env.COMMIT_INFO_SHA ?? '-'], | ||
]; | ||
|
||
const image = sharp(data.path); | ||
const imageMetadata = await image.metadata(); | ||
const imageBuffer = await image | ||
.resize({ | ||
background: SCREENSHOT_METADATA.backgroundColor, | ||
fit: 'contain', | ||
height: (imageMetadata.height ?? 0) + SCREENSHOT_METADATA.height, | ||
position: 'bottom', | ||
width: imageMetadata.width ?? 0, | ||
}) | ||
.composite([ | ||
{ | ||
input: { | ||
text: { | ||
align: SCREENSHOT_METADATA.textAlign, | ||
rgba: true, | ||
text: metadata | ||
.map(([key, value]) => `<span foreground="${SCREENSHOT_METADATA.textColor}" size="${SCREENSHOT_METADATA.textSize}"><b>${key}</b>: ${value}</span>`) | ||
.join('\t'), | ||
width: (imageMetadata.width ?? 0) - SCREENSHOT_METADATA.margin * 2, | ||
}, | ||
}, | ||
left: SCREENSHOT_METADATA.margin, | ||
top: SCREENSHOT_METADATA.margin, | ||
}, | ||
]) | ||
.toBuffer(); | ||
await writeFile(data.path, imageBuffer); | ||
|
||
const hash = createHash(EVIDENCE_HASH_ALGORITHM).update(imageBuffer).digest('hex'); | ||
return { | ||
hash, | ||
path: data.path, | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export type ScreenshotEvidenceData = { | ||
name: string; | ||
path: string; | ||
step: number; | ||
subStep: number; | ||
takenAt: string; | ||
}; | ||
|
||
export type ScreenshotEvidenceResult = { | ||
hash: string; | ||
path: string; | ||
}; | ||
export const isScreenshotEvidenceResult = (candidate: unknown): candidate is ScreenshotEvidenceResult => | ||
Boolean( | ||
typeof candidate === 'object' && | ||
candidate && | ||
'hash' in candidate && | ||
'path' in candidate && | ||
typeof candidate.hash === 'string' && | ||
typeof candidate.path === 'string' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.