DEV Community

Cover image for Okteto-pipelines - when you need control over your okteto
Ashok Nagaraj
Ashok Nagaraj

Posted on

Okteto-pipelines - when you need control over your okteto

Okteto Pipelines add functionality over okteto.yaml . It is useful in the following use-cases:

  • allow configuration of how ones' Git repositories get deployed to Okteto.
  • to deploy artefacts when Okteto Cloud cannot detect how to deploy your application from your deployment manifests
  • when one needs more control over how application gets deployed.

okteto-pipeline.yaml can refer to individual okteto.yaml files through relative paths leading to modularity and decoupled control over individual microservices.

# Example

Consider the following structure

├── backend
│   ├── Dockerfile
│   ├── deployment.yaml
│   ├── okteto.yaml
│   └── src
│       └──
├── frontend
│   ├── Dockerfile
│   ├── okteto.yaml
│   └── src
│       ├── app.html
│       └── app.js
└── okteto-pipeline.yaml

Enter fullscreen mode Exit fullscreen mode

To work with frontend and backend use the individual okteto.yaml (okteto { build | deploy | up | down } -f *end/okteto.yaml)
To deal with ms-app as a whole refer to okteto-pipeline.yaml

cat okteto-pipeline.yaml
icon: https://www.icon-url-addr/icon.png
  - okteto build -t ashoka007/ms-app-backend:${OKTETO_GIT_COMMIT} backend
  - okteto build -t ashoka007/ms-app-frontend:${OKTETO_GIT_COMMIT} frontend
  # assume backend/deployment.yaml has updated image tag
  - kubectl apply -f backend/deplyment.yaml
  # assume frontend is already deployed and only image tag needs update
  - kubectl set image deployment/frontend-dep ms-app-frontend=ashoka007/ms-app-backend:${OKTETO_GIT_COMMIT}
  - backend/okteto.yml
  - frontend/okteto.yml
Enter fullscreen mode Exit fullscreen mode
# Note

Okteto will run an installation job that clones your Git repository, checks out the selected branch, and executes the sequence of deploy commands. The job will fail if any of the commands in the deploy list fails.

# More info

There are a number of environment variables (like OKTETO_GIT_COMMIT referred above). Check the documentation for details

Top comments (0)