Skip to content

Commit

Permalink
Merge pull request #155 from andrebrito16/main
Browse files Browse the repository at this point in the history
fix(node version): Update to Node version 20
  • Loading branch information
filipeforattini authored Jun 10, 2024
2 parents fc64a8f + 64eadbf commit 6b7de44
Show file tree
Hide file tree
Showing 22 changed files with 212 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .github/actions/config-scrapper/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ outputs:
description: ""

runs:
using: "node16"
using: "node20"
main: "index.js"

# runs:
Expand Down
118 changes: 70 additions & 48 deletions .github/actions/config-scrapper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112490,82 +112490,97 @@ const scrappers = src;
const analysisFactory = analysis;
const { templateDetails } = templates;

commonjsGlobal.crypto = {
getRandomValues: (arr) => require$$7__default["default"].randomBytes(arr.length)
};
if (typeof crypto === "undefined") {
commonjsGlobal.crypto = {
getRandomValues: (arr) => require$$7__default["default"].randomBytes(arr.length),
};
} else if (typeof crypto.getRandomValues === "undefined") {
crypto.getRandomValues = (arr) => require$$7__default["default"].randomBytes(arr.length);
}

async function action() {
logger.info('system', `project root dir: ${process.cwd()}`);
logger.info("system", `project root dir: ${process.cwd()}`);

let writeSummary = core.getBooleanInput('writeSummary', { required: true });
let writeSummary = core.getBooleanInput("writeSummary", { required: true });

if (writeSummary) {
await core.summary
.addHeading("🔍 Analyzed", 3)
.addEOL()
.addRaw('This step will read your repository and seak for features to aggregate value!', true)
.addRaw(
templateDetails({
summary: 'Received context:',
content: JSON.stringify(github.context, null, 2),
"This step will read your repository and seak for features to aggregate value!",
true,
)
.addRaw(
templateDetails({
summary: "Received context:",
content: JSON.stringify(github.context, null, 2),
}),
true
true,
)
.write();
}

const evaluateSecrets = core.getBooleanInput('evaluateSecrets');
const evaluateSecrets = core.getBooleanInput("evaluateSecrets");

if (evaluateSecrets) {
const pipelineSecrets = [
'PIPESECRET_KUBE_CONFIG',
'PIPESECRET_REGISTRY_PASSWORD',
'PIPESECRET_REGISTRY_USERNAME',
'PIPESECRET_PIPELINE_DEPLOY_TOKEN',
]
.reduce((acc, s) => {
let value = process.env[s] || '';
let friendlyName = s.replace('PIPESECRET_', '');

"PIPESECRET_KUBE_CONFIG",
"PIPESECRET_REGISTRY_PASSWORD",
"PIPESECRET_REGISTRY_USERNAME",
"PIPESECRET_PIPELINE_DEPLOY_TOKEN",
].reduce((acc, s) => {
let value = process.env[s] || "";
let friendlyName = s.replace("PIPESECRET_", "");

value.length > 0
? logger.info('secret', `${friendlyName} is definied.`)
: logger.info('secret', `${friendlyName} is [not] definied.`);
? logger.info("secret", `${friendlyName} is definied.`)
: logger.info("secret", `${friendlyName} is [not] definied.`);

acc[friendlyName] = !_.isEmpty(value);
return acc
return acc;
}, {});

await core.summary
.addRaw('Secrets analysis')
.addRaw("Secrets analysis")
.addTable([
[{ data: 'secret', header: true }, { data: 'defined', header: true }],
...Object.entries(pipelineSecrets).map(([key, value]) => [ key, `${value}`]),
[
{ data: "secret", header: true },
{ data: "defined", header: true },
],
...Object.entries(pipelineSecrets).map(([key, value]) => [
key,
`${value}`,
]),
])
.write();

if (!Object.values(pipelineSecrets).every(x => x)) {
core.setFailed(new Error('There are non-defined secrets. Please configure your repository with the secrets below in the summary.'));
if (!Object.values(pipelineSecrets).every((x) => x)) {
core.setFailed(
new Error(
"There are non-defined secrets. Please configure your repository with the secrets below in the summary.",
),
);
}
}


const analysis = analysisFactory({
root: process.cwd(),
actor: github.context.actor,
event: github.context.eventName,
environment: 'dev',
environment: "dev",
outputs: {},
});
logger.info('system', `run trigged by [${analysis.event}] event`);

logger.info("system", `run trigged by [${analysis.event}] event`);
analysis.outputs.pwd = analysis.root;
analysis.outputs.event = analysis.event;
analysis.outputs.actor = github.context.actor;
analysis.outputs.environment = 'dev';
analysis.outputs.environment = "dev";

if (analysis.event === 'workflow_dispatch') {
if (analysis.event === "workflow_dispatch") {
await scrappers.eventDispatch(analysis);
} else if (analysis.event === 'deployment') {
} else if (analysis.event === "deployment") {
await scrappers.eventDeployment(analysis);
}

Expand All @@ -112576,25 +112591,32 @@ async function action() {
scrappers.deploy(analysis),
scrappers.repository(analysis),
]);

Object.entries(analysis.outputs)
.forEach(([key, value]) => {
core.setOutput(key, _.isObject(value) ? JSON.stringify(analysis, null, 2) : `${value}`);
});


Object.entries(analysis.outputs).forEach(([key, value]) => {
core.setOutput(
key,
_.isObject(value) ? JSON.stringify(analysis, null, 2) : `${value}`,
);
});

if (writeSummary) {
await core.summary
.addRaw(
templateDetails({
summary: 'Analysis:',
content: JSON.stringify(analysis, null, 2),
templateDetails({
summary: "Analysis:",
content: JSON.stringify(analysis, null, 2),
}),
true
true,
)
.addHeading('Outputs:', 4)
.addHeading("Outputs:", 4)
.addTable([
[{ data: 'key', header: true }, { data: 'value', header: true }],
..._.sortBy(Object.entries(analysis.outputs), '[0]').map(([key, value]) => [ key, `${value}`]),
[
{ data: "key", header: true },
{ data: "value", header: true },
],
..._.sortBy(Object.entries(analysis.outputs), "[0]").map(
([key, value]) => [key, `${value}`],
),
])
.write();
}
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/config-scrapper/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/actions/create-dockerfile/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ inputs:
description: ""

runs:
using: 'node16'
using: 'node20'
main: 'index.js'
2 changes: 1 addition & 1 deletion .github/actions/create-dockerignore/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ inputs:
description: ""

runs:
using: 'node16'
using: 'node20'
main: 'index.js'
2 changes: 1 addition & 1 deletion .github/actions/create-releaserc-file/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ inputs:
description: ""

runs:
using: 'node16'
using: 'node20'
main: 'index.js'

2 changes: 1 addition & 1 deletion .github/actions/k8s-install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ runs:

# pre-job
- name: Setup | Cloning tools
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{inputs.token}}
ref: main
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:

# pre-job
- name: Setup | Cloning repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# job
- name: Pipeline config scrapper
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:

# pre-job
- name: Setup | Cloning repository
uses: actions/checkout@v3
uses: actions/checkout@v4
if: inputs.staticAnalysis
with:
token: "${{secrets.GITHUB_TOKEN}}"
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:

# pre-job
- name: Setup | Cloning repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
# persist-credentials: false
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:

# pre-job
- name: Setup | Cloning repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PIPELINE_DEPLOY_TOKEN }}

Expand Down Expand Up @@ -220,7 +220,7 @@ jobs:

# pre-job
- name: Setup | Cloning repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PIPELINE_DEPLOY_TOKEN }}

Expand Down Expand Up @@ -259,7 +259,7 @@ jobs:

# pre-job
- name: Setup | Cloning tools
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: env/${{needs.Setup.outputs.Environment}}

Expand Down Expand Up @@ -331,13 +331,13 @@ jobs:

# pre-job
- name: Setup | Cloning repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
# persist-credentials: false

- name: Setup | Cloning tools
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: main
path: .pipeline
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/iac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:

# pre-job
- name: Setup | Cloning repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# job
- name: Pipeline config scrapper
Expand All @@ -74,7 +74,7 @@ jobs:

# pre-job
- name: Setup | Cloning repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: '0'
persist-credentials: false
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/mob.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:

# pre-job
- name: Setup | Cloning repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# job
- name: Pipeline config scrapper
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:

# pre-job
- name: Setup | Cloning repository
uses: actions/checkout@v3
uses: actions/checkout@v4
if: inputs.staticAnalysis
with:
token: "${{secrets.GITHUB_TOKEN}}"
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:

# pre-job
- name: Setup | Cloning repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
# persist-credentials: false
Expand Down Expand Up @@ -167,7 +167,7 @@ jobs:

# pre-job
- name: Setup | Cloning repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PIPELINE_DEPLOY_TOKEN }}

Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:

# pre-job
- name: Setup | Cloning repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PIPELINE_DEPLOY_TOKEN }}

Expand Down Expand Up @@ -251,7 +251,7 @@ jobs:

# pre-job
- name: Setup | Cloning tools
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: env/${{needs.Setup.outputs.Environment}}

Expand Down Expand Up @@ -387,7 +387,7 @@ jobs:

# pre-job
- name: Setup | Cloning tools
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: env/${{needs.Setup.outputs.Environment}}

Expand Down Expand Up @@ -423,7 +423,7 @@ jobs:

# pre-job
- name: Setup | Cloning tools
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: env/${{needs.Setup.outputs.Environment}}
fetch-depth: 0
Expand Down
Loading

0 comments on commit 6b7de44

Please sign in to comment.