Skip to content

Commit

Permalink
Merge pull request #9 from dci-labs/ocp_topics
Browse files Browse the repository at this point in the history
New Release 1.5.0
  • Loading branch information
tonyskapunk authored Nov 19, 2024
2 parents a86cee3 + a9ddc17 commit 9bc6b47
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## v1

## v1.5.0

- Set a limit of topics to use with the wildcard "all-<TOPIC_TYPE>" based on the product.

## v1.4.0

- Get last 7 versions of a topic if using "all-<TOPIC_TYPE>"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Some Inputs are required, while others are optional.

- `dciClientId`: Remote CI client ID, this is passed as a secret.
- `dciApiSecret`: Remote CI API secret, this is passed as a secret.
- `dciTopics`: A comma-separated list of DCI topics, or a special term `all-<TOPIC_TYPE>`for the latest (last 6) topics. Where `TOPIC_TYPE`is one of: `OCP`, `OSP` or `RHEL`.
- `dciTopics`: A comma-separated list of DCI topics, or a special term `all-<TOPIC_TYPE>` for the [latest topics](./dci-component/blob/main/add-component#L17). Where `TOPIC_TYPE`is one of: `OCP`, `OSP` or `RHEL`.

```yaml
# Single topic
Expand Down
9 changes: 6 additions & 3 deletions add-component
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ function clean_up() {

trap clean_up EXIT

# Get the latest (last 7) versions of a topic
# Get the latest versions of a topic per product
function get_topic_versions(){
local topic_type=${1^^}
declare -A limits
declare -A products
limits=( [OCP]=8 [OSP]=2 [RHEL]=10 )
products=( [OCP]=OpenShift [OSP]=OpenStack [RHEL]=RHEL )

# get product from topic
# get product and limit from topic
product=${products[${topic_type}]}
limit=${limits[${topic_type}]}

if [[ -z ${product} ]]; then
echo "Invalid Topic Type: ${topic_type}"
Expand All @@ -37,7 +40,7 @@ function get_topic_versions(){
--where "status:active" \
--where "product_id:${product_id}" \
--where "name:${topic_type}*" |
jq -r '.topics[0:7][] | .name')
jq -r '.topics[0:'${limit}'][] | .name')
)
echo ${all_versions[@]}
}
Expand Down

0 comments on commit 9bc6b47

Please sign in to comment.