Deploy a crontab container from the CLI

Hi everyone!

We just moved our different services from a deployment via Git to a deployment via a container registry.
It works well for our web application (rails) and for our workers but when trying to deploy the container to a crontab, the CLI can’t find the corresponding container.

A qovery container list is only showing the “web” and the “worker” but none of our 4 crontabs.
The first deployment went well when we specified an image tag but now that we can’t figure out how to deploy an update the same way we do it with the “web” and the “worker”.
Are we missing something?

Here is the command we use:

        qovery container deploy \
          --organization <our_org_name> \
          --project WebApp \
          --environment staging \
          --container rake_mailer_daily_digest \
          --tag ${{ github.sha }} \
          --watch

While I’m here, I had to delete and recreate each service to move from a Git repo to a container repo because I couldn’t find an option to update that setting. Does it exist?

Thanks a lot for your help.

Hello @jmeiss !

Do you mind providing qovery console links for those 4 cron tabs so I can have a look?

Thanks !

Hi @bchastanier

Yes of course.

https://new.console.qovery.com/organization/12e0c625-6fb8-434b-adeb-041614fa7a46/project/a7f79a8f-8c0e-46a5-8748-1ba9846481c9/environment/cc24e8e3-c57b-4177-ac1a-e01361616f6f/application/07eac3d1-982b-41c7-83f0-46cd83d8a9da/general

https://new.console.qovery.com/organization/12e0c625-6fb8-434b-adeb-041614fa7a46/project/a7f79a8f-8c0e-46a5-8748-1ba9846481c9/environment/cc24e8e3-c57b-4177-ac1a-e01361616f6f/application/5d2dd9d5-74d6-401b-be2a-c7cfe74ba1c4/general

https://new.console.qovery.com/organization/12e0c625-6fb8-434b-adeb-041614fa7a46/project/a7f79a8f-8c0e-46a5-8748-1ba9846481c9/environment/cc24e8e3-c57b-4177-ac1a-e01361616f6f/application/875bcb05-5460-49a4-bfbe-46ad464cd469/general

https://new.console.qovery.com/organization/12e0c625-6fb8-434b-adeb-041614fa7a46/project/a7f79a8f-8c0e-46a5-8748-1ba9846481c9/environment/cc24e8e3-c57b-4177-ac1a-e01361616f6f/application/5a5abfe1-6a2a-4279-9d42-28a6f201b65d/general

Thanks!

So first of, regarding listing your crons, I think you are using the wrong sub command qovery container list where it should be qovery cronjob list.

Screenshot 2023-03-13 at 14.33.52

While I’m here, I had to delete and recreate each service to move from a Git repo to a container repo because I couldn’t find an option to update that setting. Does it exist?

Actually, I think it doesn’t, but it makes actual sense IMO, let me circle it back internally to check if it can be added to our backlog.

Cheers

That’s right for the cronjob list, good point :man_facepalming:

Using qovery crontab deploy I try to deploy an image but unlike qovery container deploy it doesn’t take tag as an argument but only a commit ID.

Did I miss something?

Thanks :pray:

Indeed, you are right, there is no tag support from the CLI at the moment, I will circle back with team to see if there is a reason not having support for it.

Is it a big blocker on your side?

Yes kinda…

I manually converted all the services from a Git repo to a container registry but I can’t push a container for the crontab. Hence, I have to manually deploy each of them after the GitHub action built the image or roll it back to a Git repo manually. At the same time, you add the feature and then re-rollback to a container registry :confused:

So yes, there’s a solution but it will take 1h to deploy instead of 3 min and I will have to reconfigure each crontab, several times, for each environment.

Sorry about that, I create a task in our backlog as it seems to be needed by several users and it makes sense. It goes further than “just” tags as we would like to be able to easily convert an app to a container and / or allowing to switch from one source (git) to another (container).

Let’s keep posted

1 Like

Thanks a lot, I appreciate the quick actions :pray:

Hi @jmeiss , FYI we’re going to deliver it this week

1 Like

Hi @jmeiss :wave:, the feature is now available via the CLI with the following command:

qovery cronjob deploy -n <name> --tag <your tag id>

1 Like

Hey @rophilogene thanks a lot for such speed in implementing it!

I just tried it and it works perfectly :pray:

I also saw your last commit to deploy several containers and cronjobs at the same time :smiley: It works for the containers but I’m facing an issues for the crontabs.
Here is the command:

qovery cronjob deploy \
  --organization <my_org> \
  --project WebApp \
  --environment staging \
  --cronjobs "rake_mailer_admin_daily_digest,rake_mailer_daily_digest,rake_mailer_eventable_started,rake_model_post_publish" \
  --tag ${{ github.sha }} \
  --watch

and I’m getting that error:

Error: required flag(s) "cronjob" not set
Usage:
  qovery cronjob deploy [flags]

Flags:
  -c, --commit-id string      Lifecycle Commit ID
Error: required flag(s) "cronjob" not set
  -n, --cronjob string        Cronjob Name
      --cronjobs string       Cronjob Names (comma separated) (ex: --cronjobs "cron1,cron2")
      --environment string    Environment Name
  -h, --help                  help for deploy
      --organization string   Organization Name
      --project string        Project Name
  -t, --tag string            Lifecycle Tag
  -w, --watch                 Watch cronjob status until it's ready or an error occurs

Do you see any typo on my side?

Hi @jmeiss , actually the problem comes from the CLI. I forget to remove an option

...
_ = lifecycleDeployCmd.MarkFlagRequired("cronjob")
...

It’s done - please update your CLI (in 5 minutes).

It’s now perfectly working, thanks a lot @rophilogene :pray:

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.