From 6b686411c7e2045aaa482b7c71173e39cc573787 Mon Sep 17 00:00:00 2001 From: Marcus Young Date: Sat, 10 Sep 2022 19:21:17 -0500 Subject: [PATCH] Set up pre-commit --- .github/workflows/base.yml | 4 ++-- .github/workflows/deploy.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 ++ .pre-commit-config.yaml | 12 ++++++++---- Dockerfile.base | 6 +++--- SECURITY.md | 2 +- 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index f69eaaca..5438db7c 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -38,7 +38,7 @@ jobs: platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max - + ubuntu_base_deploy: runs-on: ubuntu-latest strategy: @@ -72,7 +72,7 @@ jobs: platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max - + debian_base_deploy: runs-on: ubuntu-latest strategy: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f9e614bf..d2a69cde 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -23,7 +23,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Update Dockerfile FROM org - run: sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:latest/" Dockerfile + run: sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:latest/" Dockerfile - name: Login to DockerHub uses: docker/login-action@v1 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e90573e..94215f76 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,7 +37,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Update Dockerfile FROM org - run: sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:latest/" Dockerfile + run: sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:latest/" Dockerfile - name: Login to DockerHub uses: docker/login-action@v1 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 27c345d5..cc8a04eb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,5 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0 - name: Run ShellCheck uses: ludeeus/action-shellcheck@master diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8cf1e776..bc90e968 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,9 +1,13 @@ repos: -- repo: git://github.com/detailyang/pre-commit-shell - rev: 1.0.2 +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 hooks: - - id: shell-lint - args: [-e, SC1008] + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-case-conflict + - id: check-merge-conflict + - id: detect-private-key - repo: https://github.com/stratasan/hadolint-pre-commit rev: cdefcb096e520a6daa9552b1d4636f5f1e1729cd hooks: diff --git a/Dockerfile.base b/Dockerfile.base index e24333e9..ce065b6c 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -11,7 +11,7 @@ ENV LANGUAGE=en_US.UTF-8 ENV LC_ALL=en_US.UTF-8 SHELL ["/bin/bash", "-o", "pipefail", "-c"] ENV DEBIAN_FRONTEND=noninteractive -# hadolint ignore=DL3003,DL4001,SC2086 +# hadolint ignore=SC2086,DL3015 RUN echo en_US.UTF-8 UTF-8 >> /etc/locale.gen \ && apt-get update \ && apt-get install -y --no-install-recommends gnupg \ @@ -54,7 +54,7 @@ RUN echo en_US.UTF-8 UTF-8 >> /etc/locale.gen \ && ( apt-get install -y --no-install-recommends git || apt-get install -t stable -y --no-install-recommends git || apt-get install -y --no-install-recommends git=1:2.33.1-0ppa1~ubuntu18.04.1 git-man=1:2.33.1-0ppa1~ubuntu18.04.1 ) \ && ( [[ $(apt-cache search -n liblttng-ust0 | awk '{print $1}') == "liblttng-ust0" ]] && apt-get install -y --no-install-recommends liblttng-ust0 || : ) \ && ( [[ $(apt-cache search -n liblttng-ust1 | awk '{print $1}') == "liblttng-ust1" ]] && apt-get install -y --no-install-recommends liblttng-ust1 || : ) \ - && ( ( curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && unzip awscliv2.zip -d /tmp/ && /tmp/aws/install && rm awscliv2.zip) || pip3 install awscli ) \ + && ( ( curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && unzip awscliv2.zip -d /tmp/ && /tmp/aws/install && rm awscliv2.zip) || pip3 install --no-cache-dir awscli ) \ && ( curl -s "https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/git-lfs-linux-${DPKG_ARCH}-v${GIT_LFS_VERSION}.tar.gz" -L -o /tmp/lfs.tar.gz && tar -xzf /tmp/lfs.tar.gz -C /tmp && /tmp/git-lfs-${GIT_LFS_VERSION}/install.sh && rm -rf /tmp/lfs.tar.gz /tmp/git-lfs-${GIT_LFS_VERSION}) \ # Determine the Distro name (Debian, Ubuntu, etc) && distro=$(lsb_release -is | awk '{print tolower($0)}') \ @@ -70,7 +70,7 @@ RUN echo en_US.UTF-8 UTF-8 >> /etc/locale.gen \ && ( [[ "${LSB_RELEASE_CODENAME}" == "focal" ]] && ( echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /" | tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list && curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/Release.key" | apt-key add - && apt-get update) || : ) \ && ( [[ "${LSB_RELEASE_CODENAME}" == "focal" || "${LSB_RELEASE_CODENAME}" == "jammy" || "${LSB_RELEASE_CODENAME}" == "sid" || "${LSB_RELEASE_CODENAME}" == "bullseye" ]] && apt-get install -y --no-install-recommends podman buildah skopeo || : ) \ && ( [[ "${LSB_RELEASE_CODENAME}" == "jammy" ]] && echo "Ubuntu Jammy is marked as beta. Please see https://github.com/actions/virtual-environments/issues/5490" || : ) \ - && GH_CLI_INSTALL_FILE="/tmp/gh-$$.deb" && curl -sSLo "${GH_CLI_INSTALL_FILE}" "https://github.com$(curl -sSL "https://github.com/cli/cli/releases/latest" | grep -Po "(?<=href=\")/cli/cli/releases/download/[^\"]*${DPKG_ARCH}[.]deb(?=\")")" && apt -y install "${GH_CLI_INSTALL_FILE}" \ + && GH_CLI_INSTALL_FILE="/tmp/gh-$$.deb" && curl -sSLo "${GH_CLI_INSTALL_FILE}" "https://github.com$(curl -sSL "https://github.com/cli/cli/releases/latest" | grep -Po "(?<=href=\")/cli/cli/releases/download/[^\"]*${DPKG_ARCH}[.]deb(?=\")")" && apt-get -y install "${GH_CLI_INSTALL_FILE}" \ && rm -rf /var/lib/apt/lists/* \ && rm -rf /tmp/* \ && groupadd -g 121 runner \ diff --git a/SECURITY.md b/SECURITY.md index 39f791ea..b990838a 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,7 +4,7 @@ If you believe you have found a security vulnerability, please report it to me a ## Reporting Security Issues -**Please do not report security vulnerabilities through public GitHub issues.** Instead, please report them to me directly at [myoung34@my.apsu.edu](mailto:myoung34@my.apsu.edu). +**Please do not report security vulnerabilities through public GitHub issues.** Instead, please report them to me directly at [myoung34@my.apsu.edu](mailto:myoung34@my.apsu.edu). If you'd like to communicate securely, my keybase is [here](https://keybase.io/3vilpenguin)