Skip to content

Commit e5725df

Browse files
Bump the actions group across 1 directory with 14 updates (Azure#338)
* Bump the actions group across 1 directory with 14 updates Bumps the actions group with 14 updates in the / directory: | Package | From | To | | --- | --- | --- | | [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) | `1.10.0` | `1.10.1` | | [@actions/io](https://github.com/actions/toolkit/tree/HEAD/packages/io) | `1.1.2` | `1.1.3` | | [@actions/tool-cache](https://github.com/actions/toolkit/tree/HEAD/packages/tool-cache) | `1.1.2` | `2.0.1` | | [@octokit/core](https://github.com/octokit/core.js) | `3.6.0` | `6.1.2` | | [@octokit/plugin-retry](https://github.com/octokit/plugin-retry.js) | `3.0.9` | `7.1.2` | | [@types/minipass](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/minipass) | `3.1.2` | `3.3.5` | | [js-yaml](https://github.com/nodeca/js-yaml) | `3.13.1` | `4.1.0` | | [@types/js-yaml](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/js-yaml) | `3.12.7` | `4.0.9` | | [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) | `26.0.24` | `29.5.13` | | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `12.20.55` | `22.7.4` | | [@vercel/ncc](https://github.com/vercel/ncc) | `0.36.1` | `0.38.2` | | [prettier](https://github.com/prettier/prettier) | `2.8.8` | `3.3.3` | | [ts-jest](https://github.com/kulshekhar/ts-jest) | `29.2.3` | `29.2.5` | | [typescript](https://github.com/microsoft/TypeScript) | `5.5.4` | `5.6.2` | Updates `@actions/core` from 1.10.0 to 1.10.1 - [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core) Updates `@actions/io` from 1.1.2 to 1.1.3 - [Changelog](https://github.com/actions/toolkit/blob/main/packages/io/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/io) Updates `@actions/tool-cache` from 1.1.2 to 2.0.1 - [Changelog](https://github.com/actions/toolkit/blob/main/packages/tool-cache/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/@actions/artifact@2.0.1/packages/tool-cache) Updates `@octokit/core` from 3.6.0 to 6.1.2 - [Release notes](https://github.com/octokit/core.js/releases) - [Commits](octokit/core.js@v3.6.0...v6.1.2) Updates `@octokit/plugin-retry` from 3.0.9 to 7.1.2 - [Release notes](https://github.com/octokit/plugin-retry.js/releases) - [Commits](octokit/plugin-retry.js@v3.0.9...v7.1.2) Updates `@types/minipass` from 3.1.2 to 3.3.5 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/minipass) Updates `js-yaml` from 3.13.1 to 4.1.0 - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md) - [Commits](nodeca/js-yaml@3.13.1...4.1.0) Updates `@types/js-yaml` from 3.12.7 to 4.0.9 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/js-yaml) Updates `@types/jest` from 26.0.24 to 29.5.13 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest) Updates `@types/js-yaml` from 3.12.7 to 4.0.9 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/js-yaml) Updates `@types/node` from 12.20.55 to 22.7.4 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Updates `@vercel/ncc` from 0.36.1 to 0.38.2 - [Release notes](https://github.com/vercel/ncc/releases) - [Commits](vercel/ncc@0.36.1...0.38.2) Updates `prettier` from 2.8.8 to 3.3.3 - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](prettier/prettier@2.8.8...3.3.3) Updates `ts-jest` from 29.2.3 to 29.2.5 - [Release notes](https://github.com/kulshekhar/ts-jest/releases) - [Changelog](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md) - [Commits](kulshekhar/ts-jest@v29.2.3...v29.2.5) Updates `typescript` from 5.5.4 to 5.6.2 - [Release notes](https://github.com/microsoft/TypeScript/releases) - [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml) - [Commits](microsoft/TypeScript@v5.5.4...v5.6.2) --- updated-dependencies: - dependency-name: "@actions/core" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: "@actions/io" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: "@actions/tool-cache" dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: "@octokit/core" dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: "@octokit/plugin-retry" dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: "@types/minipass" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: js-yaml dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: "@types/js-yaml" dependency-type: direct:development update-type: version-update:semver-major dependency-group: actions - dependency-name: "@types/jest" dependency-type: direct:development update-type: version-update:semver-major dependency-group: actions - dependency-name: "@types/js-yaml" dependency-type: direct:development update-type: version-update:semver-major dependency-group: actions - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-major dependency-group: actions - dependency-name: "@vercel/ncc" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: actions - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-major dependency-group: actions - dependency-name: ts-jest dependency-type: direct:development update-type: version-update:semver-patch dependency-group: actions - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor dependency-group: actions ... Signed-off-by: dependabot[bot] <support@github.com> * code changes to use yaml.loadAll and upgrade of octokit version * few code changes to handle errors * apply prettier formatting * downgrade prettier version since actionsx/prettier@v3 doesn't support the latest version * adding try catch to handle yaml loading * addressing comments * updating assertions for name * apply prettier code --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Vidya Reddy <59590642+Vidya2606@users.noreply.github.com>
1 parent b34f3e7 commit e5725df

10 files changed

Lines changed: 648 additions & 1284 deletions

File tree

package-lock.json

Lines changed: 305 additions & 1028 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@
1212
"format-check": "prettier --check ."
1313
},
1414
"dependencies": {
15-
"@actions/core": "^1.10.0",
15+
"@actions/core": "^1.10.1",
1616
"@actions/exec": "^1.0.0",
17-
"@actions/io": "^1.0.0",
18-
"@actions/tool-cache": "1.1.2",
17+
"@actions/io": "^1.1.3",
18+
"@actions/tool-cache": "2.0.1",
1919
"@octokit/core": "^3.5.1",
2020
"@octokit/plugin-retry": "^3.0.9",
21-
"@types/minipass": "^3.1.2",
22-
"js-yaml": "3.13.1",
21+
"@types/minipass": "^3.3.5",
22+
"js-yaml": "4.1.0",
2323
"minimist": "^1.2.8"
2424
},
2525
"devDependencies": {
26-
"@types/jest": "^26.0.0",
27-
"@types/js-yaml": "^3.12.7",
28-
"@types/node": "^12.20.41",
29-
"@vercel/ncc": "^0.36.1",
26+
"@types/jest": "^29.5.13",
27+
"@types/js-yaml": "^4.0.9",
28+
"@types/node": "^22.7.4",
29+
"@vercel/ncc": "^0.38.2",
3030
"jest": "^29.7.0",
3131
"prettier": "^2.8.8",
32-
"ts-jest": "^29.2.3",
33-
"typescript": "5.5.4"
32+
"ts-jest": "^29.2.5",
33+
"typescript": "5.6.2"
3434
}
3535
}

src/strategyHelpers/blueGreen/blueGreenHelper.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,26 @@ export function getManifestObjects(filePaths: string[]): BlueGreenManifests {
7777
// Manifest objects per type. All resources should be parsed and
7878
// organized before we can check if services are “routed” or not.
7979
filePaths.forEach((filePath: string) => {
80-
const fileContents = fs.readFileSync(filePath).toString()
81-
yaml.safeLoadAll(fileContents, (inputObject) => {
82-
if (!!inputObject) {
83-
const kind = inputObject.kind
84-
85-
if (isDeploymentEntity(kind)) {
86-
deploymentEntityList.push(inputObject)
87-
} else if (isServiceEntity(kind)) {
88-
serviceEntityList.push(inputObject)
89-
} else if (isIngressEntity(kind)) {
90-
ingressEntityList.push(inputObject)
91-
} else {
92-
otherEntitiesList.push(inputObject)
80+
try {
81+
const fileContents = fs.readFileSync(filePath).toString()
82+
yaml.loadAll(fileContents, (inputObject: any) => {
83+
if (!!inputObject) {
84+
const kind = inputObject.kind
85+
if (isDeploymentEntity(kind)) {
86+
deploymentEntityList.push(inputObject)
87+
} else if (isServiceEntity(kind)) {
88+
serviceEntityList.push(inputObject)
89+
} else if (isIngressEntity(kind)) {
90+
ingressEntityList.push(inputObject)
91+
} else {
92+
otherEntitiesList.push(inputObject)
93+
}
9394
}
94-
}
95-
})
95+
})
96+
} catch (error) {
97+
core.error(`Error processing file ${filePath}: ${error.message}`)
98+
throw error
99+
}
96100
})
97101

98102
serviceEntityList.forEach((inputObject: any) => {

src/strategyHelpers/canary/canaryHelper.ts

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -211,25 +211,31 @@ async function cleanUpCanary(
211211
const deletedFiles: string[] = []
212212

213213
for (const filePath of files) {
214-
const fileContents = fs.readFileSync(filePath).toString()
215-
216-
const parsedYaml = yaml.safeLoadAll(fileContents)
217-
for (const inputObject of parsedYaml) {
218-
const name = inputObject.metadata.name
219-
const kind = inputObject.kind
220-
const namespace: string | undefined = inputObject?.metadata?.namespace
221-
222-
if (
223-
isDeploymentEntity(kind) ||
224-
(includeServices && isServiceEntity(kind))
225-
) {
226-
deletedFiles.push(filePath)
227-
const canaryObjectName = getCanaryResourceName(name)
228-
const baselineObjectName = getBaselineResourceName(name)
229-
230-
await deleteObject(kind, canaryObjectName, namespace)
231-
await deleteObject(kind, baselineObjectName, namespace)
214+
try {
215+
const fileContents = fs.readFileSync(filePath).toString()
216+
217+
const parsedYaml: any[] = yaml.loadAll(fileContents)
218+
for (const inputObject of parsedYaml) {
219+
const name = inputObject.metadata.name
220+
const kind = inputObject.kind
221+
const namespace: string | undefined =
222+
inputObject?.metadata?.namespace
223+
224+
if (
225+
isDeploymentEntity(kind) ||
226+
(includeServices && isServiceEntity(kind))
227+
) {
228+
deletedFiles.push(filePath)
229+
const canaryObjectName = getCanaryResourceName(name)
230+
const baselineObjectName = getBaselineResourceName(name)
231+
232+
await deleteObject(kind, canaryObjectName, namespace)
233+
await deleteObject(kind, baselineObjectName, namespace)
234+
}
232235
}
236+
} catch (error) {
237+
core.error(`Failed to process file ${filePath}: ${error.message}`)
238+
throw error
233239
}
234240
}
235241

src/strategyHelpers/canary/podCanaryHelper.ts

Lines changed: 63 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as canaryDeploymentHelper from './canaryHelper'
88
import {isDeploymentEntity} from '../../types/kubernetesTypes'
99
import {getReplicaCount} from '../../utilities/manifestUpdateUtils'
1010
import {DeployResult} from '../../types/deployResult'
11+
import {K8sObject} from '../../types/k8sObject'
1112

1213
export async function deployPodCanary(
1314
filePaths: string[],
@@ -21,50 +22,73 @@ export async function deployPodCanary(
2122
throw Error('Percentage must be between 0 and 100')
2223

2324
for (const filePath of filePaths) {
24-
const fileContents = fs.readFileSync(filePath).toString()
25-
const parsedYaml = yaml.safeLoadAll(fileContents)
26-
for (const inputObject of parsedYaml) {
27-
const name = inputObject.metadata.name
28-
const kind = inputObject.kind
25+
try {
26+
const fileContents = fs.readFileSync(filePath, 'utf8')
27+
const parsedYaml = yaml.loadAll(fileContents)
28+
for (const inputObject of parsedYaml) {
29+
if (
30+
inputObject &&
31+
typeof inputObject === 'object' &&
32+
'metadata' in inputObject &&
33+
'kind' in inputObject &&
34+
'spec' in inputObject &&
35+
typeof inputObject.metadata === 'object' &&
36+
'name' in inputObject.metadata &&
37+
typeof inputObject.metadata.name === 'string' &&
38+
typeof inputObject.kind === 'string'
39+
) {
40+
const obj = inputObject as K8sObject
41+
const name = obj.metadata.name
42+
const kind = obj.kind
2943

30-
if (!onlyDeployStable && isDeploymentEntity(kind)) {
31-
core.debug('Calculating replica count for canary')
32-
const canaryReplicaCount = calculateReplicaCountForCanary(
33-
inputObject,
34-
percentage
35-
)
36-
core.debug('Replica count is ' + canaryReplicaCount)
44+
if (!onlyDeployStable && isDeploymentEntity(kind)) {
45+
core.debug('Calculating replica count for canary')
46+
const canaryReplicaCount = calculateReplicaCountForCanary(
47+
obj,
48+
percentage
49+
)
50+
core.debug('Replica count is ' + canaryReplicaCount)
3751

38-
const newCanaryObject = canaryDeploymentHelper.getNewCanaryResource(
39-
inputObject,
40-
canaryReplicaCount
41-
)
42-
newObjectsList.push(newCanaryObject)
52+
const newCanaryObject =
53+
canaryDeploymentHelper.getNewCanaryResource(
54+
obj,
55+
canaryReplicaCount
56+
)
57+
newObjectsList.push(newCanaryObject)
4358

44-
// if there's already a stable object, deploy baseline as well
45-
const stableObject = await canaryDeploymentHelper.fetchResource(
46-
kubectl,
47-
kind,
48-
name
49-
)
50-
if (stableObject) {
51-
core.debug(
52-
`Stable object found for ${kind} ${name}. Creating baseline objects`
53-
)
54-
const newBaselineObject =
55-
canaryDeploymentHelper.getNewBaselineResource(
56-
stableObject,
57-
canaryReplicaCount
58-
)
59-
core.debug(
60-
'New baseline object: ' + JSON.stringify(newBaselineObject)
61-
)
62-
newObjectsList.push(newBaselineObject)
59+
// if there's already a stable object, deploy baseline as well
60+
const stableObject =
61+
await canaryDeploymentHelper.fetchResource(
62+
kubectl,
63+
kind,
64+
name
65+
)
66+
if (stableObject) {
67+
core.debug(
68+
`Stable object found for ${kind} ${name}. Creating baseline objects`
69+
)
70+
const newBaselineObject =
71+
canaryDeploymentHelper.getNewBaselineResource(
72+
stableObject,
73+
canaryReplicaCount
74+
)
75+
core.debug(
76+
'New baseline object: ' +
77+
JSON.stringify(newBaselineObject)
78+
)
79+
newObjectsList.push(newBaselineObject)
80+
}
81+
} else {
82+
// deploy non deployment entity or regular deployments for promote as they are
83+
newObjectsList.push(obj)
84+
}
6385
}
64-
} else {
65-
// deploy non deployment entity or regular deployments for promote as they are
66-
newObjectsList.push(inputObject)
6786
}
87+
} catch (error) {
88+
core.error(
89+
`Failed to parse YAML file at ${filePath}: ${error.message}`
90+
)
91+
throw error
6892
}
6993
}
7094

0 commit comments

Comments
 (0)