From fe5c2237425e3482854b2ba07afa533bb589014e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Stolarczuk?= Date: Mon, 15 Jan 2024 15:11:04 +0100 Subject: [PATCH 1/2] [CI] Add Dockerfiles linter --- .github/workflows/hadolint.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/hadolint.yml diff --git a/.github/workflows/hadolint.yml b/.github/workflows/hadolint.yml new file mode 100644 index 0000000000..1674207f70 --- /dev/null +++ b/.github/workflows/hadolint.yml @@ -0,0 +1,32 @@ +# Runs linter for Docker files +name: Hadolint + +on: + workflow_dispatch: + push: + pull_request: + paths: + - '.github/docker/*Dockerfile' + - '.github/workflows/hadolint.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + linux: + name: Hadolint + runs-on: ubuntu-latest + + steps: + - name: Clone the git repo + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Run Hadolint + uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0 + with: + recursive: true + dockerfile: ".github/docker/*Dockerfile" From d08237c69e877a3615b4d80c096f8e8efd8a446a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Stolarczuk?= Date: Mon, 15 Jan 2024 16:31:32 +0100 Subject: [PATCH 2/2] [CI] Fix linter issues in Ubuntu Dockerfile --- .github/docker/ubuntu-22.04.Dockerfile | 17 ++++++++++------- .github/workflows/hadolint.yml | 2 ++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/docker/ubuntu-22.04.Dockerfile b/.github/docker/ubuntu-22.04.Dockerfile index 38161f5b6e..e8e88caa72 100644 --- a/.github/docker/ubuntu-22.04.Dockerfile +++ b/.github/docker/ubuntu-22.04.Dockerfile @@ -1,4 +1,4 @@ -# Copyright (C) 2023 Intel Corporation +# Copyright (C) 2023-2024 Intel Corporation # Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. # See LICENSE.TXT # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -51,20 +51,23 @@ RUN apt-get update \ ${BASE_DEPS} \ ${UR_DEPS} \ ${MISC_DEPS} \ + && rm -rf /var/lib/apt/lists/* \ && apt-get clean all -RUN pip3 install ${UR_PYTHON_DEPS} +# pip package is pinned to a version, but it's probably improperly parsed here +# hadolint ignore=DL3013 +RUN pip3 install --no-cache-dir ${UR_PYTHON_DEPS} # Install DPC++ -COPY install_dpcpp.sh install_dpcpp.sh +COPY install_dpcpp.sh /opt/install_dpcpp.sh ENV DPCPP_PATH=/opt/dpcpp -RUN ./install_dpcpp.sh +RUN /opt/install_dpcpp.sh # Install libbacktrace -COPY install_libbacktrace.sh install_libbacktrace.sh -RUN ./install_libbacktrace.sh +COPY install_libbacktrace.sh /opt/install_libbacktrace.sh +RUN /opt/install_libbacktrace.sh # Add a new (non-root) 'user' ENV USER user ENV USERPASS pass -RUN useradd -m $USER -g sudo -p `mkpasswd $USERPASS` +RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})" diff --git a/.github/workflows/hadolint.yml b/.github/workflows/hadolint.yml index 1674207f70..a1063aefe8 100644 --- a/.github/workflows/hadolint.yml +++ b/.github/workflows/hadolint.yml @@ -30,3 +30,5 @@ jobs: with: recursive: true dockerfile: ".github/docker/*Dockerfile" + # ignore pinning apt packages to versions + ignore: DL3008