Skip to content

Commit facedde

Browse files
committed
refactor: Fix Thrift to 0.20.0 and split from main docker
Signed-off-by: Helio Chissini de Castro <[email protected]>
1 parent e378da7 commit facedde

File tree

11 files changed

+197
-126
lines changed

11 files changed

+197
-126
lines changed

.github/testForLicenseHeaders.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ done <<< "$(git ls-files \
4040
| grep -v 'id_rsa' \
4141
| grep -v '.versions' \
4242
| grep -v '.github/*' \
43+
| grep -v 'third-party/thrift/*' \
4344
| grep -v 'scripts/lint/checkstyle.xml' \
4445
| grep -v 'scripts/lint/google_checks.xml' \
4546
| grep -v 'sw360.code-workspace' \

.github/workflows/build_and_test.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ on:
2020
env:
2121
COUCHDB_USER: sw360
2222
COUCHDB_PASSWORD: sw360fossie
23+
THRIFT_VERSION: "0.20.0"
2324

2425
permissions:
2526
contents: read
@@ -43,10 +44,6 @@ jobs:
4344
chmod +x .github/testForLicenseHeaders.sh
4445
bash .github/testForLicenseHeaders.sh
4546
46-
- name: Set environment variables
47-
run: |
48-
cat .versions >> $GITHUB_ENV
49-
5047
- name: Setup CouchDB
5148
run: scripts/startCouchdbForTests.sh
5249

@@ -79,8 +76,8 @@ jobs:
7976
run: |
8077
sudo apt-get update -qq
8178
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq build-essential libevent-dev libtool flex bison pkg-config libssl-dev git cmake
82-
chmod +x scripts/install-thrift.sh
83-
DESTDIR=${{ github.workspace }}/dist/thrift-${{ env.THRIFT_VERSION }} scripts/install-thrift.sh
79+
chmod +x third-party/thrift/install-thrift.sh
80+
DESTDIR=${{ github.workspace }}/dist/thrift-${{ env.THRIFT_VERSION }} third-party/thrift/install-thrift.sh
8481
8582
- name: Build SW360
8683
run: |

.github/workflows/docker_deploy.yml renamed to .github/workflows/sw360_container.yml

Lines changed: 47 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
# -----------------------------------------------------------------------------
1313

14-
name: Docker Build
14+
name: SW360 Container
1515

1616
on:
1717
schedule:
@@ -61,14 +61,18 @@ jobs:
6161
- name: Get revision from pom.xml
6262
id: pom_version
6363
run: |
64-
echo "SW360_VERSION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout)" >> "$GITHUB_OUTPUT"
64+
echo "SW360_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> "$GITHUB_ENV"
6565
66-
thrift_image:
67-
name: Build SW360 Thrift image
66+
binary_image:
67+
name: SW360 Binary
68+
needs: [sw360_version]
6869
runs-on: ubuntu-24.04
6970
permissions:
7071
packages: write
7172

73+
env:
74+
SW360_VERSION: ${{ needs.sw360_version.outputs.sw360_version }}
75+
7276
steps:
7377
- name: Harden Runner
7478
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
@@ -77,65 +81,53 @@ jobs:
7781

7882
- name: Checkout main repository
7983
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
80-
- name: Set environment variables
81-
run: |
82-
cat .versions >> $GITHUB_ENV
8384

84-
- name: Build thrift image
85-
uses: heliocastro/docker-build-control@923d1cff454145d261107495786218d712fb4799 # v6.0
85+
- name: Login to GitHub container registry
86+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
8687
with:
87-
name: thrift
88-
target: localthrift
89-
token: ${{ secrets.GITHUB_TOKEN }}
90-
version: ${{ env.THRIFT_VERSION }}
91-
invalidate-cache: ${{ inputs.invalidate-cache }}
92-
debug: ${{ inputs.debug }}
93-
build-args: |
94-
THRIFT_VERSION=${{ env.THRIFT_VERSION }}
88+
registry: ${{ env.REGISTRY }}
89+
username: ${{ github.actor }}
90+
password: ${{ secrets.GITHUB_TOKEN }}
9591

96-
binary_image:
97-
name: SW360 Binary
98-
needs: [sw360_version, thrift_image]
99-
runs-on: ubuntu-24.04
100-
permissions:
101-
packages: write
92+
- name: Set up Docker build
93+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
10294

103-
steps:
104-
- name: Harden Runner
105-
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
95+
- name: Extract components metadata (tags, labels)
96+
id: meta
97+
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
10698
with:
107-
egress-policy: audit
108-
109-
- name: Checkout main repository
110-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
111-
112-
- name: Set environment variables
113-
run: |
114-
cat .versions >> $GITHUB_ENV
99+
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/thrift
100+
tags: |
101+
type=schedule,pattern={{date 'YYYYMMDD'}}
102+
type=schedule,pattern=snapshot
103+
type=semver,pattern={{ env.SW360_VERSION }}
104+
type=raw,value=${{ env.SW360_VERSION }}
105+
type=ref,event=tag
106+
labels: sw360,thrift
115107

116-
- name: Build binary image
117-
uses: heliocastro/docker-build-control@944a0451eadb63cf4f45a8ca66dba07118740faf # v5.1
108+
- name: Build image
109+
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
118110
with:
119-
name: binaries
120-
version: ${{ env.SW360_VERSION }}
121-
token: ${{ secrets.GITHUB_TOKEN }}
122-
invalidate-cache: ${{ inputs.invalidate-cache }}
123-
debug: ${{ inputs.debug }}
124-
platforms: "linux/amd64,linux/arm64"
125-
build-args: |
126-
THRIFT_VERSION=${{ env.THRIFT_VERSION }}
127-
SW360_VERSION=${{ env.SHORT_SHA }}
111+
context: .
112+
push: false
113+
load: true
114+
tags: |
115+
${{ steps.meta.outputs.tags }}
116+
labels: |
117+
${{ steps.meta.outputs.labels }}
118+
provenance: mode=max
119+
sbom: true
128120
secret-files: |
129121
"couchdb=./config/couchdb/default_secrets"
130-
build-contexts: |
131-
localthrift=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/thrift:${{ env.THRIFT_VERSION }}
132122
133-
runtime_image:
123+
sw360_image:
134124
name: SW360 Runtime image
135125
needs: [sw360_version, binary_image]
136126
runs-on: ubuntu-24.04
137127
permissions:
138128
packages: write
129+
env:
130+
SW360_VERSION: ${{ needs.sw360_version.outputs.sw360_version }}
139131

140132
steps:
141133
- name: Harden Runner
@@ -146,20 +138,19 @@ jobs:
146138
- name: Checkout main repository
147139
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
148140

149-
- name: Set environment variables
150-
run: |
151-
cat .versions >> $GITHUB_ENV
152-
153-
- name: Set up Docker Buildx
154-
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca # v3.9.0
155-
156141
- name: Login to GitHub Container Registry
157142
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
158143
with:
159144
registry: ${{ env.REGISTRY }}
160145
username: ${{ github.actor }}
161146
password: ${{ secrets.GITHUB_TOKEN }}
162147

148+
- name: Setup QEMU
149+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
150+
151+
- name: Set up Docker Buildx
152+
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca # v3.9.0
153+
163154
- name: Extract components metadata (tags, labels) runtime image
164155
id: meta_runtime
165156
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
@@ -173,7 +164,7 @@ jobs:
173164
type=sha,enable=true,prefix=sha-,format=short
174165
type=ref,event=tag
175166
176-
- name: Build image
167+
- name: Assembly image
177168
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
178169
with:
179170
context: .
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# -----------------------------------------------------------------------------
2+
# Copyright Helio Chissini de Castro 2022.
3+
# Copyright Cariad SE 2024
4+
# Part of the SW360 Project.
5+
#
6+
# This program and the accompanying materials are made
7+
# available under the terms of the Eclipse Public License 2.0
8+
# which is available at https://www.eclipse.org/legal/epl-2.0/
9+
#
10+
# SPDX-License-Identifier: EPL-2.0
11+
#
12+
# -----------------------------------------------------------------------------
13+
14+
on:
15+
workflow_dispatch:
16+
push:
17+
paths:
18+
- "third-party/thrift/Dockerfile"
19+
20+
permissions:
21+
contents: read
22+
23+
env:
24+
REGISTRY: ghcr.io
25+
THRIFT_VERSION: "0.20.0" # Will be override but post step. Kept it here for minimal version
26+
27+
jobs:
28+
thrift_image:
29+
name: SW360 Thrift Container
30+
runs-on: ubuntu-24.04
31+
permissions:
32+
packages: write
33+
34+
steps:
35+
- name: Harden Runner
36+
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
37+
with:
38+
egress-policy: audit
39+
40+
- name: Checkout main repository
41+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
42+
43+
- name: Login to GitHub container registry
44+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
45+
with:
46+
registry: ${{ env.REGISTRY }}
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: Setup QEMU
51+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
52+
53+
- name: Set up Docker build
54+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
55+
56+
- name: Get assigned Thrift version
57+
shell: bash
58+
run: |
59+
THRIFT_VERSION="$(cat third-party/thrift/version)"
60+
echo "THRIFT_VERSION=$THRIFT_VERSION" >> $GITHUB_ENV
61+
echo "Thrift is set to version $THRIFT_VERSION"
62+
63+
- name: Extract components metadata (tags, labels)
64+
id: meta
65+
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
66+
with:
67+
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/thrift
68+
tags: |
69+
type=schedule,pattern={{date 'YYYYMMDD'}}
70+
type=schedule,pattern=snapshot
71+
type=semver,pattern={{version}}
72+
type=raw,value=${{ env.THRIFT_VERSION }}
73+
type=ref,event=tag
74+
labels: sw360,thrift
75+
76+
- name: Build image
77+
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
78+
with:
79+
context: .
80+
platforms: "linux/amd64,linux/arm64"
81+
push: true
82+
load: false
83+
file: third-party/thrift/Dockerfile
84+
build-args: |
85+
THRIFT_VERSION=${{ env.THRIFT_VERSION }}
86+
tags: |
87+
${{ steps.meta.outputs.tags }}
88+
labels: |
89+
${{ steps.meta.outputs.labels }}
90+
provenance: mode=max
91+
sbom: true

.versions

Lines changed: 0 additions & 3 deletions
This file was deleted.

Dockerfile

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,49 +10,6 @@
1010
#
1111
# SPDX-License-Identifier: EPL-2.0
1212

13-
#--------------------------------------------------------------------------------------------------
14-
# Thrift
15-
# Ubuntu Noble image
16-
FROM ubuntu@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782 AS sw360thriftbuild
17-
18-
ARG BASEDIR="/build"
19-
ARG DESTDIR="/"
20-
ARG THRIFT_VERSION
21-
22-
RUN rm -f /etc/apt/apt.conf.d/docker-clean
23-
RUN --mount=type=cache,mode=0755,target=/var/cache/apt \
24-
apt-get -qq update \
25-
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
26-
bison \
27-
build-essential \
28-
ca-certificates \
29-
cmake \
30-
curl \
31-
flex \
32-
libevent-dev \
33-
libtool \
34-
pkg-config \
35-
&& rm -rf /var/lib/apt/lists/*
36-
37-
COPY ./scripts/install-thrift.sh build_thrift.sh
38-
39-
RUN --mount=type=tmpfs,target=/build \
40-
--mount=type=cache,target=/var/cache/deps \
41-
./build_thrift.sh
42-
43-
FROM scratch AS localthrift
44-
COPY --from=sw360thriftbuild /usr/local/bin/thrift /usr/local/bin/thrift
45-
46-
#--------------------------------------------------------------------------------------------------
47-
# SW360 Build Test image
48-
49-
# 3-eclipse-temurin-21
50-
FROM maven@sha256:70591cb7a67e12414b16603c6e89d95625e802667f2a0932d5362c459f362fff AS sw360test
51-
52-
COPY --from=localthrift /usr/local/bin/thrift /usr/bin
53-
54-
SHELL ["/bin/bash", "-c"]
55-
5613
#--------------------------------------------------------------------------------------------------
5714
# SW360
5815
# We build sw360 and create real image after everything is ready
@@ -83,7 +40,7 @@ COPY scripts/docker-config/set_proxy.sh /usr/local/bin/setup_maven_proxy
8340
RUN chmod a+x /usr/local/bin/setup_maven_proxy \
8441
&& setup_maven_proxy
8542

86-
COPY --from=localthrift /usr/local/bin/thrift /usr/bin
43+
COPY --from=ghcr.io/eclipse-sw360/thrift:0.20.0 /usr/local/bin/thrift /usr/bin
8744

8845
WORKDIR /build/sw360
8946

0 commit comments

Comments
 (0)