Skip to content

Commit

Permalink
[feature/PI-549-flaky_ci] reset timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
jaklinger committed Oct 11, 2024
1 parent a89e28c commit eace681
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/actions/components/caching/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ runs:
shell: bash
run: echo "date=$(date +'%Y-%m-%d-%M:%S')" >> $GITHUB_OUTPUT

- if: ${{ inputs.save-or-restore == 'restore' }}
id: timestamp--reset
uses: ./.github/actions/make/
with:
command: timestamp--reset FILEPATH=.
save-to-cache: "false"
restore-from-cache: "false"

- if: ${{ inputs.save-or-restore == 'restore' }}
id: restore-cache
uses: actions/cache/restore@v3
Expand Down
7 changes: 7 additions & 0 deletions scripts/builder/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,10 @@ generate--sbom: build

validate--sbom: generate--sbom
grype sbom:./cpm.cdx.json --fail-on CRITICAL

timestamp--reset:
@if [ -z "$(FILEPATH)" ]; then \
echo "Error: FILEPATH not provided"; \
exit 1; \
fi
FILEPATH=$(FILEPATH) bash $(CURDIR)/scripts/builder/timestamp_reset.sh
16 changes: 16 additions & 0 deletions scripts/builder/timestamp_reset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e

RESET_TIMESTAMP="2001-01-01T01:01:01"

if [[ -d ${FILEPATH} ]]; then
# find ./${FILEPATH} -type f -exec "touch -d ${RESET_TIMESTAMP}" {} +
find ${FILEPATH} -type f -exec touch -d ${RESET_TIMESTAMP} {} +
echo "Reset all timestamps files under '${FILEPATH}' to ${RESET_TIMESTAMP}"
elif [[ -f $FILEPATH ]]; then
touch -d ${RESET_TIMESTAMP} ${FILEPATH}
echo "Reset the timestamp of '${FILEPATH}' to ${RESET_TIMESTAMP}"
else
echo "'${FILEPATH}' does not exist"
exit 1
fi

0 comments on commit eace681

Please sign in to comment.