Initial commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
# SPDX-FileCopyrightText: Andrei Gherzan <andrei.gherzan@huawei.com>
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
FROM christophebedard/dco-check:latest
|
||||
|
||||
# Run under normal user called 'ci'
|
||||
RUN useradd --create-home --uid 1000 --shell /usr/bin/bash ci
|
||||
USER ci
|
||||
|
||||
COPY ./dco-check/entrypoint.sh /
|
||||
COPY ./utils.sh /
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
@@ -0,0 +1,16 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: Andrei Gherzan <andrei.gherzan@huawei.com>
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
-->
|
||||
|
||||
# Docker image for DCO checks
|
||||
|
||||
This image provides the environment and the logic of running a DCO check
|
||||
against a repository.
|
||||
|
||||
## Configuration
|
||||
|
||||
The `entrypoint.sh` script assumes at runtime that the repository to be checked
|
||||
is available under `/work`. This path is to be populated via bind mounts when
|
||||
running the container.
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-FileCopyrightText: Andrei Gherzan <andrei.gherzan@huawei.com>
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
set -e
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
. /utils.sh
|
||||
|
||||
GIT_REPO_PATH="/work"
|
||||
|
||||
[ -n "$BASE_REF" ] ||
|
||||
error "DCO checks needs to know the target branch. Make sure that is set in BASE_REF."
|
||||
[ -d "$GIT_REPO_PATH/.git" ] ||
|
||||
error "Can't find a git checkout under $GIT_REPO_PATH ."
|
||||
cd "$GIT_REPO_PATH"
|
||||
|
||||
# The GitHub runner user and the container user might differ making git error
|
||||
# out with:
|
||||
# error: fatal: detected dubious ownership in repository at '/work'
|
||||
# Avoid this as the security risk is minimum here while guarding the git hooks
|
||||
# via PRs.
|
||||
git config --global --add safe.directory /work
|
||||
|
||||
dco-check \
|
||||
--verbose \
|
||||
--default-branch "origin/$BASE_REF"
|
||||
Reference in New Issue
Block a user