Deployment doesnt use the latest commit

Hi,

I have a terraform lifecycle job that should be updated and re-deployed for every commit to the branch. The Github workflow runs on each commit but it is not updating to use the latest commit.

ie in qovery i see:

my github command is:

 - name: Qovery Branch Update Terraform
        run: |
          qovery lifecycle update \
          --organization "Open Corporates" \
          --project "Open Corporates" \
          --environment ${{ steps.extract_branch.outputs.branch }} \
          --lifecycle "terraform" \
          --branch $GITHUB_HEAD_REF \
        env:
          QOVERY_CLI_ACCESS_TOKEN: ${{ secrets.QOVERY }}

The lifecycle job is cloned from terraform

resource "qovery_job" "terraform" {
  environment_id       = qovery_environment.this.id
  name                 = "terraform"
  cpu                  = 500
  memory               = 512
  max_nb_restart       = 0
  max_duration_seconds = 1800
  auto_preview         = false
  auto_deploy          = false

  source = {
    docker = {
      git_repository = {
        url          = "https://github.com/openc/openc-consumption.git"
        branch       = "master"
        root_path    = "/infra"
        git_token_id = "9e7fc347-835e-4860-8ce5-93a6db5fdd65"
      }
      dockerfile_path = "Dockerfile"
    }
  }

  schedule = {
    on_start = {
      arguments  = ["-c", "terraform apply -no-color -auto-approve && terraform output -json > /qovery-output/qovery-output.json"],
      entrypoint = ""
    }

    on_delete = {
      arguments  = ["-c", "terraform destroy -no-color -auto-approve"],
      entrypoint = ""
    }
  }

  deployment_stage_id = qovery_deployment_stage.terraform.id

  healthchecks = {}

  #    deployment_restrictions = [

  #    ]

  #    advanced_settings_json = jsonencode(
  #         {
  #   "build.timeout_max_sec" : 1800,
  #   "build.cpu_max_in_milli" : 4000,
  #   "build.ram_max_in_gib" : 8,
  #   "deployment.affinity.node.required" : { },
  #   "deployment.termination_grace_period_seconds" : 60,
  #   "job.delete_ttl_seconds_after_finished" : null,
  #   "cronjob.concurrency_policy" : "Forbid",
  #   "cronjob.failed_jobs_history_limit" : 1,
  #   "cronjob.success_jobs_history_limit" : 1,
  #   "security.service_account_name" : "",
  #   "security.read_only_root_filesystem" : false,
  #   "security.automount_service_account_token" : false
  # }
  #    )
}

Hello @Stephen_Bennett
If you want to automatically update the applications to the latest version of your git branch, you need to enable the auto-deploy feature. (Deploying with the auto-deploy feature | Docs | Qovery)
According to the Terraform configuration, the auto_deploy parameter is set to false.
Regards

But auto_deploy deploys when theres an update to the branch doesnt it?

I want github actions to define when to do the updates / deployments. But when it runs i need it to use the latest commit which it doesnt at present.

So, I think the only way to achieve what you want is to call qovery lifecycle deploy and explicitly set the last commit ID using the --commit-id flag.

Deploy a lifecycle job

Usage:
  qovery lifecycle deploy [flags]

Flags:
  -c, --commit-id string      Lifecycle Commit ID
      --environment string    Environment Name
  -h, --help                  help for deploy
  -n, --lifecycle string      Lifecycle Job Name
      --lifecycles string     Lifecycle Job Names
      --organization string   Organization Name
      --project string        Project Name
  -t, --tag string            Lifecycle Tag
  -w, --watch                 Watch lifecycle status until it's ready or an error occurs

oh thats a pain as we use qovery environment deploy

so i think what i need is to turn on auto-deploy and then make it that github only runs once or exits nicely!

This will also mean that the dev will no longer know when the deployment is complete as its all done else where which is really annoying :frowning:

Thanks

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