Skip to content

Commit 4dc0977

Browse files
authored
July 2025 Update (#36)
* fixed wordings and typos * Catch error if pods are not initilized for logs * Changed how to get Version * moved semphore to functions * updated wording for pipelines * fixed output for gathering logs
1 parent 4455206 commit 4dc0977

File tree

5 files changed

+26
-21
lines changed

5 files changed

+26
-21
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ The binary is built on using `ubuntu-latest`. You can find what is included in
2626
### macOS - arm64
2727

2828
```shell
29-
# get the latest version or change to a specific version
30-
VERSION=$(curl --silent "https://api.github.com/repos/codefresh-support/codefresh-support-package/releases/latest" | jq -r ".tag_name")
29+
# Get the version at https://github.com/codefresh-support/codefresh-support-package/releases
30+
VERSION=v#.#.#
3131

3232
# download and extract the binary
3333
curl -L --output - https://github.com/codefresh-support/codefresh-support-package/releases/download/$VERSION/cf-support_darwin_arm64.tar.gz | tar -zx -O cf-support_darwin_arm64 > cf-support
@@ -42,8 +42,8 @@ chmod +x cf-support
4242
### macOS - amd64
4343

4444
```shell
45-
# get the latest version or change to a specific version
46-
VERSION=$(curl --silent "https://api.github.com/repos/codefresh-support/codefresh-support-package/releases/latest" | jq -r ".tag_name")
45+
# Get the version at https://github.com/codefresh-support/codefresh-support-package/releases
46+
VERSION=v#.#.#
4747

4848
# download and extract the binary
4949
curl -L --output - https://github.com/codefresh-support/codefresh-support-package/releases/download/$VERSION/cf-support_darwin_amd64.tar.gz | tar -zx -O cf-support_darwin_amd64 > cf-support
@@ -58,8 +58,8 @@ chmod +x cf-support
5858
### linux - arm64
5959

6060
```shell
61-
# get the latest version or change to a specific version
62-
VERSION=$(curl --silent "https://api.github.com/repos/codefresh-support/codefresh-support-package/releases/latest" | jq -r ".tag_name")
61+
# Get the version at https://github.com/codefresh-support/codefresh-support-package/releases
62+
VERSION=v#.#.#
6363

6464
# download and extract the binary
6565
curl -L --output - https://github.com/codefresh-support/codefresh-support-package/releases/download/$VERSION/cf-support_linux_arm64.tar.gz | tar -zx -O cf-support_linux_arm64 > cf-support
@@ -74,8 +74,8 @@ chmod +x cf-support
7474
### linux - amd64
7575

7676
```shell
77-
# get the latest version or change to a specific version
78-
VERSION=$(curl --silent "https://api.github.com/repos/codefresh-support/codefresh-support-package/releases/latest" | jq -r ".tag_name")
77+
# Get the version at https://github.com/codefresh-support/codefresh-support-package/releases
78+
VERSION=v#.#.#
7979

8080
# download and extract the binary
8181
curl -L --output - https://github.com/codefresh-support/codefresh-support-package/releases/download/$VERSION/cf-support_linux_amd64.tar.gz | tar -zx -O cf-support_linux_amd64 > cf-support

src/gitops.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export async function gitops(namespace) {
99
namespace = selected;
1010
}
1111

12-
console.log(`Gatheing data in the '${namespace}' namespace for the GitOps Runtime`);
12+
console.log(`Gathering data in the '${namespace}' namespace for the GitOps Runtime`);
1313
const k8sResources = getResources(namespace);
1414
await processData(dirPath, k8sResources);
1515
await preparePackage(dirPath);

src/logic/core.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,16 @@ import { tgz } from '@deno-library/compress';
33
import { getPodLogs } from './k8s.js';
44
import { getSemaphore } from '@henrygd/semaphore';
55

6-
const semaphore = getSemaphore('supportPackageSemaphore', 10);
6+
77

88
export async function writeYaml(data, name, dirPath) {
9-
await semaphore.acquire();
10-
try {
11-
await Deno.mkdir(dirPath, { recursive: true });
12-
const filePath = `${dirPath}/${name}.yaml`;
13-
await Deno.writeTextFile(filePath, toYaml(data, { skipInvalid: true }));
14-
} finally {
15-
semaphore.release();
16-
}
9+
await Deno.mkdir(dirPath, { recursive: true });
10+
const filePath = `${dirPath}/${name}.yaml`;
11+
await Deno.writeTextFile(filePath, toYaml(data, { skipInvalid: true }));
1712
}
1813

1914
export async function preparePackage(dirPath) {
15+
const semaphore = getSemaphore("zipfile", 10);
2016
await semaphore.acquire();
2117
try {
2218
const supportPackageZip = `${dirPath}.tar.gz`;
@@ -40,6 +36,9 @@ export async function processData(dirPath, k8sResources) {
4036
continue;
4137
}
4238

39+
const semaphore = getSemaphore(k8sType, 10);
40+
console.log(`Processing Data for ${k8sType}`)
41+
4342
if (k8sType == 'pods') {
4443
for (const pod of resources.items) {
4544
await semaphore.acquire();
@@ -48,7 +47,8 @@ export async function processData(dirPath, k8sResources) {
4847

4948
await writeYaml(pod, `spec_${pod.metadata.name}`, `${dirPath}/${k8sType}/${pod.metadata.name}`);
5049

51-
const logs = await getPodLogs(pod);
50+
const logs = await getPodLogs(pod.metadata.name);
51+
console.log(`Gathering logs for pod ${pod}`);
5252
for (const [containerName, logData] of Object.entries(logs)) {
5353
await Deno.writeTextFile(
5454
`${dirPath}/${k8sType}/${pod.metadata.name}/log_${containerName}.log`,

src/logic/k8s.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,14 @@ export async function getPodLogs(pod) {
3838

3939
const logs = {};
4040
for (const container of containers) {
41-
logs[container] = await coreApi
41+
try {
42+
logs[container] = await coreApi
4243
.namespace(namespace)
4344
.getPodLog(podName, { container: container, timestamps: true });
45+
} catch (error) {
46+
logs[container] = error
47+
}
48+
4449
}
4550
return logs;
4651
}

src/pipelines.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export async function pipelines(namespace, runtime) {
3838
}
3939
}
4040

41-
console.log(`Gathering data in the '${namespace}' namespace for Codefresh OnPrem`);
41+
console.log(`Gathering data in the '${namespace}' namespace for Pipelines Runtime`);
4242
const k8sResources = getResources(namespace);
4343
await processData(dirPath, k8sResources);
4444
await preparePackage(dirPath);

0 commit comments

Comments
 (0)