Skip to content

Quay Statistics Update #15

Quay Statistics Update

Quay Statistics Update #15

Workflow file for this run

name: Quay Statistics Update
on:
schedule:
# weekly cron job
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
quay-query:
runs-on: ubuntu-22.04
env:
SHELL: /bin/bash
REPO_NAME_LEGACY: cnf-certification-test
REPO_NAME_CURRENT: certsuite
NS_NAME_LEGACY: testnetworkfunction
NS_NAME_CURRENT: redhat-best-practices-for-k8s
steps:
- name: Install the JQ package
run: sudo apt-get install jq -y
- name: Clone the telco-bot repository
uses: actions/checkout@v4
# Clone the go-quay repository
- name: Checkout go-quay
uses: actions/checkout@v4
with:
repository: 'sebrandon1/go-quay'
path: go-quay
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Build the go-quay project
run: go build
working-directory: go-quay
- name: Run the go-quay project to gather the last 7 days of Quay statistics
run: |
TODAY=$(date +%m/%d/%Y)
SEVEN_DAYS_AGO=$(date --date "7 days ago" +%m/%d/%Y)
./go-quay get aggregatedlogs -t ${{ secrets.QUAY_TOKEN_LEGACY }} -n ${NS_NAME} -r ${REPO_NAME_LEGACY} -s ${SEVEN_DAYS_AGO} -e ${TODAY} > ${GITHUB_WORKSPACE}/quay-output-legacy.json
./go-quay get aggregatedlogs -t ${{ secrets.QUAY_TOKEN }} -n ${NS_NAME} -r ${REPO_NAME} -s ${SEVEN_DAYS_AGO} -e ${TODAY} > ${GITHUB_WORKSPACE}/quay-output.json
working-directory: go-quay
- name: Send the message to Slack
run: |
TODAY=$(date +%m/%d/%Y)
SEVEN_DAYS_AGO=$(date --date "7 days ago" +%m/%d/%Y)
# Build the names of the namespace/repo
CURRENT_REPO_NAME=${NS_NAME_CURRENT}/${REPO_NAME_CURRENT}
LEGACY_REPO_NAME=${NS_NAME_LEGACY}/${REPO_NAME_LEGACY}
./scripts/quay-stats-msg.sh ${{ secrets.QUAY_QUERY_SLACK_URL }} ${GITHUB_WORKSPACE}/quay-output-legacy.json ${GITHUB_WORKSPACE}/quay-output.json ${SEVEN_DAYS_AGO} ${TODAY} ${LEGACY_REPO_NAME} ${CURRENT_REPO_NAME}