ONSdigital / dp-cli

A helpful command line tool to make Digital Publishing developers' lives better
3 stars 1 forks source link

Update dp generation tool #132

Closed nshumoogum closed 1 year ago

nshumoogum commented 1 year ago

What

CI templates updated to pull golangci golangci-lint image and update Makefiles to run the linters when lint target is executed

How to review

./dp generate-project --create-repository n --name "dp-hello-world-api" --description "Example api project generated by dp-cli" --go-version 1.19.6 --port 8123 --project-location ../dp-hello-world --type api

./dp generate-project --create-repository n --name "dp-hello-world-event" --description "Example event driven app project generated by dp-cli" --go-version 1.19.6 --port 8123 --project-location ../dp-hello-world --type event-driven

./dp generate-project --create-repository n --name "dp-hello-world-library" --description "Example library project generated by dp-cli" --go-version 1.19.6 --port 8123 --project-location ../dp-hello-world --type library



- Lastly check for changes in your local dp-hello-world, run: `git diff` (any go.mod/go.sum changes could be because of any recent updates since creating PRs)

### Who can review

Anyone
jessjenkins commented 1 year ago

I'm seeing a lot of differences in dp-hello-world after regeneration for the event and controller, pus the library example doesn't exist at all…

➜  dp-hello-world git:(master) ✗ git st
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   dp-hello-world-controller/Dockerfile.concourse
    modified:   dp-hello-world-controller/LICENSE.md
    modified:   dp-hello-world-controller/Makefile
    modified:   dp-hello-world-controller/README.md
    modified:   dp-hello-world-controller/ci/component.yml
    modified:   dp-hello-world-controller/dp-hello-world-controller.nomad
    modified:   dp-hello-world-controller/go.mod
    modified:   dp-hello-world-controller/go.sum
    deleted:    dp-hello-world-controller/handlers/clients_mock.go
    modified:   dp-hello-world-controller/service/mocks/healthcheck.go
    modified:   dp-hello-world-controller/service/mocks/initialiser.go
    modified:   dp-hello-world-controller/service/mocks/server.go
    modified:   dp-hello-world-event/Dockerfile.concourse
    modified:   dp-hello-world-event/LICENSE.md
    modified:   dp-hello-world-event/Makefile
    modified:   dp-hello-world-event/README.md
    modified:   dp-hello-world-event/dp-hello-world-event.nomad
    modified:   dp-hello-world-event/event/mock/handler.go
    modified:   dp-hello-world-event/go.mod
    modified:   dp-hello-world-event/go.sum
    modified:   dp-hello-world-event/service/mock/healthCheck.go
    modified:   dp-hello-world-event/service/mock/initialiser.go
    modified:   dp-hello-world-event/service/mock/server.go

Untracked files:
  (use "git add <file>..." to include in what will be committed)
    dp-hello-world-library/

no changes added to commit (use "git add" and/or "git commit -a")
jessjenkins commented 1 year ago

Also, why does library generation need a go version supplied at all? Library go versions are determined by the app using them so CI uses latest for its docker images.

jessjenkins commented 1 year ago

NB. the command should be dp generate-project … rather than dp generation-tool … (as per the PR description)

jessjenkins commented 1 year ago

The event and controller projects have errors during the go build ./... stage. Ie. the built examples aren't valid builds. Not really the scope of this PR but it is an underlying problem.

nshumoogum commented 1 year ago

I'm seeing a lot of differences in dp-hello-world after regeneration for the event and controller, pus the library example doesn't exist at all…

➜  dp-hello-world git:(master) ✗ git st
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
  modified:   dp-hello-world-controller/Dockerfile.concourse
  modified:   dp-hello-world-controller/LICENSE.md
  modified:   dp-hello-world-controller/Makefile
  modified:   dp-hello-world-controller/README.md
  modified:   dp-hello-world-controller/ci/component.yml
  modified:   dp-hello-world-controller/dp-hello-world-controller.nomad
  modified:   dp-hello-world-controller/go.mod
  modified:   dp-hello-world-controller/go.sum
  deleted:    dp-hello-world-controller/handlers/clients_mock.go
  modified:   dp-hello-world-controller/service/mocks/healthcheck.go
  modified:   dp-hello-world-controller/service/mocks/initialiser.go
  modified:   dp-hello-world-controller/service/mocks/server.go
  modified:   dp-hello-world-event/Dockerfile.concourse
  modified:   dp-hello-world-event/LICENSE.md
  modified:   dp-hello-world-event/Makefile
  modified:   dp-hello-world-event/README.md
  modified:   dp-hello-world-event/dp-hello-world-event.nomad
  modified:   dp-hello-world-event/event/mock/handler.go
  modified:   dp-hello-world-event/go.mod
  modified:   dp-hello-world-event/go.sum
  modified:   dp-hello-world-event/service/mock/healthCheck.go
  modified:   dp-hello-world-event/service/mock/initialiser.go
  modified:   dp-hello-world-event/service/mock/server.go

Untracked files:
  (use "git add <file>..." to include in what will be committed)
  dp-hello-world-library/

no changes added to commit (use "git add" and/or "git commit -a")

So changes to dp-hello-world exist in this PR - https://github.com/ONSdigital/dp-hello-world/pull/18 - is this blocked until that PR is approved?

jessjenkins commented 1 year ago

So changes to dp-hello-world exist in this PR - https://github.com/ONSdigital/dp-hello-world/pull/18 - is this blocked until that PR is approved? Not blocked, but it would make sense to approve that one if it's already in the generation templates now anyway.