GitHub + GitHub Actions with DTM Tools

DevStream has two abstractions: Tools and Apps.

The previous use case uses “Apps”. We can also achieve the same result with “Tools”, and here’s how:

ENV Vars

The following environment variables are required for this to work:

Bash

  1. export GITHUB_TOKEN="YOUR_GITHUB_TOKEN_HERE"
  2. export IMAGE_REPO_PASSWORD="YOUR_DOCKERHUB_TOKEN_HERE"

Config File

YAML

  1. config:
  2. state:
  3. backend: local
  4. options:
  5. stateFile: devstream.state
  6. vars:
  7. GITHUB_USER: YOUR_GITHUB_USER
  8. DOCKERHUB_USER: YOUR_DOCKERHUB_USER
  9. tools:
  10. - name: repo-scaffolding
  11. instanceID: myapp1
  12. options:
  13. destinationRepo:
  14. owner: [[ GITHUB_USER ]]
  15. name: myapp1
  16. branch: main
  17. scmType: github
  18. token: [[ env GITHUB_TOKEN ]]
  19. sourceRepo:
  20. org: devstream-io
  21. name: dtm-repo-scaffolding-python-flask
  22. scmType: github
  23. - name: github-actions
  24. instanceID: flask
  25. dependsOn: [ repo-scaffolding.myapp1 ]
  26. options:
  27. scm:
  28. owner: [[ GITHUB_USER ]]
  29. name: myapp1
  30. scmType: github
  31. token: [[ env GITHUB_TOKEN ]]
  32. pipeline:
  33. configLocation: https://raw.githubusercontent.com/devstream-io/dtm-pipeline-templates/main/github-actions/workflows/main.yml
  34. language:
  35. name: python
  36. framework: flask
  37. imageRepo:
  38. user: [[ DOCKERHUB_USER ]]
  39. password: [[ env IMAGE_REPO_PASSWORD ]]
  40. - name: helm-installer
  41. instanceID: argocd
  42. - name: argocdapp
  43. instanceID: default
  44. dependsOn: [ "helm-installer.argocd", "github-actions.flask" ]
  45. options:
  46. app:
  47. name: myapp1
  48. namespace: argocd
  49. destination:
  50. server: https://kubernetes.default.svc
  51. namespace: default
  52. source:
  53. valuefile: values.yaml
  54. path: helm/myapp1
  55. repoURL: ${{repo-scaffolding.myapp1.outputs.repoURL}}
  56. token: [[ env GITHUB_TOKEN ]]
  57. imageRepo:
  58. user: [[ DOCKERHUB_USER ]]

Update the “YOUR_GITHUB_USER” and “YOUR_DOCKERHUB_USER” in the above file accordingly.


Run

First, initialize:

Bash

  1. # this downloads the required plugins, according to the config file, automatically.
  2. dtm init -f config.yaml

Then we apply it by running:

Bash

  1. dtm apply -f config.yaml -y

(Screenshot/video omitted.)