Skip to content

Commit ac6bf96

Browse files
Upgrade editorconfig-checker + set ARGs at the beginning of dockerfile (#3528)
* Bump mstruebing/editorconfig-checker from 2.7.2 to v3.0.1 Bumps mstruebing/editorconfig-checker from 2.7.2 to v3.0.1. --- updated-dependencies: - dependency-name: mstruebing/editorconfig-checker dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Use latest version of editorconfig-checker * Reorder args * Build: Write ARG lines at the top of Dockerfiles if they are used by FROM variables Related to #3525 * cspell * [MegaLinter] Apply linters fixes * Fix ARM test cases * Remove workflow telemetry to improve perfs * Remove editorconfig trivy exception --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: nvuillam <[email protected]>
1 parent c3a1f10 commit ac6bf96

File tree

149 files changed

+1466
-171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+1466
-171
lines changed

.automation/build.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,17 @@ def build_dockerfile(
418418
# Add ruby apk packages if gem packages are here
419419
if len(gem_packages) > 0:
420420
apk_packages += ["ruby", "ruby-dev", "ruby-bundler", "ruby-rdoc"]
421+
# Separate args used in FROM instructions from others
422+
all_from_instructions = "\n".join(list(dict.fromkeys(docker_from)))
423+
docker_arg_top = []
424+
docker_arg_main = []
425+
for docker_arg_item in docker_arg:
426+
match = re.match(r"ARG\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*=?\s*", docker_arg_item)
427+
arg_name = match.group(1)
428+
if arg_name in all_from_instructions:
429+
docker_arg_top += [docker_arg_item]
430+
else:
431+
docker_arg_main += [docker_arg_item]
421432
# Replace between tags in Dockerfile
422433
# Commands
423434
replace_in_file(
@@ -426,11 +437,17 @@ def build_dockerfile(
426437
"#FROM__END",
427438
"\n".join(list(dict.fromkeys(docker_from))),
428439
)
440+
replace_in_file(
441+
dockerfile,
442+
"#ARGTOP__START",
443+
"#ARGTOP__END",
444+
"\n".join(list(dict.fromkeys(docker_arg_top))),
445+
)
429446
replace_in_file(
430447
dockerfile,
431448
"#ARG__START",
432449
"#ARG__END",
433-
"\n".join(list(dict.fromkeys(docker_arg))),
450+
"\n".join(list(dict.fromkeys(docker_arg_main))),
434451
)
435452
replace_in_file(
436453
dockerfile,

.automation/test/arm/arm_good_1.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
{
3131
"name": "[variables('Network.Name')]",
3232
"type": "Microsoft.Network/virtualNetworks",
33-
"apiVersion": "2022-05-01",
33+
"apiVersion": "2023-04-01",
3434
"location": "[variables('Network.Location')]",
3535
"tags": "[variables('Network.Tags')]",
3636
"properties": {
@@ -47,7 +47,7 @@
4747
"outputs": {
4848
"state": {
4949
"type": "object",
50-
"value": "[reference(resourceId('Microsoft.Network/virtualNetworks',variables('Network.Name')), '2022-05-01', 'Full')]"
50+
"value": "[reference(resourceId('Microsoft.Network/virtualNetworks',variables('Network.Name')), '2023-04-01', 'Full')]"
5151
}
5252
}
5353
}

.cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"report"
1717
],
1818
"ignoreWords": [
19+
"ARGTOP",
1920
"AROA47DSWDEZA3",
2021
"Chandan",
2122
"Cpageref",

.github/workflows/deploy-DEV-linters.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ jobs:
179179
# Load all steps #
180180
##################
181181
steps:
182-
- name: Collect Workflow Telemetry
183-
uses: runforesight/workflow-telemetry-action@v1
184-
with:
185-
comment_on_pr: false
182+
# - name: Collect Workflow Telemetry
183+
# uses: runforesight/workflow-telemetry-action@v1
184+
# with:
185+
# comment_on_pr: false
186186

187187
- name: Checkout Code
188188
uses: actions/checkout@v4

.trivyignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ CVE-2018-8292
55
CVE-2023-29331
66
CVE-2019-0820
77

8-
# editorconfig-checker
9-
# https://github.com/editorconfig-checker/editorconfig-checker/issues/342
10-
CVE-2023-39325
11-
128
# gitleaks
139
# Solved in next gitleaks release: https://github.com/gitleaks/gitleaks/pull/1342
1410
CVE-2021-38561

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l
3333
- Build: take in account disabled linters for workflow auto-update
3434
- Remove useless package-lock.json that was in python tests folder
3535
- Fix SARIF_REPORTER that was wrongly sent to `true` to format & fix test methods
36+
- Build: Write ARG lines at the top of Dockerfiles if they are used by FROM variables
37+
- Remove Github Actions Workflow telemetry to improve performances
3638

3739
- Linter versions upgrades
3840
- [phpcs](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.9.1 to **3.9.2** on 2024-04-23

Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77

88
# @not-generated
99

10+
#############################################################################################
11+
## @generated by .automation/build.py using descriptor files, please do not update manually ##
12+
#############################################################################################
13+
#ARGTOP__START
14+
ARG VERSION_EDITORCONFIG_CHECKER=latest
15+
#ARGTOP__END
16+
1017
#############################################################################################
1118
## @generated by .automation/build.py using descriptor files, please do not update manually ##
1219
#############################################################################################
@@ -19,7 +26,7 @@ FROM koalaman/shellcheck:stable as shellcheck
1926
# FROM koalaman/shellcheck:stable as shellcheck
2027
FROM mvdan/shfmt:latest-alpine as shfmt
2128
FROM hadolint/hadolint:v2.12.0-alpine as hadolint
22-
FROM mstruebing/editorconfig-checker:2.7.2 as editorconfig-checker
29+
FROM mstruebing/editorconfig-checker:$VERSION_EDITORCONFIG_CHECKER as editorconfig-checker
2330
FROM golang:1-alpine as revive
2431
## The golang image used as a builder is a temporary workaround (https://github.com/mgechev/revive/issues/787)
2532
## for the released revive binaries not returning version numbers (devel).
@@ -50,7 +57,6 @@ FROM alpine/terragrunt:latest as terragrunt
5057
# Get base image #
5158
##################
5259
FROM python:3.12.3-alpine3.19
53-
ARG GITHUB_TOKEN
5460

5561
#############################################################################################
5662
## @generated by .automation/build.py using descriptor files, please do not update manually ##
@@ -67,6 +73,9 @@ ARG PMD_VERSION=7.1.0
6773
ARG PSSA_VERSION='latest'
6874
#ARG__END
6975

76+
# Static args
77+
ARG GITHUB_TOKEN
78+
7079
####################
7180
# Run APK installs #
7281
####################

flavors/c_cpp/Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88

99
# @not-generated
1010

11+
#############################################################################################
12+
## @generated by .automation/build.py using descriptor files, please do not update manually ##
13+
#############################################################################################
14+
#ARGTOP__START
15+
ARG VERSION_EDITORCONFIG_CHECKER=latest
16+
#ARGTOP__END
17+
1118
#############################################################################################
1219
## @generated by .automation/build.py using descriptor files, please do not update manually ##
1320
#############################################################################################
@@ -20,7 +27,7 @@ FROM koalaman/shellcheck:stable as shellcheck
2027
# FROM koalaman/shellcheck:stable as shellcheck
2128
FROM mvdan/shfmt:latest-alpine as shfmt
2229
FROM hadolint/hadolint:v2.12.0-alpine as hadolint
23-
FROM mstruebing/editorconfig-checker:2.7.2 as editorconfig-checker
30+
FROM mstruebing/editorconfig-checker:$VERSION_EDITORCONFIG_CHECKER as editorconfig-checker
2431
FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform
2532
FROM mrtazz/checkmake:latest as checkmake
2633
FROM yoheimuta/protolint:latest as protolint
@@ -34,7 +41,6 @@ FROM lycheeverse/lychee:latest-alpine as lychee
3441
# Get base image #
3542
##################
3643
FROM python:3.12.3-alpine3.19
37-
ARG GITHUB_TOKEN
3844

3945
#############################################################################################
4046
## @generated by .automation/build.py using descriptor files, please do not update manually ##
@@ -43,6 +49,9 @@ ARG GITHUB_TOKEN
4349

4450
#ARG__END
4551

52+
# Static args
53+
ARG GITHUB_TOKEN
54+
4655
####################
4756
# Run APK installs #
4857
####################

flavors/ci_light/Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88

99
# @not-generated
1010

11+
#############################################################################################
12+
## @generated by .automation/build.py using descriptor files, please do not update manually ##
13+
#############################################################################################
14+
#ARGTOP__START
15+
16+
#ARGTOP__END
17+
1118
#############################################################################################
1219
## @generated by .automation/build.py using descriptor files, please do not update manually ##
1320
#############################################################################################
@@ -24,7 +31,6 @@ FROM trufflesecurity/trufflehog:latest as trufflehog
2431
# Get base image #
2532
##################
2633
FROM python:3.12.3-alpine3.19
27-
ARG GITHUB_TOKEN
2834

2935
#############################################################################################
3036
## @generated by .automation/build.py using descriptor files, please do not update manually ##
@@ -33,6 +39,9 @@ ARG GITHUB_TOKEN
3339

3440
#ARG__END
3541

42+
# Static args
43+
ARG GITHUB_TOKEN
44+
3645
####################
3746
# Run APK installs #
3847
####################

flavors/cupcake/Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88

99
# @not-generated
1010

11+
#############################################################################################
12+
## @generated by .automation/build.py using descriptor files, please do not update manually ##
13+
#############################################################################################
14+
#ARGTOP__START
15+
ARG VERSION_EDITORCONFIG_CHECKER=latest
16+
#ARGTOP__END
17+
1118
#############################################################################################
1219
## @generated by .automation/build.py using descriptor files, please do not update manually ##
1320
#############################################################################################
@@ -20,7 +27,7 @@ FROM koalaman/shellcheck:stable as shellcheck
2027
# FROM koalaman/shellcheck:stable as shellcheck
2128
FROM mvdan/shfmt:latest-alpine as shfmt
2229
FROM hadolint/hadolint:v2.12.0-alpine as hadolint
23-
FROM mstruebing/editorconfig-checker:2.7.2 as editorconfig-checker
30+
FROM mstruebing/editorconfig-checker:$VERSION_EDITORCONFIG_CHECKER as editorconfig-checker
2431
FROM golang:1-alpine as revive
2532
## The golang image used as a builder is a temporary workaround (https://github.com/mgechev/revive/issues/787)
2633
## for the released revive binaries not returning version numbers (devel).
@@ -45,7 +52,6 @@ FROM alpine/terragrunt:latest as terragrunt
4552
# Get base image #
4653
##################
4754
FROM python:3.12.3-alpine3.19
48-
ARG GITHUB_TOKEN
4955

5056
#############################################################################################
5157
## @generated by .automation/build.py using descriptor files, please do not update manually ##
@@ -54,6 +60,9 @@ ARG GITHUB_TOKEN
5460
ARG PMD_VERSION=7.1.0
5561
#ARG__END
5662

63+
# Static args
64+
ARG GITHUB_TOKEN
65+
5766
####################
5867
# Run APK installs #
5968
####################

0 commit comments

Comments
 (0)