Skip to content

Commit 83b0c00

Browse files
committed
Merge branch 'release'
2 parents b9b4459 + ad9c931 commit 83b0c00

File tree

27 files changed

+3216
-1440
lines changed

27 files changed

+3216
-1440
lines changed

.github/dependabot.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
# Config reference:
2-
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2+
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference
33

44
version: 2
55
updates:
66
- package-ecosystem: "github-actions"
77
directory: "/"
88
schedule:
99
interval: "weekly"
10+
- package-ecosystem: "npm"
11+
directory: "/"
12+
schedule:
13+
interval: "weekly"
14+
groups:
15+
major-updates:
16+
applies-to: version-updates
17+
update-types:
18+
- major
19+
minor-updates:
20+
applies-to: version-updates
21+
update-types:
22+
- minor
23+
- patch

etc/clean-previous-versions.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
ASSETS_PATH="/usr/share/nginx/html/assets-original"
4+
TIMESTAMP_TOLERANCE=120
5+
6+
# The ASSET_PATH seams to have a modification date that match the last build
7+
# We extract this information and only keep the file near this date
8+
9+
# -d: get directory information, not on its content
10+
# -l: long output,
11+
# --time-style=+@%s@ => time format is a timestamp
12+
# the '@' are added arround the timestamp to be able to easly parse the output, that not trivial without it
13+
# | cut -d '@' -f 2 : extract the timestamp with the help of our @
14+
last_build_timestamp=$(ls -dl --time-style=+@%s@ $ASSETS_PATH | cut -d '@' -f 2)
15+
16+
# Just in case, we adjust the timestamps with an error margin, not sure if necessary
17+
adjusted_timestamp=$(( last_build_timestamp - TIMESTAMP_TOLERANCE ))
18+
19+
# Find all file in our ASSETS PATH and call stat to retrieve its timestamps (%Y) & filename (%n)
20+
# Use awk to only keep line with a timestamps inferiour to our reference
21+
# Cut on our ',' to only keep the filename on each line
22+
# Use xargs to run rm for each line
23+
find ${ASSETS_PATH} -type f -exec stat --format="%Y,%n" {} + \
24+
| awk -v t="${adjusted_timestamp}" '$1 < t' \
25+
| cut -d ',' -f2- \
26+
| xargs --no-run-if-empty -L1 rm

etc/withprevious.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ RUN mv /opt/dist/assets /opt/dist/assets-original
2222
# When creating a new tag, this will fail.
2323
# Comment this line and the COPY --from=previous_build line
2424
FROM ${PREVIOUS_IMAGE}:${PREVIOUS_TAG} AS previous_build
25+
COPY --chmod=0744 etc/clean-previous-versions.sh /
26+
RUN /clean-previous-versions.sh
2527

2628
FROM nginx:stable
2729
RUN rm /etc/nginx/conf.d/default.conf

0 commit comments

Comments
 (0)