Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glebashnik/gh action verify opensource release 7days #32141

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/verify-opensource-release-7days.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Check OSS release age

on:
workflow_dispatch:

pull_request:
paths:
- .github/workflows/verify-opensource-release-7days.yml
branches:
- master

schedule:
- cron: '0 0 * * *'

jobs:
error-if-current-release-too-old:
runs-on: ubuntu-24.04
steps:
- name: Setup xq
run: |
sudo apt-get install -y xq

- name: Error if current release is too old
run: |
now_epoch=`date "+%s"`
echo "Now epoch: " $now_epoch

current_release_date=$(curl -sLf https://repo1.maven.org/maven2/com/yahoo/vespa/cloud-tenant-base/maven-metadata.xml | \
xq -x 'metadata/versioning/lastUpdated' | cut -c 1-8)
echo "Current release date: " $current_release_date
current_release_epoch=`date -d "$current_release_date" "+%s"`
echo "Current release epoch: " $current_release_epoch
release_age_days=$((($now_epoch-$current_release_epoch)/86400))
echo "Release age days: " $release_age_days

if [ "$release_age_days" -gt 7 ]; then
echo "Current open source release is older than 7 days"
exit 1
fi

error-if-docker-image-too-old:
runs-on: ubuntu-latest
steps:
- name: Error if docker image is too old
run: |
now_epoch=`date "+%s"`
echo "Now epoch: " $now_epoch

image_date=$(curl -sLf https://hub.docker.com/v2/repositories/vespaengine/vespa/ | jq -re '.last_updated')
echo "Docker image last_updated: " $image_date
image_epoch=`date -d "$image_date" "+%s"`
echo "Docker image epoch: " $image_epoch
docker_image_age_days=$((($now_epoch-$image_epoch)/86400))
echo "Docker image age days: " $docker_image_age_days

if [ "$docker_image_age_days" -gt 7 ]; then
echo "Current Docker image is older than 7 days"
exit 1
fi