Skip to content

Commit ff22f3f

Browse files
Steve RamageSJrX
authored andcommitted
ci: Ensure that systemd build cache is updated daily (Resolves #261)
1 parent 40fe838 commit ff22f3f

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ jobs:
4444
- name: Build with Gradle
4545
run: |
4646
mkdir -p ./build
47+
docker compose --project-directory ./systemd-build up --build
4748
./generate-changelog > build/CHANGELOG
48-
./gradlew composeUp
4949
./gradlew test buildPlugin
5050
./gradlew --stop
5151
- name: Publish Unit Test Results

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ plugins {
3535

3636
dockerCompose {
3737
dockerComposeWorkingDirectory.set(file("./systemd-build/"))
38+
setProjectName("systemdbuild")
3839
}
3940

4041
group = "net.sjrx.intellij.plugins"

ci/release.Jenkinsfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ pipeline {
168168
/check-if-image-exists
169169
''', returnStatus: true)
170170
}
171-
systemdBuilderHash = sh(script: '''
172-
sha256sum ./systemd-build/Systemd-Builder.Dockerfile ./systemd-build/systemd-build.sh | sha256sum | sed -E "s/\\s.+$//g"
173-
''', returnStdout: true
171+
systemdBuilderHash = sh(script: """
172+
sha256sum ./systemd-build/Systemd-Builder.Dockerfile ./systemd-build/systemd-build.sh | sha256sum | sed -E "s/\\s.+\$/-${buildDate}/g"
173+
""", returnStdout: true
174174
).trim()
175175
withEnv(["IMAGE=sjrx/systemd-plugin-systemd-builder-image", "TAG=${systemdBuilderHash}"]) {
176176
systemdBuilderBuildNeeded = sh(script: '''
@@ -232,7 +232,7 @@ pipeline {
232232
steps {
233233
container('kaniko') {
234234
sh """
235-
/kaniko/executor --force -f `pwd`/systemd-build/Systemd-Builder.Dockerfile -c `pwd`/systemd-build/ --cache=true --compressed-caching=false --destination=${env.DOCKER_REGISTRY_PREFIX}/systemd-plugin-systemd-builder-image:$systemdBuilderHash --cache-copy-layers
235+
/kaniko/executor --force -f `pwd`/systemd-build/Systemd-Builder.Dockerfile -c `pwd`/systemd-build/ --build-arg BUILDDATE=${buildDate} --cache=true --compressed-caching=false --destination=${env.DOCKER_REGISTRY_PREFIX}/systemd-plugin-systemd-builder-image:$systemdBuilderHash --cache-copy-layers
236236
"""
237237
}
238238
}

systemd-build/Systemd-Builder.Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,25 @@ RUN ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime
66

77
RUN apt-get update && apt-get -y install git build-essential tzdata meson pkg-config gperf python3-jinja2 libcap-dev util-linux libmount1 libmount-dev
88

9-
109
RUN mkdir /opt/systemd-source
1110

1211
RUN git clone https://github.com/systemd/systemd.git /opt/systemd-source/systemd
1312

1413
WORKDIR /opt/systemd-source/systemd
1514

16-
RUN meson setup build
17-
1815
RUN mkdir -p /mount/
1916

2017
ADD systemd-build.sh /
2118

2219
CMD /systemd-build.sh
2320

21+
# Force cache to be invalidated after this point
22+
ARG BUILDDATE
23+
ENV BUILDDATE ${BUILDDATE:-notset}
24+
25+
RUN git pull
26+
27+
RUN meson setup build
28+
2429
RUN /systemd-build.sh
2530

systemd-build/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ services:
33
build:
44
context: .
55
dockerfile: Systemd-Builder.Dockerfile
6+
args:
7+
BUILDDATE: "unset"
68
volumes:
79
- ./build:/mount/
810
ubuntu-units-builder:

0 commit comments

Comments
 (0)