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

ms-app
β”œβ”€β”€ backend
β”‚Β Β  β”œβ”€β”€ Dockerfile
β”‚Β Β  β”œβ”€β”€ deployment.yaml
β”‚Β Β  β”œβ”€β”€ okteto.yaml
β”‚Β Β  └── src
β”‚Β Β      └── app.py
β”œβ”€β”€ 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
deploy:
  - 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}
  devs:
  - 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)

Why You Need to Study Javascript Fundamentals

The harsh reality for JS Developers: If you don't study the fundamentals, you'll be just another β€œCoder”. Top learnings on how to get to the mid/senior level faster as a JavaScript developer by Dragos Nedelcu.