Skip to content

Commit ec7a81d

Browse files
committed
Force the creation of DCI components on a weekly basis
1 parent 18d0463 commit ec7a81d

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
name: Create DCI components for Example CNF
3+
4+
on:
5+
schedule:
6+
- cron: "0 20 * * 5" # Fridays at 20:00 UTC
7+
workflow_dispatch:
8+
9+
env:
10+
QUAY_REGISTRY: quay.io
11+
12+
defaults:
13+
run:
14+
shell: bash
15+
16+
jobs:
17+
publish_dci_component:
18+
runs-on: ubuntu-latest
19+
steps:
20+
# This tag is used to build the DCI component, as both the tag and the component version match
21+
- name: Get latest Quay tag from nfv-example-cnf-catalog
22+
id: quay
23+
run: |
24+
# Build tags look like v0.3.10-202606290619.18d0463; skip floating aliases (e.g. v0.3.10).
25+
version=$(
26+
curl -fsSL \
27+
"https://quay.io/api/v1/repository/rh-nfv-int/nfv-example-cnf-catalog/tag/?onlyActiveTags=true&limit=100" |
28+
jq -r '[.tags[] | select(.name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-[0-9]+\\.[0-9a-f]+$"))] | sort_by(.start_ts) | reverse | .[0].name'
29+
)
30+
if [[ -z "${version}" || "${version}" == "null" ]]; then
31+
echo "Failed to resolve latest build tag from Quay" >&2
32+
exit 1
33+
fi
34+
echo "version=${version}" >> "$GITHUB_OUTPUT"
35+
echo "Using Quay tag: ${version}"
36+
37+
# Create the DCI component for all OCP topics.
38+
# If the component is already created, nothing will be done.
39+
# This is done to cover these two cases:
40+
# - A new DCI topic is released and no nfv-example-cnf-index component is created yet.
41+
# - After merging a PR, the push action failed and no DCI component was created.
42+
- name: Create DCI components
43+
id: dci
44+
uses: dci-labs/dci-component@071020fc9ded27153c7bc1bfef3aac136bba52f6 # v1.7.0
45+
with:
46+
dciClientId: ${{ secrets.DCI_CLIENT_ID }}
47+
dciApiSecret: ${{ secrets.DCI_API_SECRET }}
48+
dciTopics: 'all-OCP'
49+
componentName: nfv-example-cnf-index
50+
componentVersion: ${{ steps.quay.outputs.version }}
51+
componentData: '{"url":"${{ env.QUAY_REGISTRY }}/rh-nfv-int/nfv-example-cnf-catalog"}'
52+
componentRelease: ga
53+
54+
- name: Results
55+
run: |
56+
echo "## DCI components" >> ${GITHUB_STEP_SUMMARY}
57+
echo "" >> ${GITHUB_STEP_SUMMARY}
58+
echo "\`\`\`JSON" >> ${GITHUB_STEP_SUMMARY}
59+
<<<'${{ steps.dci.outputs.components }}' jq '.[] | del(.component.jobs)' | grep -v team_id >> ${GITHUB_STEP_SUMMARY}
60+
echo "\`\`\`" >> ${GITHUB_STEP_SUMMARY}
61+
echo "" >> ${GITHUB_STEP_SUMMARY}

0 commit comments

Comments
 (0)