Use CDT's container to run all code cleanliness checks

We need a new docker container for GitHub that runs as the
same uid that GitHub actions uses so permissions all work
correctly.
This commit is contained in:
Jonah Graham 2024-06-23 17:23:32 -04:00
parent 24d9bd1834
commit 46e37c6d22
8 changed files with 53 additions and 43 deletions

View file

@ -4,39 +4,26 @@ on: [push, pull_request]
jobs: jobs:
build: build:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up JDK 21 - name: Run Check Code Cleanliness with Docker
uses: actions/setup-java@v3 uses: addnab/docker-run-action@v3
with: with:
java-version: '21' image: quay.io/eclipse-cdt/cdt-infra-plus-eclipse-install-github@sha256:448dd492ab17c81b114c6adb5dc431a54b63991bf21265f7b7af93aea3704f87
distribution: 'temurin' options: -v ${{ github.workspace }}:/work
cache: maven run: |
- name: Set up Maven set -x
uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5 cd /work
with: ./releng/scripts/check_code_cleanliness_only.sh
maven-version: 3.9.2 ./releng/scripts/check_bundle_versions.sh
- name: Install dependencies ./releng/scripts/check_bundle_versions_report.sh
run: | - name: Upload Logs
sudo apt-get update && sudo apt-get install -y --no-install-recommends \ uses: actions/upload-artifact@v3
libxml2-utils if: success() || failure()
- name: Install Eclipse SDK with:
run: | name: Code Cleanliness Detailed Logs
curl -sL https://download.eclipse.org/eclipse/downloads/drops4/R-4.23-202203080310/eclipse-SDK-4.23-linux-gtk-x86_64.tar.gz | tar xz path: "*.log"
- name: Run Check Code Cleanliness
run: ECLIPSE=$PWD/eclipse/eclipse ./releng/scripts/check_code_cleanliness_only.sh
- name: Run Bundle Versions Bumped
run: ./releng/scripts/check_bundle_versions.sh
- name: Report on Bundle Versions Bumped
run: ./releng/scripts/check_bundle_versions_report.sh
- name: Upload Logs
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: Code Cleanliness Detailed Logs
path: '*.log'

View file

@ -14,3 +14,4 @@ docker build --rm -f cdt-infra-base/ubuntu-18.04/Dockerfile -t cdt-infra-base:ub
docker build --rm -f cdt-infra-all-gdbs/ubuntu-18.04/Dockerfile -t cdt-infra-all-gdbs:ubuntu-18.04 . docker build --rm -f cdt-infra-all-gdbs/ubuntu-18.04/Dockerfile -t cdt-infra-all-gdbs:ubuntu-18.04 .
docker build --rm -f cdt-infra-eclipse-full/ubuntu-18.04/Dockerfile -t cdt-infra-eclipse-full:ubuntu-18.04 . docker build --rm -f cdt-infra-eclipse-full/ubuntu-18.04/Dockerfile -t cdt-infra-eclipse-full:ubuntu-18.04 .
docker build --rm -f cdt-infra-plus-eclipse-install/ubuntu-18.04/Dockerfile -t cdt-infra-plus-eclipse-install:ubuntu-18.04 . docker build --rm -f cdt-infra-plus-eclipse-install/ubuntu-18.04/Dockerfile -t cdt-infra-plus-eclipse-install:ubuntu-18.04 .
docker build --rm -f cdt-infra-plus-eclipse-install-github/ubuntu-18.04/Dockerfile -t cdt-infra-plus-eclipse-install-github:ubuntu-18.04 .

View file

@ -26,6 +26,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libxml2-utils \ libxml2-utils \
gettext-base \ gettext-base \
xserver-xephyr \ xserver-xephyr \
clang-format \
xvfb \
ssh-askpass \
&& apt-get install -y llvm \ && apt-get install -y llvm \
&& apt-get install -y --no-install-recommends texinfo bison flex \ && apt-get install -y --no-install-recommends texinfo bison flex \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \

View file

@ -0,0 +1 @@
This directory contains dockerfiles for complete CDT Infra + Eclipse Installations for running on GitHub Actions

View file

@ -0,0 +1,25 @@
FROM ubuntu:18.04
# The contents of this file are similar to cdt-infra-plus-eclipse-install/*/Dockerfile
# because we don't want to share layers otherwise the change in permissions (1000 -> 1001)
# causes an additional layer to be created in Docker, adding 300MB+ to download
# size on each run
ENV HOME=/home/vnc
RUN apt-get update
RUN apt-get install -y curl tar gzip
#Eclipse SDK & Fix permissions for GitHub Actions
RUN mkdir -p ${HOME}/buildtools && cd ${HOME}/buildtools \
&& curl -sL https://download.eclipse.org/eclipse/downloads/drops4/R-4.31-202402290520/eclipse-SDK-4.31-linux-gtk-x86_64.tar.gz | tar xvz \
&& mv eclipse eclipse-SDK-4.31 \
&& chown -R 1001:0 ${HOME} \
&& chmod -R g+rwX ${HOME}
FROM cdt-infra-eclipse-full:ubuntu-18.04
USER root
COPY --from=0 ${HOME}/buildtools ${HOME}/buildtools
USER 1001
CMD ["/bin/bash"]

View file

@ -5,8 +5,6 @@ RUN apt-get update
RUN apt-get install -y curl tar gzip RUN apt-get install -y curl tar gzip
#Eclipse SDK & Fix permissions for OpenShift & standard k8s #Eclipse SDK & Fix permissions for OpenShift & standard k8s
RUN mkdir -p ${HOME}/buildtools && cd ${HOME}/buildtools \ RUN mkdir -p ${HOME}/buildtools && cd ${HOME}/buildtools \
&& curl -sL https://download.eclipse.org/eclipse/downloads/drops4/R-4.23-202203080310/eclipse-SDK-4.23-linux-gtk-x86_64.tar.gz | tar xvz \
&& mv eclipse eclipse-SDK-4.23 \
&& curl -sL https://download.eclipse.org/eclipse/downloads/drops4/R-4.31-202402290520/eclipse-SDK-4.31-linux-gtk-x86_64.tar.gz | tar xvz \ && curl -sL https://download.eclipse.org/eclipse/downloads/drops4/R-4.31-202402290520/eclipse-SDK-4.31-linux-gtk-x86_64.tar.gz | tar xvz \
&& mv eclipse eclipse-SDK-4.31 \ && mv eclipse eclipse-SDK-4.31 \
&& chown -R 1000:0 ${HOME} \ && chown -R 1000:0 ${HOME} \
@ -16,11 +14,6 @@ FROM cdt-infra-eclipse-full:ubuntu-18.04
USER root USER root
COPY --from=0 ${HOME}/buildtools ${HOME}/buildtools COPY --from=0 ${HOME}/buildtools ${HOME}/buildtools
RUN apt-get update \
&& apt-get install -y clang-format \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update
RUN apt-get install -y ssh-askpass
USER 1000 USER 1000

View file

@ -11,7 +11,7 @@ namespace=${1:-quay.io/eclipse-cdt}
shorthash=$(git rev-parse --short HEAD) shorthash=$(git rev-parse --short HEAD)
toplevel=$(git rev-parse --show-toplevel) toplevel=$(git rev-parse --show-toplevel)
images="cdt-infra-eclipse-full:ubuntu-18.04 cdt-infra-plus-eclipse-install:ubuntu-18.04" images="cdt-infra-eclipse-full:ubuntu-18.04 cdt-infra-plus-eclipse-install:ubuntu-18.04 cdt-infra-plus-eclipse-install-github:ubuntu-18.04"
$toplevel/docker/build-images.sh $toplevel/docker/build-images.sh
@ -28,7 +28,7 @@ for image in $images; do
hashname=$(docker inspect --format='{{index .RepoDigests 0}}' $image) hashname=$(docker inspect --format='{{index .RepoDigests 0}}' $image)
echo $image "-->" $hashname echo $image "-->" $hashname
nameonly=$(echo $image | sed -es,:.*,,) nameonly=$(echo $image | sed -es,:.*,,)
find $toplevel -name \*\.Jenkinsfile -or -name \*\.yaml | while read file; do find $toplevel -name \*\.Jenkinsfile -or -name \*\.yaml -or -name \*\.yml | while read file; do
sed -i "s#image: $namespace/$nameonly[:@].*#image: $hashname#" $file sed -i "s#image: $namespace/$nameonly[:@].*#image: $hashname#" $file
git add $file git add $file
done done

View file

@ -3,7 +3,7 @@ kind: Pod
spec: spec:
containers: containers:
- name: cdt - name: cdt
image: quay.io/eclipse-cdt/cdt-infra-plus-eclipse-install@sha256:7146f40a39f75e364c473aa26044803582428f41f1f911e4b44a8ee8e72f89d1 image: quay.io/eclipse-cdt/cdt-infra-plus-eclipse-install@sha256:53be2931e1ce9694033e46784d9b1b841a4399b16f3b0c00bc5f07178d1cb125
tty: true tty: true
args: ["/bin/sh", "-c", "/home/vnc/.vnc/xstartup.sh && cat"] args: ["/bin/sh", "-c", "/home/vnc/.vnc/xstartup.sh && cat"]
resources: resources: