Skip to content

Commit

Permalink
Merge pull request #1393 from devstream-io/tiexin/DTM-552-gitops-pyth…
Browse files Browse the repository at this point in the history
…on-tools-usecase-doc

docs: python flask gitops use case with tools
  • Loading branch information
IronCore864 authored Dec 30, 2022
2 parents 2440e07 + 39dc2da commit ceb1eca
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/use-cases/gitops-python-flask/2-github-dtm-apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ config:

vars:
GITHUB_USER: YOUR_GITHUB_USER
DOCKERHUB_USER: YOUR_DOCKERHUB_USER
DOCKERHUB_USER: YOUR_DOCKERHUB_USER

tools:
- name: helm-installer
Expand Down
92 changes: 91 additions & 1 deletion docs/use-cases/gitops-python-flask/3-github-dtm-tools.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,93 @@
# GitHub + GitHub Actions with DTM Tools

TODO
DevStream has two abstractions: [Tools](../../core-concepts/tools.md) and [Apps](../../core-concepts/apps.md).

[The previous use case](./2-github-dtm-apps.md) uses "Apps". We can also achieve the same result with "Tools", and here's how:

---

## Config File

```yaml
config:
state:
backend: local
options:
stateFile: devstream.state

vars:
GITHUB_USER: YOUR_GITHUB_USER
DOCKERHUB_USER: YOUR_DOCKERHUB_USER

tools:
- name: repo-scaffolding
instanceID: myapp1
options:
destinationRepo:
owner: [[ GITHUB_USER ]]
name: myapp1
branch: main
scmType: github
token: [[ env GITHUB_TOKEN ]]
sourceRepo:
org: devstream-io
name: dtm-repo-scaffolding-python-flask
scmType: github
- name: github-actions
instanceID: flask
dependsOn: [ repo-scaffolding.myapp1 ]
options:
scm:
owner: [[ GITHUB_USER ]]
name: myapp1
scmType: github
token: [[ env GITHUB_TOKEN ]]
pipeline:
configLocation: https://raw.githubusercontent.com/devstream-io/dtm-pipeline-templates/main/github-actions/workflows/main.yml
language:
name: python
framework: flask
imageRepo:
user: [[ DOCKERHUB_USER ]]
password: [[ env IMAGE_REPO_PASSWORD ]]
- name: helm-installer
instanceID: argocd
- name: argocdapp
instanceID: default
dependsOn: [ "helm-installer.argocd", "github-actions.flask" ]
options:
app:
name: myapp1
namespace: argocd
destination:
server: https://kubernetes.default.svc
namespace: default
source:
valuefile: values.yaml
path: helm/myapp1
repoURL: ${{repo-scaffolding.myapp1.outputs.repoURL}}
token: [[ env GITHUB_TOKEN ]]
imageRepo:
user: [[ DOCKERHUB_USER ]]
```
Update the "YOUR_GITHUB_USER" and "YOUR_DOCKERHUB_USER" in the above file accordingly.
---
## Run
First, initialize:
```bash
# this downloads the required plugins, according to the config file, automatically.
dtm init -f config.yaml
```

Then we apply it by running:

```bash
dtm apply -f config.yaml -y
```

(Screenshot/video omitted.)

0 comments on commit ceb1eca

Please sign in to comment.