From da91c0d2b990010561a59ae1e112f5215caf3ff1 Mon Sep 17 00:00:00 2001 From: Gaelle Fournier Date: Fri, 14 Jun 2024 12:51:50 +0200 Subject: [PATCH 1/3] feat(ci): check licenses on PRs --- .github/workflows/licenses.yaml | 62 +++++++++++++++++++++++++++++++++ .github/workflows/security.yaml | 2 +- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/licenses.yaml diff --git a/.github/workflows/licenses.yaml b/.github/workflows/licenses.yaml new file mode 100644 index 0000000000..46b7e68851 --- /dev/null +++ b/.github/workflows/licenses.yaml @@ -0,0 +1,62 @@ +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +name: licenses + +on: + pull_request: + branches: + - main + - "release-*" + paths-ignore: + - 'proposals/**' + - '**.adoc' + - '**.md' + - 'KEYS' + - 'LICENSE' + - 'NOTICE' + push: + branches: + - main + - "release-*" + paths-ignore: + - 'proposals/**' + - '**.md' + - '**.adoc' + - 'KEYS' + - 'LICENSE' + - 'NOTICE' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + +jobs: + licenses: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + check-latest: true + - name: licenses + shell: bash + run: | + make check-licenses \ No newline at end of file diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml index 23d9b49e54..cc4ccc964d 100644 --- a/.github/workflows/security.yaml +++ b/.github/workflows/security.yaml @@ -51,7 +51,7 @@ jobs: with: go-version-file: 'go.mod' check-latest: true - - name: lint + - name: vuln shell: bash run: | make vuln From 69f0e6532249cf00f2b6e8fd7c106e79dd5e7014 Mon Sep 17 00:00:00 2001 From: Gaelle Fournier Date: Fri, 14 Jun 2024 14:15:35 +0200 Subject: [PATCH 2/3] fix(ci): Fix check licence exit value --- script/check_licenses.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/check_licenses.sh b/script/check_licenses.sh index c66e63da8c..e9c31f04a2 100755 --- a/script/check_licenses.sh +++ b/script/check_licenses.sh @@ -29,7 +29,7 @@ check_licenses() { set +e failed=0 - find . -type f -name "$files" -print0 | while IFS= read -r -d '' file; do + while IFS= read -r -d '' file; do check=true for b in ${denylist[*]}; do if [[ "$file" == *"$b"* ]]; then @@ -44,7 +44,7 @@ check_licenses() { failed=1 fi fi - done + done < <(find . -type f -name "$files" -print0) set -e if [ $failed -ne 0 ]; then From 02b6f29848db1adda2b01385ee1434e2e1b9ca6d Mon Sep 17 00:00:00 2001 From: Gaelle Fournier Date: Fri, 14 Jun 2024 14:36:24 +0200 Subject: [PATCH 3/3] chore(ci): Add missing licenses --- .github/workflows/licenses.yaml | 62 -------------------- .github/workflows/validate.yml | 26 +++++--- e2e/advanced/files/camel-k-tekton.yaml | 17 ++++++ e2e/advanced/files/promote-route-edited.yaml | 2 + e2e/advanced/files/promote-route.yaml | 2 + e2e/advanced/files/timer-kamelet-usage.yaml | 2 + e2e/advanced/files/timer-source.yaml | 2 + e2e/common/traits/files/PodTest.yaml | 2 + 8 files changed, 45 insertions(+), 70 deletions(-) delete mode 100644 .github/workflows/licenses.yaml diff --git a/.github/workflows/licenses.yaml b/.github/workflows/licenses.yaml deleted file mode 100644 index 46b7e68851..0000000000 --- a/.github/workflows/licenses.yaml +++ /dev/null @@ -1,62 +0,0 @@ -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -name: licenses - -on: - pull_request: - branches: - - main - - "release-*" - paths-ignore: - - 'proposals/**' - - '**.adoc' - - '**.md' - - 'KEYS' - - 'LICENSE' - - 'NOTICE' - push: - branches: - - main - - "release-*" - paths-ignore: - - 'proposals/**' - - '**.md' - - '**.adoc' - - 'KEYS' - - 'LICENSE' - - 'NOTICE' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} - cancel-in-progress: true - -jobs: - licenses: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version-file: 'go.mod' - check-latest: true - - name: licenses - shell: bash - run: | - make check-licenses \ No newline at end of file diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 6a9a371e3e..8384947035 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -22,18 +22,24 @@ on: branches: - main - "release-*" - paths: - - 'pkg/**' - - 'cmd/**' - - 'addons/**' + paths-ignore: + - 'proposals/**' + - '**.adoc' + - '**.md' + - 'KEYS' + - 'LICENSE' + - 'NOTICE' push: branches: - main - "release-*" - paths: - - 'pkg/**' - - 'cmd/**' - - 'addons/**' + paths-ignore: + - 'proposals/**' + - '**.md' + - '**.adoc' + - 'KEYS' + - 'LICENSE' + - 'NOTICE' concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} @@ -54,3 +60,7 @@ jobs: shell: bash run: | make lint + - name: licenses + shell: bash + run: | + make check-licenses \ No newline at end of file diff --git a/e2e/advanced/files/camel-k-tekton.yaml b/e2e/advanced/files/camel-k-tekton.yaml index 6cee0a139a..16c663b30f 100644 --- a/e2e/advanced/files/camel-k-tekton.yaml +++ b/e2e/advanced/files/camel-k-tekton.yaml @@ -1,3 +1,20 @@ +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + --- apiVersion: v1 kind: ServiceAccount diff --git a/e2e/advanced/files/promote-route-edited.yaml b/e2e/advanced/files/promote-route-edited.yaml index 448240a69e..6556fc0328 100644 --- a/e2e/advanced/files/promote-route-edited.yaml +++ b/e2e/advanced/files/promote-route-edited.yaml @@ -1,5 +1,6 @@ # camel-k: language=yaml +# --------------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. @@ -14,6 +15,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# --------------------------------------------------------------------------- - from: uri: "timer:configmap" diff --git a/e2e/advanced/files/promote-route.yaml b/e2e/advanced/files/promote-route.yaml index cb915b6efa..290a2ac02f 100644 --- a/e2e/advanced/files/promote-route.yaml +++ b/e2e/advanced/files/promote-route.yaml @@ -1,5 +1,6 @@ # camel-k: language=yaml +# --------------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. @@ -14,6 +15,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# --------------------------------------------------------------------------- - from: uri: "timer:configmap" diff --git a/e2e/advanced/files/timer-kamelet-usage.yaml b/e2e/advanced/files/timer-kamelet-usage.yaml index c04b36b556..206ba027b0 100644 --- a/e2e/advanced/files/timer-kamelet-usage.yaml +++ b/e2e/advanced/files/timer-kamelet-usage.yaml @@ -1,3 +1,4 @@ +# --------------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. @@ -12,6 +13,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# --------------------------------------------------------------------------- - from: uri: "kamelet:my-own-timer-source?message=Hello+world" diff --git a/e2e/advanced/files/timer-source.yaml b/e2e/advanced/files/timer-source.yaml index e80528db13..36a97142cb 100644 --- a/e2e/advanced/files/timer-source.yaml +++ b/e2e/advanced/files/timer-source.yaml @@ -1,5 +1,6 @@ # camel-k: language=yaml +# --------------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. @@ -14,6 +15,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# --------------------------------------------------------------------------- - from: uri: "kamelet:timer-source?message=Magicstring!&period=3000" diff --git a/e2e/common/traits/files/PodTest.yaml b/e2e/common/traits/files/PodTest.yaml index 08f71974b0..a8b6bcb80b 100644 --- a/e2e/common/traits/files/PodTest.yaml +++ b/e2e/common/traits/files/PodTest.yaml @@ -1,5 +1,6 @@ # camel-k: language=yaml +# --------------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. @@ -14,6 +15,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# --------------------------------------------------------------------------- - from: uri: "file:///var/log"