diff --git a/.github/sync-staging-repo.yml b/.github/sync-staging-repo.yml index 440e2b061..9b01c0ec2 100644 --- a/.github/sync-staging-repo.yml +++ b/.github/sync-staging-repo.yml @@ -2,18 +2,10 @@ devstream-io/dtm-gitlab-share-library: - source: staging/dtm-gitlab-share-library/ dest: . deleteOrphaned: true -devstream-io/dtm-jenkins-share-library: - - source: staging/dtm-jenkins-share-library/ - dest: . - deleteOrphaned: true devstream-io/dtm-pipeline-templates: - source: staging/dtm-pipeline-templates/ dest: . deleteOrphaned: true -devstream-io/dtm-repo-scaffolding-golang: - - source: staging/dtm-repo-scaffolding-golang/ - dest: . - deleteOrphaned: true devstream-io/dtm-repo-scaffolding-golang-cli: - source: staging/dtm-repo-scaffolding-golang-cli/ dest: . @@ -26,10 +18,6 @@ devstream-io/dtm-repo-scaffolding-java-springboot: - source: staging/dtm-repo-scaffolding-java-springboot/ dest: . deleteOrphaned: true -devstream-io/dtm-repo-scaffolding-python: - - source: staging/dtm-repo-scaffolding-python/ - dest: . - deleteOrphaned: true devstream-io/dtm-repo-scaffolding-python-flask: - source: staging/dtm-repo-scaffolding-python-flask/ dest: . diff --git a/docs/plugins/repo-scaffolding.md b/docs/plugins/repo-scaffolding.md index 91e934e8d..74b334685 100644 --- a/docs/plugins/repo-scaffolding.md +++ b/docs/plugins/repo-scaffolding.md @@ -91,11 +91,12 @@ This plugin has three outputs: These repos are official scaffolding repo to use for `sourceRepo` config, You can use these repo directly or just create one for yourself. -| language | org | repo | -|-------------|---------------|----------------------------| -| Golang | devstream-io | dtm-repo-scaffolding-golang | -| Golang | devstream-io | dtm-repo-scaffolding-golang-cli | -| Java Spring | spring-guides | gs-spring-boot | +| language | org | repo | +|-------------|---------------|-------------------------------------| +| Golang | devstream-io | dtm-repo-scaffolding-golang-gin | +| Golang | devstream-io | dtm-repo-scaffolding-golang-cli | +| Python | devstream-io | dtm-repo-scaffolding-python-flask | +| Java | devstream-io | dtm-repo-scaffolding-java-springboot| ### Golang @@ -113,7 +114,7 @@ tools: scmType: github sourceRepo: org: devstream-io - name: dtm-repo-scaffolding-golang + name: dtm-repo-scaffolding-golang-gin scmType: github vars: imageRepo: dtm-test/golang-repo @@ -158,8 +159,8 @@ tools: visibility: public scmType: gitlab sourceRepo: - org: spring-guides - name: gs-spring-boot + org: devstream-io + name: dtm-repo-scaffolding-java-springboot scmType: github ``` diff --git a/internal/pkg/configmanager/configmanager_test.go b/internal/pkg/configmanager/configmanager_test.go index a5297f8be..00b14132e 100644 --- a/internal/pkg/configmanager/configmanager_test.go +++ b/internal/pkg/configmanager/configmanager_test.go @@ -41,8 +41,8 @@ apps: scmType: github owner: devstream-io org: devstream-io # choose between owner and org - name: dtm-repo-scaffolding-golang - url: github.com/devstream-io/dtm-repo-scaffolding-golang # optional,if url is specified,we can infer scm/owner/org/name from url + name: dtm-repo-scaffolding-golang-gin + url: github.com/devstream-io/dtm-repo-scaffolding-golang-gin # optional,if url is specified,we can infer scm/owner/org/name from url ci: - type: template templateName: ci-pipeline-for-gh-actions @@ -199,9 +199,9 @@ pipelineTemplates: }, "sourceRepo": RawOptions{ "scmType": "github", - "url": git.ScmURL("github.com/devstream-io/dtm-repo-scaffolding-golang"), + "url": git.ScmURL("github.com/devstream-io/dtm-repo-scaffolding-golang-gin"), "owner": "devstream-io", - "name": "dtm-repo-scaffolding-golang", + "name": "dtm-repo-scaffolding-golang-gin", "org": "devstream-io", }, "vars": RawOptions{}, diff --git a/pkg/util/scm/github/download.go b/pkg/util/scm/github/download.go index 6a236ac65..7cdc9987b 100644 --- a/pkg/util/scm/github/download.go +++ b/pkg/util/scm/github/download.go @@ -45,7 +45,7 @@ func (c *Client) DownloadAsset(tagName, assetName, fileName string) error { } // 3. get download url - // format: https://github.com/merico-dev/dtm-repo-scaffolding-golang/releases/download/v0.0.1/dtm-repo-scaffolding-golang-v0.0.1.tar.gz + // format: https://github.com/merico-dev/dtm-repo-scaffolding-golang-gin/releases/download/v0.0.1/dtm-repo-scaffolding-golang-gin-v0.0.1.tar.gz var downloadUrl string for _, a := range assets { if a.GetName() == assetName { diff --git a/pkg/util/scm/github/github_test.go b/pkg/util/scm/github/github_test.go index eb99e56a3..93ad9f4cd 100644 --- a/pkg/util/scm/github/github_test.go +++ b/pkg/util/scm/github/github_test.go @@ -24,12 +24,12 @@ var ( OptNotNeedAuth = &git.RepoInfo{ Owner: "", Org: "devstream-io", - Repo: "dtm-repo-scaffolding-golang", + Repo: "dtm-repo-scaffolding-golang-gin", } OptNeedAuth = &git.RepoInfo{ Owner: "", Org: "devstream-io", - Repo: "dtm-repo-scaffolding-golang", + Repo: "dtm-repo-scaffolding-golang-gin", NeedAuth: true, } ) diff --git a/staging/dtm-repo-scaffolding-golang/.gitignore b/staging/dtm-repo-scaffolding-golang/.gitignore deleted file mode 100644 index 66fd13c90..000000000 --- a/staging/dtm-repo-scaffolding-golang/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Dependency directories (remove the comment below to include it) -# vendor/ diff --git a/staging/dtm-repo-scaffolding-golang/Dockerfile.tpl b/staging/dtm-repo-scaffolding-golang/Dockerfile.tpl deleted file mode 100644 index 9db616715..000000000 --- a/staging/dtm-repo-scaffolding-golang/Dockerfile.tpl +++ /dev/null @@ -1,12 +0,0 @@ -FROM golang:alpine AS build-env -WORKDIR $GOPATH/src/github.com/[[.Repo.Owner]]/[[.Repo.Name]] -COPY . . -RUN apk add git -RUN go get ./... && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o app cmd/[[.AppName]]/main.go - -FROM alpine -WORKDIR /app -COPY --from=build-env /go/src/github.com/[[.Repo.Owner]]/[[.Repo.Name]]/app /app/ -CMD ["./app"] -USER 1000 -EXPOSE 8080/tcp diff --git a/staging/dtm-repo-scaffolding-golang/Makefile.tpl b/staging/dtm-repo-scaffolding-golang/Makefile.tpl deleted file mode 100644 index 7cbb516c9..000000000 --- a/staging/dtm-repo-scaffolding-golang/Makefile.tpl +++ /dev/null @@ -1,22 +0,0 @@ -SHELL := /bin/bash -BASEDIR = $(shell pwd) - -.PHONY: help -help: - @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' - -.PHONY: install -install: ## Install dependencies - @go mod download - @go mod vendor - -.PHONY: dev -dev: ## Run with Dev - @go run cmd/[[.AppName]]/main.go - -.PHONY: build -build: ## Build todomvc - @go build -o build/[[.AppName]] cmd/[[.AppName]]/main.go - -clean: ### Remove build dir - @rm -rf build diff --git a/staging/dtm-repo-scaffolding-golang/README.md b/staging/dtm-repo-scaffolding-golang/README.md deleted file mode 100644 index e9e15b1eb..000000000 --- a/staging/dtm-repo-scaffolding-golang/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# dtm-repo-scaffolding-golang - -This repo contains templates used by DevStream plugin "repo-scaffolding" (thereafter: the plugin). - -This repo isn't intended to be used directly without DevStream. It should only be consumed by the plugin automatically. - -The plugin (together with this repo of templates) can create a repo in GitHub and set up the project layout and initialize the reop with necessary files that are typical for a Go web app. The followings can be created automatically: - -- a Go web app example (source code from [here](https://go.dev/doc/tutorial/web-service-gin)) with the [Gin Web Framework](https://github.com/gin-gonic/gin) -- directory structure, following [Standard Go Project Layout](https://github.com/golang-standards/project-layout) best practice -- `.gitignore`, generated by [Toptal | gitignore.io](https://www.toptal.com/developers/gitignore/api/go,vim,macos,visualstudiocode) with minimum changes -- Makefile, with install/dev/build/clean -- Dockerfile, with multistage build -- a simplified Helm chart with Deployment and Service - -## Usage - -- Render all files using go template whose name end with `.tpl` suffix. -- Files whose name don't end with `.tpl` extension don't need to be rendered. -- subdirectory "helm/**_app_name_**" (the **_app_name_** part) should be rendered with `AppName` -- subdicrectory "cmd/**_app_name_**" (the **_app_name_** part) should be rendered with `AppName` - -Example of required parameters to render these templates: - -```yaml -AppName: my-hello-world -Repo: - Owner: ironcore864 - Name: my-hello-world -ImageRepo: ironcore864/my-hello-world # dockerhub -``` - -## Where does this repo come from? - -`dtm-repo-scaffolding-golang` is synced from https://github.com/devstream-io/devstream/blob/main/staging/dtm-repo-scaffolding-golang. -Code changes are made in that location, merged into `devstream-io/devstream` and later synced here. diff --git a/staging/dtm-repo-scaffolding-golang/README.md.tpl b/staging/dtm-repo-scaffolding-golang/README.md.tpl deleted file mode 100644 index 1fc169e73..000000000 --- a/staging/dtm-repo-scaffolding-golang/README.md.tpl +++ /dev/null @@ -1,11 +0,0 @@ -# [[.AppName]] - -This is a repo for app [[.AppName]]; bootstrapped by DevStream. - -By default, the automatically generated scaffolding contains: - -- a piece of sample go web app code using the [Gin Web Framework](https://github.com/gin-gonic/gin) -- .gitignore -- Makefile -- Dockerfile -- Helm chart diff --git a/staging/dtm-repo-scaffolding-golang/cmd/_app_name_/main.go.tpl b/staging/dtm-repo-scaffolding-golang/cmd/_app_name_/main.go.tpl deleted file mode 100644 index fffdc361d..000000000 --- a/staging/dtm-repo-scaffolding-golang/cmd/_app_name_/main.go.tpl +++ /dev/null @@ -1,17 +0,0 @@ -package main - -import ( - "github.com/gin-gonic/gin" - - "github.com/[[.Repo.Owner]]/[[.Repo.Name]]/internal/pkg/album" -) - -func main() { - router := gin.Default() - - router.GET("/albums", album.GetAlbums) - router.GET("/albums/:id", album.GetAlbumByID) - router.POST("/albums", album.PostAlbums) - - router.Run("localhost:8080") -} diff --git a/staging/dtm-repo-scaffolding-golang/go.mod.tpl b/staging/dtm-repo-scaffolding-golang/go.mod.tpl deleted file mode 100644 index f50f9c8e1..000000000 --- a/staging/dtm-repo-scaffolding-golang/go.mod.tpl +++ /dev/null @@ -1,22 +0,0 @@ -module github.com/[[.Repo.Owner]]/[[.Repo.Name]] - -go 1.18 - -require github.com/gin-gonic/gin v1.7.7 - -require ( - github.com/gin-contrib/sse v0.1.0 // indirect - github.com/go-playground/locales v0.13.0 // indirect - github.com/go-playground/universal-translator v0.17.0 // indirect - github.com/go-playground/validator/v10 v10.4.1 // indirect - github.com/golang/protobuf v1.3.3 // indirect - github.com/json-iterator/go v1.1.9 // indirect - github.com/leodido/go-urn v1.2.0 // indirect - github.com/mattn/go-isatty v0.0.12 // indirect - github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect - github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect - github.com/ugorji/go/codec v1.1.7 // indirect - golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect - golang.org/x/sys v0.0.0-20200116001909-b77594299b42 // indirect - gopkg.in/yaml.v2 v2.2.8 // indirect -) diff --git a/staging/dtm-repo-scaffolding-golang/go.sum.tpl b/staging/dtm-repo-scaffolding-golang/go.sum.tpl deleted file mode 100644 index 5ee9be125..000000000 --- a/staging/dtm-repo-scaffolding-golang/go.sum.tpl +++ /dev/null @@ -1,54 +0,0 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.7.7 h1:3DoBmSbJbZAWqXJC3SLjAPfutPJJRN1U5pALB7EeTTs= -github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U= -github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= -github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/staging/dtm-repo-scaffolding-golang/helm/_app_name_/.helmignore.tpl b/staging/dtm-repo-scaffolding-golang/helm/_app_name_/.helmignore.tpl deleted file mode 100644 index 0e8a0eb36..000000000 --- a/staging/dtm-repo-scaffolding-golang/helm/_app_name_/.helmignore.tpl +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/staging/dtm-repo-scaffolding-golang/helm/_app_name_/Chart.yaml.tpl b/staging/dtm-repo-scaffolding-golang/helm/_app_name_/Chart.yaml.tpl deleted file mode 100644 index 5311ec587..000000000 --- a/staging/dtm-repo-scaffolding-golang/helm/_app_name_/Chart.yaml.tpl +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v2 -name: [[.AppName]] -description: A Helm chart for Kubernetes -type: application -version: 1.0.0 -appVersion: 0.0.1 diff --git a/staging/dtm-repo-scaffolding-golang/helm/_app_name_/templates/deployment.yaml.tpl b/staging/dtm-repo-scaffolding-golang/helm/_app_name_/templates/deployment.yaml.tpl deleted file mode 100644 index 8596ad54f..000000000 --- a/staging/dtm-repo-scaffolding-golang/helm/_app_name_/templates/deployment.yaml.tpl +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: [[.AppName]] - labels: - app: [[.AppName]] -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - app: [[.AppName]] - template: - metadata: - labels: - app: [[.AppName]] - spec: - containers: - - name: [[.AppName]] - image: "[[.imageRepo]]:{{ .Chart.AppVersion }}" - ports: - - containerPort: 8080 diff --git a/staging/dtm-repo-scaffolding-golang/helm/_app_name_/templates/service.yaml.tpl b/staging/dtm-repo-scaffolding-golang/helm/_app_name_/templates/service.yaml.tpl deleted file mode 100644 index 2388726ee..000000000 --- a/staging/dtm-repo-scaffolding-golang/helm/_app_name_/templates/service.yaml.tpl +++ /dev/null @@ -1,10 +0,0 @@ -kind: Service -apiVersion: v1 -metadata: - name: [[.AppName]] -spec: - selector: - app: [[.AppName]] - ports: - - port: 80 - targetPort: 8080 diff --git a/staging/dtm-repo-scaffolding-golang/helm/_app_name_/values.yaml.tpl b/staging/dtm-repo-scaffolding-golang/helm/_app_name_/values.yaml.tpl deleted file mode 100644 index ebf6be86b..000000000 --- a/staging/dtm-repo-scaffolding-golang/helm/_app_name_/values.yaml.tpl +++ /dev/null @@ -1 +0,0 @@ -replicaCount: 1 diff --git a/staging/dtm-repo-scaffolding-golang/internal/pkg/album/album.go.tpl b/staging/dtm-repo-scaffolding-golang/internal/pkg/album/album.go.tpl deleted file mode 100644 index acb7f2212..000000000 --- a/staging/dtm-repo-scaffolding-golang/internal/pkg/album/album.go.tpl +++ /dev/null @@ -1,16 +0,0 @@ -package album - -// album represents data about a record album. -type album struct { - ID string `json:"id"` - Title string `json:"title"` - Artist string `json:"artist"` - Price float64 `json:"price"` -} - -// albums slice to seed record album data. -var albums = []album{ - {ID: "1", Title: "Blue Train", Artist: "John Coltrane", Price: 56.99}, - {ID: "2", Title: "Jeru", Artist: "Gerry Mulligan", Price: 17.99}, - {ID: "3", Title: "Sarah Vaughan and Clifford Brown", Artist: "Sarah Vaughan", Price: 39.99}, -} diff --git a/staging/dtm-repo-scaffolding-golang/internal/pkg/album/get.go.tpl b/staging/dtm-repo-scaffolding-golang/internal/pkg/album/get.go.tpl deleted file mode 100644 index a00e79d8c..000000000 --- a/staging/dtm-repo-scaffolding-golang/internal/pkg/album/get.go.tpl +++ /dev/null @@ -1,28 +0,0 @@ -package album - -import ( - "net/http" - - "github.com/gin-gonic/gin" -) - -// GetAlbums responds with the list of all albums as JSON. -func GetAlbums(c *gin.Context) { - c.IndentedJSON(http.StatusOK, albums) -} - -// GetAlbumByID locates the album whose ID value matches the id -// parameter sent by the client, then returns that album as a response. -func GetAlbumByID(c *gin.Context) { - id := c.Param("id") - - // Loop through the list of albums, looking for - // an album whose ID value matches the parameter. - for _, a := range albums { - if a.ID == id { - c.IndentedJSON(http.StatusOK, a) - return - } - } - c.IndentedJSON(http.StatusNotFound, gin.H{"message": "album not found"}) -} diff --git a/staging/dtm-repo-scaffolding-golang/internal/pkg/album/post.go.tpl b/staging/dtm-repo-scaffolding-golang/internal/pkg/album/post.go.tpl deleted file mode 100644 index dbdddbfd4..000000000 --- a/staging/dtm-repo-scaffolding-golang/internal/pkg/album/post.go.tpl +++ /dev/null @@ -1,22 +0,0 @@ -package album - -import ( - "net/http" - - "github.com/gin-gonic/gin" -) - -// PostAlbums adds an album from JSON received in the request body. -func PostAlbums(c *gin.Context) { - var newAlbum album - - // Call BindJSON to bind the received JSON to - // newAlbum. - if err := c.BindJSON(&newAlbum); err != nil { - return - } - - // Add the new album to the slice. - albums = append(albums, newAlbum) - c.IndentedJSON(http.StatusCreated, newAlbum) -} diff --git a/staging/dtm-repo-scaffolding-python/.gitignore b/staging/dtm-repo-scaffolding-python/.gitignore deleted file mode 100644 index 1d9734bd8..000000000 --- a/staging/dtm-repo-scaffolding-python/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -.venv/ - -*.pyc -__pycache__/ - -instance/ - -.pytest_cache/ -.coverage -htmlcov/ - -dist/ -build/ -*.egg-info/ diff --git a/staging/dtm-repo-scaffolding-python/Dockerfile.tpl b/staging/dtm-repo-scaffolding-python/Dockerfile.tpl deleted file mode 100644 index cbc91717f..000000000 --- a/staging/dtm-repo-scaffolding-python/Dockerfile.tpl +++ /dev/null @@ -1,14 +0,0 @@ -FROM python:3.10-alpine - -WORKDIR /code - -COPY ./requirements.txt /code/requirements.txt - -RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt - -COPY ./wsgi.py /code/ -COPY ./app /code/app - -USER 1000 - -CMD ["gunicorn", "--conf", "app/gunicorn.conf.py", "--bind", "0.0.0.0:8080", "wsgi:app"] diff --git a/staging/dtm-repo-scaffolding-python/README.md b/staging/dtm-repo-scaffolding-python/README.md deleted file mode 100644 index 05d62a0db..000000000 --- a/staging/dtm-repo-scaffolding-python/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# dtm-repo-scaffolding-python - -This repo contains templates used by DevStream plugin "repo-scaffolding" (thereafter: the plugin). - -This repo isn't intended to be used directly without DevStream. It should only be consumed by the plugin automatically. - -The plugin (together with this repo of templates) can create a repo in GitHub and set up the project layout and initialize the reop with necessary files that are typical for a Go web app. The followings can be created automatically: - -- a Python web app example using the Flask framework -- directory structure, following Flask/Python best practice -- `.gitignore`, suggested by Flask -- Dockerfile with Python alpline -- a simplified Helm chart with Deployment and Service - -## Usage - -- Render all files using go template whose name end with `.tpl` suffix. -- Files whose name don't end with `.tpl` extension don't need to be rendered. -- subdirectory "helm/**_app_name_**" (the **_app_name_** part) should be rendered with `AppName` -- subdicrectory "cmd/**_app_name_**" (the **_app_name_** part) should be rendered with `AppName` - -Example of required parameters to render these templates: - -```yaml -AppName: hello -Repo: - Owner: ironcore864 - Name: hello -imageRepo: ironcore864/hello # dockerhub -``` - -## Where does this repo come from? - -`dtm-repo-scaffolding-python` is synced from https://github.com/devstream-io/devstream/blob/main/staging/dtm-repo-scaffolding-python. -Code changes are made in that location, merged into `devstream-io/devstream` and later synced here. diff --git a/staging/dtm-repo-scaffolding-python/README.md.tpl b/staging/dtm-repo-scaffolding-python/README.md.tpl deleted file mode 100644 index 5d33ac46d..000000000 --- a/staging/dtm-repo-scaffolding-python/README.md.tpl +++ /dev/null @@ -1,47 +0,0 @@ -# [[.AppName]] - -This is a repo for app [[.AppName]]; bootstrapped by DevStream. - -By default, the automatically generated scaffolding contains: - -- a piece of sample Python [Flask](https://flask.palletsprojects.com/en/2.2.0/) web app -- sample unittest -- .gitignore -- requirements.txt -- wsgi.py -- Dockerfile -- Helm chart - -## Dev - -### Run Locally - -```shell -python3 -m venv .venv -. .venv/bin/activate -pip install -r requirements.txt -flask --app app/[[.AppName]].py run -``` - -### Run in Docker - -```shell -docker build . -t [[.imageRepo]]:latest -docker run -it -d -p 8080:8080 [[.imageRepo]]:latest -``` - -### Run in K8s - -```shell -# install -helm install [[.AppName]] helm/[[.AppName]]/ - -# uninstall -helm delete [[.AppName]] -``` - -## Test - -```shell -python3 -m unittest -``` diff --git a/staging/dtm-repo-scaffolding-python/app/_app_name_.py.tpl b/staging/dtm-repo-scaffolding-python/app/_app_name_.py.tpl deleted file mode 100644 index 368408f45..000000000 --- a/staging/dtm-repo-scaffolding-python/app/_app_name_.py.tpl +++ /dev/null @@ -1,12 +0,0 @@ -from flask import Flask - -app = Flask(__name__) - - -@app.route("/") -def hello(): - return "Hello, World!" - - -if __name__ == "__main__": - app.run(host='0.0.0.0') diff --git a/staging/dtm-repo-scaffolding-python/app/gunicorn.conf.py.tpl b/staging/dtm-repo-scaffolding-python/app/gunicorn.conf.py.tpl deleted file mode 100644 index cad345508..000000000 --- a/staging/dtm-repo-scaffolding-python/app/gunicorn.conf.py.tpl +++ /dev/null @@ -1,9 +0,0 @@ -# Gunicorn config variables -loglevel = "info" -errorlog = "-" # stderr -accesslog = "-" # stdout -worker_tmp_dir = "/dev/shm" -graceful_timeout = 120 -timeout = 120 -keepalive = 5 -threads = 3 diff --git a/staging/dtm-repo-scaffolding-python/helm/_app_name_/.helmignore.tpl b/staging/dtm-repo-scaffolding-python/helm/_app_name_/.helmignore.tpl deleted file mode 100644 index 0e8a0eb36..000000000 --- a/staging/dtm-repo-scaffolding-python/helm/_app_name_/.helmignore.tpl +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/staging/dtm-repo-scaffolding-python/helm/_app_name_/Chart.yaml.tpl b/staging/dtm-repo-scaffolding-python/helm/_app_name_/Chart.yaml.tpl deleted file mode 100644 index 5311ec587..000000000 --- a/staging/dtm-repo-scaffolding-python/helm/_app_name_/Chart.yaml.tpl +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v2 -name: [[.AppName]] -description: A Helm chart for Kubernetes -type: application -version: 1.0.0 -appVersion: 0.0.1 diff --git a/staging/dtm-repo-scaffolding-python/helm/_app_name_/templates/deployment.yaml.tpl b/staging/dtm-repo-scaffolding-python/helm/_app_name_/templates/deployment.yaml.tpl deleted file mode 100644 index 85a0700e1..000000000 --- a/staging/dtm-repo-scaffolding-python/helm/_app_name_/templates/deployment.yaml.tpl +++ /dev/null @@ -1,22 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: [[.AppName]] - labels: - app: [[.AppName]] -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - app: [[.AppName]] - template: - metadata: - labels: - app: [[.AppName]] - spec: - containers: - - name: [[.AppName]] - image: "[[.imageRepo]]:{{ .Chart.AppVersion }}" - ports: - - containerPort: 8080 diff --git a/staging/dtm-repo-scaffolding-python/helm/_app_name_/templates/service.yaml.tpl b/staging/dtm-repo-scaffolding-python/helm/_app_name_/templates/service.yaml.tpl deleted file mode 100644 index bcc15bba8..000000000 --- a/staging/dtm-repo-scaffolding-python/helm/_app_name_/templates/service.yaml.tpl +++ /dev/null @@ -1,11 +0,0 @@ ---- -kind: Service -apiVersion: v1 -metadata: - name: [[.AppName]] -spec: - selector: - app: [[.AppName]] - ports: - - port: 80 - targetPort: 8080 diff --git a/staging/dtm-repo-scaffolding-python/helm/_app_name_/values.yaml.tpl b/staging/dtm-repo-scaffolding-python/helm/_app_name_/values.yaml.tpl deleted file mode 100644 index ebf6be86b..000000000 --- a/staging/dtm-repo-scaffolding-python/helm/_app_name_/values.yaml.tpl +++ /dev/null @@ -1 +0,0 @@ -replicaCount: 1 diff --git a/staging/dtm-repo-scaffolding-python/requirements.txt.tpl b/staging/dtm-repo-scaffolding-python/requirements.txt.tpl deleted file mode 100644 index 9cc47abb3..000000000 --- a/staging/dtm-repo-scaffolding-python/requirements.txt.tpl +++ /dev/null @@ -1,2 +0,0 @@ -Flask==2.2.0 -gunicorn==20.1.0 diff --git a/staging/dtm-repo-scaffolding-python/test/__init__.py b/staging/dtm-repo-scaffolding-python/test/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/staging/dtm-repo-scaffolding-python/test/__init__.py.tpl b/staging/dtm-repo-scaffolding-python/test/__init__.py.tpl deleted file mode 100644 index 8b1378917..000000000 --- a/staging/dtm-repo-scaffolding-python/test/__init__.py.tpl +++ /dev/null @@ -1 +0,0 @@ - diff --git a/staging/dtm-repo-scaffolding-python/test/test__app_name_.py.tpl b/staging/dtm-repo-scaffolding-python/test/test__app_name_.py.tpl deleted file mode 100644 index 090ac296b..000000000 --- a/staging/dtm-repo-scaffolding-python/test/test__app_name_.py.tpl +++ /dev/null @@ -1,12 +0,0 @@ -import unittest - -from app.[[.AppName]] import hello - - -class TestHello(unittest.TestCase): - def test_hello(self): - self.assertEqual(hello(), "Hello, World!") - - -if __name__ == '__main__': - unittest.main() diff --git a/staging/dtm-repo-scaffolding-python/wsgi.py.tpl b/staging/dtm-repo-scaffolding-python/wsgi.py.tpl deleted file mode 100644 index 20aa74286..000000000 --- a/staging/dtm-repo-scaffolding-python/wsgi.py.tpl +++ /dev/null @@ -1,4 +0,0 @@ -from app.[[.AppName]] import app - -if __name__ == "__main__": - app.run()