diff --git a/regression-tests/__snapshots__/regresion.test.js.snap b/regression-tests/__snapshots__/regresion.test.js.snap index df32cd2..87c4529 100644 --- a/regression-tests/__snapshots__/regresion.test.js.snap +++ b/regression-tests/__snapshots__/regresion.test.js.snap @@ -722,6 +722,102 @@ Array [ "path": "./regression-tests/eventlistener-test.yaml", "rule": "no-missing-resource", }, + Object { + "level": "warning", + "loc": Object { + "endColumn": 20, + "endLine": 9, + "range": Array [ + 130, + 136, + ], + "startColumn": 14, + "startLine": 9, + }, + "message": "Invalid image: 'alpine'. Specify the image tag instead of using ':latest'", + "path": "./regression-tests/no-duplicate-env.yaml", + "rule": "no-latest-image", + }, + Object { + "level": "warning", + "loc": Object { + "endColumn": 20, + "endLine": 21, + "range": Array [ + 318, + 324, + ], + "startColumn": 14, + "startLine": 21, + }, + "message": "Invalid image: 'alpine'. Specify the image tag instead of using ':latest'", + "path": "./regression-tests/no-duplicate-env.yaml", + "rule": "no-latest-image", + }, + Object { + "level": "error", + "loc": Object { + "endColumn": 20, + "endLine": 25, + "range": Array [ + 393, + 396, + ], + "startColumn": 17, + "startLine": 25, + }, + "message": "Step 'step-2' has env variable 'FOO' duplicated in task 'no-duplicate-env-1'.", + "path": "./regression-tests/no-duplicate-env.yaml", + "rule": "no-duplicate-env", + }, + Object { + "level": "warning", + "loc": Object { + "endColumn": 20, + "endLine": 33, + "range": Array [ + 506, + 512, + ], + "startColumn": 14, + "startLine": 33, + }, + "message": "Invalid image: 'alpine'. Specify the image tag instead of using ':latest'", + "path": "./regression-tests/no-duplicate-env.yaml", + "rule": "no-latest-image", + }, + Object { + "level": "warning", + "loc": Object { + "endColumn": 20, + "endLine": 52, + "range": Array [ + 797, + 803, + ], + "startColumn": 14, + "startLine": 52, + }, + "message": "Invalid image: 'alpine'. Specify the image tag instead of using ':latest'", + "path": "./regression-tests/no-duplicate-env.yaml", + "rule": "no-latest-image", + }, + Object { + "level": "warning", + "loc": Object { + "endColumn": 20, + "endLine": 69, + "range": Array [ + 1051, + 1057, + ], + "startColumn": 14, + "startLine": 69, + }, + "message": "Invalid image: 'alpine'. Specify the image tag instead of using ':latest'", + "path": "./regression-tests/no-duplicate-env.yaml", + "rule": "no-latest-image", + }, Object { "level": "warning", "loc": Object { diff --git a/regression-tests/no-duplicate-env.yaml b/regression-tests/no-duplicate-env.yaml new file mode 100644 index 0000000..835c821 --- /dev/null +++ b/regression-tests/no-duplicate-env.yaml @@ -0,0 +1,76 @@ +--- +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: no-duplicate-env-1 +spec: + steps: + - name: step-1 + image: alpine + env: + - name: FOO + value: foo + - name: BAR + value: bar + script: | + #!/bin/sh + + echo ${FOO} + + - name: step-2 + image: alpine + env: + - name: FOO + value: foo + - name: FOO + value: foo + script: | + #!/bin/sh + + echo ${FOO} + + - name: step-3 + image: alpine + script: | + #!/bin/sh + + echo ${FOO} +--- +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: no-duplicate-env-2 +spec: + stepTemplate: + env: + - name: FOO + value: foo + - name: FOO + value: foo + steps: + - name: step-1 + image: alpine + script: | + #!/bin/sh + + echo ${FOO} +--- +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: no-duplicate-env-3 +spec: + stepTemplate: + env: + - name: FOO + value: foo + steps: + - name: step-1 + image: alpine + env: + - name: FOO + value: foo + script: | + #!/bin/sh + + echo ${FOO}