Skip to content

Conversation

@sauterle
Copy link

@sauterle sauterle commented Nov 8, 2024

Add Subscription (cron) and general structure for component subscription

@sauterle
Copy link
Author

@HeavyWombat @Luke-Roy-IBM is it possible to integrate this feature?

@Luke-Roy-IBM
Copy link
Member

@sauterle Thanks a lot for the Pull request I will look into this 👍

@Luke-Roy-IBM Luke-Roy-IBM self-requested a review November 11, 2024 08:30
Signed-off-by: Stefan Sauterleute <stefan.sauterleute@byteleaf.de>
Signed-off-by: Stefan Sauterleute <stefan.sauterleute@byteleaf.de>
Signed-off-by: Stefan Sauterleute <stefan.sauterleute@byteleaf.de>
Signed-off-by: Stefan Sauterleute <stefan.sauterleute@byteleaf.de>
Copy link
Member

@Luke-Roy-IBM Luke-Roy-IBM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sauterle Thanks for your pull request and your patience. Please address the changes and i will be able to update the Github action with Cron support

if: ( inputs.component == 'subscription' || inputs.component == 'sub' ) && inputs.subscription-type == 'cron'
run: |
if ibmcloud ce sub cron get --name ${{ inputs.name }} ; then
ibmcloud ce sub cron update --name ${{ inputs.name }} --destination-type ${{ inputs.destination-type }} --destination ${{ inputs.destination }} --path ${{ inputs.path }} --extension ${{ inputs.extension }} --schedule ${{ inputs.schedule }} --wait ${{ steps.set-resources.outputs.cpu }} ${{ steps.set-resources.outputs.memory }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace with following code in order to update existing subscription

Suggested change
ibmcloud ce sub cron update --name ${{ inputs.name }} --destination-type ${{ inputs.destination-type }} --destination ${{ inputs.destination }} --path ${{ inputs.path }} --extension ${{ inputs.extension }} --schedule ${{ inputs.schedule }} --wait ${{ steps.set-resources.outputs.cpu }} ${{ steps.set-resources.outputs.memory }}
ibmcloud ce sub cron update --name ${{ inputs.name }} --destination-type ${{ inputs.destination-type }} --destination ${{ inputs.destination }} --path ${{ inputs.path }} --extension ${{ inputs.extension }} --schedule "${{ inputs.schedule }}"

if ibmcloud ce sub cron get --name ${{ inputs.name }} ; then
ibmcloud ce sub cron update --name ${{ inputs.name }} --destination-type ${{ inputs.destination-type }} --destination ${{ inputs.destination }} --path ${{ inputs.path }} --extension ${{ inputs.extension }} --schedule ${{ inputs.schedule }} --wait ${{ steps.set-resources.outputs.cpu }} ${{ steps.set-resources.outputs.memory }}
else
ibmcloud ce sub cron create --name ${{ inputs.name }} --destination-type ${{ inputs.destination-type }} --destination ${{ inputs.destination }} --path ${{ inputs.path }} --extension ${{ inputs.extension }} --schedule ${{ inputs.schedule }} --wait ${{ steps.set-resources.outputs.cpu }} ${{ steps.set-resources.outputs.memory }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace with the following in order to create a cron subscription

Suggested change
ibmcloud ce sub cron create --name ${{ inputs.name }} --destination-type ${{ inputs.destination-type }} --destination ${{ inputs.destination }} --path ${{ inputs.path }} --extension ${{ inputs.extension }} --schedule ${{ inputs.schedule }} --wait ${{ steps.set-resources.outputs.cpu }} ${{ steps.set-resources.outputs.memory }}
ibmcloud ce sub cron create --name ${{ inputs.name }} --destination-type ${{ inputs.destination-type }} --destination ${{ inputs.destination }} --path ${{ inputs.path }} --extension ${{ inputs.extension }} --schedule "${{ inputs.schedule }}" --wait

cpu: 1
memory: 4G
```
*Deploy a Cron Subscription: `deploy-cron-sub.yml`*: Deploy your Cron Subscription to `Default` resource-group in `eu-de` to the project `MY-PROJECT` with its source code in the root of the repository the name of the job is`my-cron-sub`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*Deploy a Cron Subscription: `deploy-cron-sub.yml`*: Deploy your Cron Subscription to `Default` resource-group in `eu-de` to the project `MY-PROJECT` with its source code in the root of the repository the name of the job is`my-cron-sub`.
*Deploy a Cron Subscription: `deploy-cron-sub.yml`*: Deploy your Cron Subscription to `Default` resource-group in `eu-de` to the project `MY-PROJECT` with its source code in the root of the repository the name of the job is`cron-app`. See the docs for more infromation https://cloud.ibm.com/docs/codeengine?topic=codeengine-subscribe-cron-tutorial.

Comment on lines +186 to +200
api-key: ${{ secrets.IBM_IAM_API_KEY }}
resource-group: 'Default'
region: 'eu-de'
project: 'MY-PROJECT'
component: 'sub'
subscription-type: 'cron'
destination-type: 'app'
destination: 'my-app'
path: '/events'
extension: 'extA=A'
schedule: '*/2 * * * *'
name: 'my-cron-sub'
build-source: './'
cpu: 1
memory: 4G
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update docs as this is the way it was tested

Suggested change
api-key: ${{ secrets.IBM_IAM_API_KEY }}
resource-group: 'Default'
region: 'eu-de'
project: 'MY-PROJECT'
component: 'sub'
subscription-type: 'cron'
destination-type: 'app'
destination: 'my-app'
path: '/events'
extension: 'extA=A'
schedule: '*/2 * * * *'
name: 'my-cron-sub'
build-source: './'
cpu: 1
memory: 4G
api-key: ${{ secrets.IBM_IAM_API_KEY }}
resource-group: 'Default'
region: 'eu-de'
project: 'MY-PROJECT'
component: 'sub'
subscription-type: 'cron'
destination-type: 'app'
destination: 'cron-app'
path: '/events'
extension: 'extA=A'
schedule: '*/2 * * * *'
name: 'cron-sub'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants