Skip to content

Commit 0f2644f

Browse files
committed
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. (cherry picked from commit 46e37c6)
1 parent 54e9f2f commit 0f2644f

File tree

8 files changed

+53
-43
lines changed

8 files changed

+53
-43
lines changed

.github/workflows/code-cleanliness.yml

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,26 @@ on: [push, pull_request]
44

55
jobs:
66
build:
7-
87
runs-on: ubuntu-20.04
98

109
steps:
11-
- uses: actions/checkout@v3
12-
with:
13-
fetch-depth: 0
14-
- name: Set up JDK 21
15-
uses: actions/setup-java@v3
16-
with:
17-
java-version: '21'
18-
distribution: 'temurin'
19-
cache: maven
20-
- name: Set up Maven
21-
uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
22-
with:
23-
maven-version: 3.9.2
24-
- name: Install dependencies
25-
run: |
26-
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
27-
libxml2-utils
28-
- name: Install Eclipse SDK
29-
run: |
30-
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
31-
- name: Run Check Code Cleanliness
32-
run: ECLIPSE=$PWD/eclipse/eclipse ./releng/scripts/check_code_cleanliness_only.sh
33-
- name: Run Bundle Versions Bumped
34-
run: ./releng/scripts/check_bundle_versions.sh
35-
- name: Report on Bundle Versions Bumped
36-
run: ./releng/scripts/check_bundle_versions_report.sh
37-
- name: Upload Logs
38-
uses: actions/upload-artifact@v3
39-
if: success() || failure()
40-
with:
41-
name: Code Cleanliness Detailed Logs
42-
path: '*.log'
10+
- uses: actions/checkout@v3
11+
with:
12+
fetch-depth: 0
13+
- name: Run Check Code Cleanliness with Docker
14+
uses: addnab/docker-run-action@v3
15+
with:
16+
image: quay.io/eclipse-cdt/cdt-infra-plus-eclipse-install-github@sha256:448dd492ab17c81b114c6adb5dc431a54b63991bf21265f7b7af93aea3704f87
17+
options: -v ${{ github.workspace }}:/work
18+
run: |
19+
set -x
20+
cd /work
21+
./releng/scripts/check_code_cleanliness_only.sh
22+
./releng/scripts/check_bundle_versions.sh
23+
./releng/scripts/check_bundle_versions_report.sh
24+
- name: Upload Logs
25+
uses: actions/upload-artifact@v3
26+
if: success() || failure()
27+
with:
28+
name: Code Cleanliness Detailed Logs
29+
path: "*.log"

docker/build-images.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ docker build --rm -f cdt-infra-base/ubuntu-18.04/Dockerfile -t cdt-infra-base:ub
1414
docker build --rm -f cdt-infra-all-gdbs/ubuntu-18.04/Dockerfile -t cdt-infra-all-gdbs:ubuntu-18.04 .
1515
docker build --rm -f cdt-infra-eclipse-full/ubuntu-18.04/Dockerfile -t cdt-infra-eclipse-full:ubuntu-18.04 .
1616
docker build --rm -f cdt-infra-plus-eclipse-install/ubuntu-18.04/Dockerfile -t cdt-infra-plus-eclipse-install:ubuntu-18.04 .
17+
docker build --rm -f cdt-infra-plus-eclipse-install-github/ubuntu-18.04/Dockerfile -t cdt-infra-plus-eclipse-install-github:ubuntu-18.04 .

docker/cdt-infra-eclipse-full/ubuntu-18.04/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2626
libxml2-utils \
2727
gettext-base \
2828
xserver-xephyr \
29+
clang-format \
30+
xvfb \
31+
ssh-askpass \
2932
&& apt-get install -y llvm \
3033
&& apt-get install -y --no-install-recommends texinfo bison flex \
3134
&& rm -rf /var/lib/apt/lists/* \
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This directory contains dockerfiles for complete CDT Infra + Eclipse Installations for running on GitHub Actions
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ubuntu:18.04
2+
3+
# The contents of this file are similar to cdt-infra-plus-eclipse-install/*/Dockerfile
4+
# because we don't want to share layers otherwise the change in permissions (1000 -> 1001)
5+
# causes an additional layer to be created in Docker, adding 300MB+ to download
6+
# size on each run
7+
8+
ENV HOME=/home/vnc
9+
RUN apt-get update
10+
RUN apt-get install -y curl tar gzip
11+
#Eclipse SDK & Fix permissions for GitHub Actions
12+
RUN mkdir -p ${HOME}/buildtools && cd ${HOME}/buildtools \
13+
&& 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 \
14+
&& mv eclipse eclipse-SDK-4.31 \
15+
&& chown -R 1001:0 ${HOME} \
16+
&& chmod -R g+rwX ${HOME}
17+
18+
FROM cdt-infra-eclipse-full:ubuntu-18.04
19+
USER root
20+
21+
COPY --from=0 ${HOME}/buildtools ${HOME}/buildtools
22+
23+
USER 1001
24+
25+
CMD ["/bin/bash"]

docker/cdt-infra-plus-eclipse-install/ubuntu-18.04/Dockerfile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ RUN apt-get update
55
RUN apt-get install -y curl tar gzip
66
#Eclipse SDK & Fix permissions for OpenShift & standard k8s
77
RUN mkdir -p ${HOME}/buildtools && cd ${HOME}/buildtools \
8-
&& 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 \
9-
&& mv eclipse eclipse-SDK-4.23 \
108
&& 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 \
119
&& mv eclipse eclipse-SDK-4.31 \
1210
&& chown -R 1000:0 ${HOME} \
@@ -16,11 +14,6 @@ FROM cdt-infra-eclipse-full:ubuntu-18.04
1614
USER root
1715

1816
COPY --from=0 ${HOME}/buildtools ${HOME}/buildtools
19-
RUN apt-get update \
20-
&& apt-get install -y clang-format \
21-
&& rm -rf /var/lib/apt/lists/*
22-
RUN apt-get update
23-
RUN apt-get install -y ssh-askpass
2417

2518
USER 1000
2619

docker/deploy-images.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace=${1:-quay.io/eclipse-cdt}
1111
shorthash=$(git rev-parse --short HEAD)
1212
toplevel=$(git rev-parse --show-toplevel)
1313

14-
images="cdt-infra-eclipse-full:ubuntu-18.04 cdt-infra-plus-eclipse-install:ubuntu-18.04"
14+
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"
1515

1616
$toplevel/docker/build-images.sh
1717

@@ -28,7 +28,7 @@ for image in $images; do
2828
hashname=$(docker inspect --format='{{index .RepoDigests 0}}' $image)
2929
echo $image "-->" $hashname
3030
nameonly=$(echo $image | sed -es,:.*,,)
31-
find $toplevel -name \*\.Jenkinsfile -or -name \*\.yaml | while read file; do
31+
find $toplevel -name \*\.Jenkinsfile -or -name \*\.yaml -or -name \*\.yml | while read file; do
3232
sed -i "s#image: $namespace/$nameonly[:@].*#image: $hashname#" $file
3333
git add $file
3434
done

jenkins/pod-templates/cdt-full-pod-plus-eclipse-install.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Pod
33
spec:
44
containers:
55
- name: cdt
6-
image: quay.io/eclipse-cdt/cdt-infra-plus-eclipse-install@sha256:7146f40a39f75e364c473aa26044803582428f41f1f911e4b44a8ee8e72f89d1
6+
image: quay.io/eclipse-cdt/cdt-infra-plus-eclipse-install@sha256:53be2931e1ce9694033e46784d9b1b841a4399b16f3b0c00bc5f07178d1cb125
77
tty: true
88
args: ["/bin/sh", "-c", "/home/vnc/.vnc/xstartup.sh && cat"]
99
resources:

0 commit comments

Comments
 (0)