From 01187125d360bdef1dca5eeeae9b8a7ff4b9911f Mon Sep 17 00:00:00 2001 From: Fabian Fischer Date: Fri, 1 Apr 2022 13:25:24 +0200 Subject: [PATCH] Setup base project Throw out everything we do not need, including base CLI setup as we will switch to a kubebuilder based setup. --- .github/ISSUE_TEMPLATE/config.yml | 6 - .github/workflows/docs.yml | 82 -- .github/workflows/test.yml | 3 +- .gitignore | 3 +- .goreleaser.yml | 3 - Dockerfile | 5 +- Makefile | 3 - Makefile.vars.mk | 5 +- README.md | 132 +--- docs/antora-build.mk | 24 - docs/antora-playbook.yml | 19 - docs/antora-preview.mk | 7 - docs/antora.yml | 7 - docs/modules/ROOT/assets/images/.gitkeep | 0 docs/modules/ROOT/examples/.gitkeep | 0 docs/modules/ROOT/nav.adoc | 15 - docs/modules/ROOT/pages/examples/.gitkeep | 0 docs/modules/ROOT/pages/explanations/.gitkeep | 0 docs/modules/ROOT/pages/how-tos/.gitkeep | 0 docs/modules/ROOT/pages/index.adoc | 21 - docs/modules/ROOT/pages/references/.gitkeep | 0 docs/modules/ROOT/pages/tutorials/.gitkeep | 0 docs/modules/ROOT/partials/.gitkeep | 0 docs/package-lock.json | 727 ------------------ docs/package.json | 8 - example_command.go | 67 -- example_command_test.go | 42 - go.mod | 22 +- go.sum | 40 - logger.go | 77 -- main.go | 101 +-- main_test.go | 21 - 32 files changed, 23 insertions(+), 1417 deletions(-) delete mode 100644 .github/workflows/docs.yml delete mode 100644 docs/antora-build.mk delete mode 100644 docs/antora-playbook.yml delete mode 100644 docs/antora-preview.mk delete mode 100644 docs/antora.yml delete mode 100644 docs/modules/ROOT/assets/images/.gitkeep delete mode 100644 docs/modules/ROOT/examples/.gitkeep delete mode 100644 docs/modules/ROOT/nav.adoc delete mode 100644 docs/modules/ROOT/pages/examples/.gitkeep delete mode 100644 docs/modules/ROOT/pages/explanations/.gitkeep delete mode 100644 docs/modules/ROOT/pages/how-tos/.gitkeep delete mode 100644 docs/modules/ROOT/pages/index.adoc delete mode 100644 docs/modules/ROOT/pages/references/.gitkeep delete mode 100644 docs/modules/ROOT/pages/tutorials/.gitkeep delete mode 100644 docs/modules/ROOT/partials/.gitkeep delete mode 100644 docs/package-lock.json delete mode 100644 docs/package.json delete mode 100644 example_command.go delete mode 100644 example_command_test.go delete mode 100644 logger.go delete mode 100644 main_test.go diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index c07048c..3ba13e0 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,7 +1 @@ blank_issues_enabled: false - -# TODO: Redirect support questions -# contact_links: -# - name: ❓ Question -# url: https://github.com///discussions -# about: Ask or discuss with us, we're happy to help 🙋 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index d7da17f..0000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: Docs - -on: - push: - branches: - - master - tags: - - "*" - -jobs: - antora: - runs-on: ubuntu-latest - if: ${{ contains(github.ref, 'tags') }} - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Configure Git - run: | - git config user.name "Antora via GitHub Actions" - git config user.email "actions@github.com" - - - name: Parse semver string - id: semver - uses: booxmedialtd/ws-action-parse-semver@v1 - with: - input_string: ${{ github.ref }} - version_extractor_regex: '\/v(.*)$' - - name: Set variables - run: | - echo "MINOR_VERSION=${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }}" >> $GITHUB_ENV - echo "BRANCH_NAME=docs/v${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }}" >> $GITHUB_ENV - - name: Set branch name for Prerelease - if: ${{ steps.semver.outputs.prerelease != '' }} - run: echo "BRANCH_NAME=${{ env.BRANCH_NAME }}-rc" >> $GITHUB_ENV - - - name: Checkout remote branch if exists - run: git checkout ${{ env.BRANCH_NAME }} - continue-on-error: true - - name: Rebase if possible - run: git rebase ${GITHUB_REF##*/} ${{ env.BRANCH_NAME }} - continue-on-error: true - - name: Create new branch if not existing - run: git switch --create ${{ env.BRANCH_NAME }} - continue-on-error: true - - - name: Patch Antora file for Release - run: yq eval 'del(.prerelease) | del (.display_version) | .version = "${{ env.MINOR_VERSION }}"' -i docs/antora.yml - if: ${{ steps.semver.outputs.prerelease == '' }} - - name: Patch Antora file for Prerelease - run: yq eval 'del (.display_version) | .version = "${{ env.MINOR_VERSION }}", .prerelease = "-${{ steps.semver.outputs.prerelease }}"' -i docs/antora.yml - if: ${{ steps.semver.outputs.prerelease != '' }} - - - name: Commit - run: git commit --all --message "Update version for Antora" - continue-on-error: true - - name: Push - run: git push --atomic --force --set-upstream origin ${{ env.BRANCH_NAME }} - - - name: Cleanup prerelease branch if existing - if: ${{ steps.semver.outputs.prerelease == '' }} - run: git push origin --delete ${{ env.BRANCH_NAME }}-rc - continue-on-error: true - - gh-pages: - runs-on: ubuntu-latest - # The needs+if combo will cause this job to wait until Antora versioning is done for tags, but still run on master branch - needs: antora - if: always() - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Configure Git - run: | - git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}" - git config user.name "Antora via GitHub Actions" - git config user.email "actions@github.com" - - - name: Publish documentation - run: make docs-publish diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7061542..3ac945d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,8 +34,7 @@ jobs: - name: Upload code coverage report to Code Climate uses: paambaati/codeclimate-action@v3.0.0 env: - # TODO: Update Reporter ID after importing in codeclimate.com - CC_TEST_REPORTER_ID: 8297d060a2a57278046db1ec5bb0e831a5e1c4e3624ad3991492157b60fc8433 + CC_TEST_REPORTER_ID: 0225380e1c351d978d26eb4a05280c6ec029f15e1660a98328d3da8c4ada76a5 with: coverageLocations: cover.out:gocov prefix: github.com/${{ github.repository }} diff --git a/.gitignore b/.gitignore index 9d01f35..5983447 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,7 @@ dist/ .github/release-notes.md # Build -# TODO: Adjust binary file name -go-bootstrap +appuio-cloud-agent *.out # Docs diff --git a/.goreleaser.yml b/.goreleaser.yml index dfba071..06a6b6e 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -22,7 +22,6 @@ snapshot: name_template: "{{ incpatch .Version }}-snapshot" dockers: - # TODO: Adjust image locations - goarch: amd64 use: buildx build_flag_templates: @@ -38,8 +37,6 @@ dockers: - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:v{{ .Version }}-arm64" docker_manifests: - # TODO: Adjust image locations - ## ghcr.io # For prereleases, updating `latest` does not make sense. # Only the image for the exact version should be pushed. diff --git a/Dockerfile b/Dockerfile index 8ee88eb..ee434be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,7 @@ RUN \ ca-certificates \ tzdata -# TODO: Adjust binary file name -ENTRYPOINT ["go-bootstrap"] -COPY go-bootstrap /usr/bin/ +ENTRYPOINT ["appuio-cloud-agent"] +COPY appuio-cloud-agent /usr/bin/ USER 65536:0 diff --git a/Makefile b/Makefile index 26d9285..66dbbc8 100644 --- a/Makefile +++ b/Makefile @@ -11,9 +11,6 @@ MAKEFLAGS += --no-builtin-variables # General variables include Makefile.vars.mk -# Following includes do not print warnings or error if files aren't found -# Optional Documentation module. --include docs/antora-preview.mk docs/antora-build.mk # Optional kind module -include kind/kind.mk diff --git a/Makefile.vars.mk b/Makefile.vars.mk index 0657b77..fc95b1f 100644 --- a/Makefile.vars.mk +++ b/Makefile.vars.mk @@ -1,9 +1,8 @@ ## These are some common variables for Make PROJECT_ROOT_DIR = . -# TODO: Adjust project meta -PROJECT_NAME ?= go-bootstrap -PROJECT_OWNER ?= vshn +PROJECT_NAME ?= appuio-cloud-agent +PROJECT_OWNER ?= appuio ## BUILD:go BIN_FILENAME ?= $(PROJECT_NAME) diff --git a/README.md b/README.md index 2dfaeaf..f606ef7 100644 --- a/README.md +++ b/README.md @@ -1,126 +1,16 @@ -# go-bootstrap +# APPUiO Cloud Agent -[![Build](https://img.shields.io/github/workflow/status/vshn/go-bootstrap/Test)][build] -![Go version](https://img.shields.io/github/go-mod/go-version/vshn/go-bootstrap) -[![Version](https://img.shields.io/github/v/release/vshn/go-bootstrap)][releases] -[![Maintainability](https://img.shields.io/codeclimate/maintainability/vshn/go-bootstrap)][codeclimate] -[![Coverage](https://img.shields.io/codeclimate/coverage/vshn/go-bootstrap)][codeclimate] -[![GitHub downloads](https://img.shields.io/github/downloads/vshn/go-bootstrap/total)][releases] +[![Build](https://img.shields.io/github/workflow/status/appuio/appuio-cloud-agent/Test)][build] +![Go version](https://img.shields.io/github/go-mod/go-version/appuio/appuio-cloud-agent) +[![Version](https://img.shields.io/github/v/release/appuio/appuio-cloud-agent)][releases] +[![Maintainability](https://img.shields.io/codeclimate/maintainability/appuio/appuio-cloud-agent)][codeclimate] +[![Coverage](https://img.shields.io/codeclimate/coverage/appuio/appuio-cloud-agent)][codeclimate] +[![GitHub downloads](https://img.shields.io/github/downloads/appuio/appuio-cloud-agent/total)][releases] -[build]: https://github.com/vshn/go-bootstrap/actions?query=workflow%3ATest -[releases]: https://github.com/vshn/go-bootstrap/releases -[codeclimate]: https://codeclimate.com/github/vshn/go-bootstrap +[build]: https://github.com/appuio/appuio-cloud-agent/actions?query=workflow%3ATest +[releases]: https://github.com/appuio/appuio-cloud-agent/releases +[codeclimate]: https://codeclimate.com/github/appuio/appuio-cloud-agent -Template repository for common Go setups +The APPUiO Cloud Agent is a controller running on every APPUiO Cloud Zone. -## Features -* GitHub Workflows - - Build (Go & Docker image) - - Test (including CodeClimate) - - Lint (Go) - - Release (Goreleaser & Changelog generator) - -* GitHub issue templates - - PR template - - Issue templates using GitHub issue forms - -* Goreleaser - - Go build for `amd64`, `armv8` - - Docker build for `latest` and `vx.y.z` tags - - Push Docker image to GitHub's registry `ghcr.io` - -* Antora documentation - - Build default documentation with VSHN styling - - Publish to GitHub Pages by default (opt-out) - - Automated with GitHub workflows to build in `master` branch and (pre-)releases. - - Available `make` targets are prefixed with `docs-` - -* Local Kubernetes environment - - Setup Kubernetes-In-Docker (kind) - - Prepares a kubeconfig file in `.kind/` - - Optionally install NGINX as ingress controller - - Available `make` targets are prefixed with `kind-` - -* CLI and logging framework - - To help get you started with CLI subcommands, flags and environment variables - - If you don't need subcommands, remove `example_command.go` and adjust `cli.App` settings in `main.go` - -## TODO's after generating from this template - -TIP: You can search for these tasks using `grep -n -r "TODO:" .` - -1. `go.mod`: Adjust module name. -1. `.goreleaser.yml`: Adjust Docker image location in `dockers` and `docker_manifests` parameters. -1. `.gitignore`: Adjust binary file name. -1. `Dockerfile`: Adjust binary file name. -1. `Makefile.vars.mk`: Adjust project meta. -1. `.github/ISSUE_TEMPLATE/config.yml` (optional): Enable forwarding questions to GitHub Discussions or other page. -1. `.github/workflows/test.yml`: Update CodeClimate reporter ID (to be found in codeclimate.com Test coverage settings) -1. `docs/antora.yml`: Adjust project meta. -1. `docs/antora-playbook.yml`: Adjust project meta. -1. `docs/modules/pages/index.adoc`: Edit start page. -1. `docs/modules/nav.adoc`: Edit navigation. -1. `main.go`: Adjust variables. -1. Edit this README (including badges links) -1. Start hacking in `example_command.go`. - -After completing a task, you can remove the comment in the files. - -## Other repository settings - -1. GitHub Settings - - "Options > Wiki" (disable) - - "Options > Allow auto-merge" (enable) - - "Options > Automatically delete head branches" (enable) - - "Collaborators & Teams > Add Teams and users to grant maintainer permissions - - "Branches > Branch protection rules": - - Branch name pattern: `master` - - Require status check to pass before merging: `["lint"]` (you may need to push come commits first) - - "Pages > Source": Branch `gh-pages` - -1. GitHub Issue labels - - "Issues > Labels > New Label" for the following labels with color suggestions: - - `change` (`#D93F0B`) - - `dependency` (`#ededed`) - - `breaking` (`#FBCA04`) - -1. CodeClimate Settings - - "Repo Settings > GitHub > Pull request status updates" (install) - - "Repo Settings > Test coverage > Enforce {Diff,Total} Coverage" (configure to your liking) - -## Antora documentation - -This template comes with an Antora documentation module to help you create Asciidoctor documentation. -By default, it is automatically published to GitHub Pages in `gh-pages` branch, however it can also be included in external Antora playbooks. - -### Setup GitHub Pages - -Once you generated a new repository using this template, the initial commit automatically runs a Job that creates the documentation in the `gh-pages` branch. -All you need to do is then to enable Pages in the settings. - -The `gh-pages` branch is a parent-less commit that only contains the Antora-generated files. - -However, if that's not the case or if you are setting up Antora in an existing repository, here's how you can achieve the same, but make sure to **commit or stash current changes first!** -```bash -current_branch=$(git rev-parse --abbrev-ref HEAD) -initial_commit=$(git rev-list --max-parents=0 HEAD) -git switch --create gh-pages $initial_commit -git rm -r --cached . -git commit -m "Prepare gh-pages branch" -git push --set-upstream origin gh-pages -git switch -f $current_branch -``` - -And you're done! -GitHub automatically recognizes activity and sets up Pages if there's a `gh-pages` branch. - ---- - -If you want to skip deployment to GitHub Pages you need to delete specific files and references: -`rm -f .github/workflows/docs.yml docs/package*.json docs/antora-playbook.yml docs/antora-build.mk`. -Also don't forget to delete the branch and disable Pages in the repository settings. - ---- - -If you want to remove documentation completely simply run `rm -rf docs .github/workflows/docs.yml`. diff --git a/docs/antora-build.mk b/docs/antora-build.mk deleted file mode 100644 index aec8ddc..0000000 --- a/docs/antora-build.mk +++ /dev/null @@ -1,24 +0,0 @@ -docs_out_dir := ./.public - -docker_opts ?= --rm --tty --user "$$(id -u)" - -antora_build_version ?= 2.3.3 -antora_cmd ?= $(DOCKER_CMD) run $(docker_opts) --volume "$${PWD}":/antora docker.io/vshn/antora:$(antora_build_version) -antora_opts ?= --cache-dir=.cache/antora - -.PHONY: docs -docs: docs-html ## All-in-one docs build - -.PHONY: docs-html -docs-html: $(docs_out_dir)/index.html ## Generate HTML version of documentation with Antora, output at ./.public - @touch $(docs_out_dir)/.nojekyll - -$(docs_out_dir)/index.html: - $(antora_cmd) $(antora_opts) docs/antora-playbook.yml - -.PHONY: docs-publish -docs-publish: docs/node_modules docs-html ## Publishes the Antora documentation on Github Pages - npm --prefix ./docs run deploy - -docs/node_modules: - npm --prefix ./docs install diff --git a/docs/antora-playbook.yml b/docs/antora-playbook.yml deleted file mode 100644 index 8c32b7e..0000000 --- a/docs/antora-playbook.yml +++ /dev/null @@ -1,19 +0,0 @@ -site: - # TODO: Adjust project meta - title: Go Bootstrap - start_page: go-bootstrap::index.adoc - url: https://vshn.github.io/go-bootstrap -content: - sources: - - url: ../antora - branches: - - HEAD - - docs/v* - start_path: docs -ui: - bundle: - url: https://github.com/vshn/antora-ui-default/releases/download/2.0.15/ui-bundle.zip - snapshot: true -output: - dir: .public/ - clean: true diff --git a/docs/antora-preview.mk b/docs/antora-preview.mk deleted file mode 100644 index 4ffed70..0000000 --- a/docs/antora-preview.mk +++ /dev/null @@ -1,7 +0,0 @@ - -antora_preview_version ?= 2.3.14 -antora_preview_cmd ?= $(DOCKER_CMD) run --rm --publish 2020:2020 --volume "${PWD}":/preview/antora docker.io/vshn/antora-preview:$(antora_preview_version) --style=vshn - -.PHONY: docs-preview -docs-preview: ## Preview the documentation - $(antora_preview_cmd) diff --git a/docs/antora.yml b/docs/antora.yml deleted file mode 100644 index 1d39f35..0000000 --- a/docs/antora.yml +++ /dev/null @@ -1,7 +0,0 @@ -# TODO: Adjust project meta -name: go-bootstrap -title: Go Bootstrap -version: master -start_page: ROOT:index.adoc -nav: - - modules/ROOT/nav.adoc diff --git a/docs/modules/ROOT/assets/images/.gitkeep b/docs/modules/ROOT/assets/images/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docs/modules/ROOT/examples/.gitkeep b/docs/modules/ROOT/examples/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc deleted file mode 100644 index ee477ec..0000000 --- a/docs/modules/ROOT/nav.adoc +++ /dev/null @@ -1,15 +0,0 @@ -// TODO: Edit navigation -* xref:index.adoc[Introduction] -* https://github.com/vshn/go-bootstrap/releases[Changelog,window=_blank] - -.Tutorials -//* xref:tutorials/example.adoc[Example Tutorial] - -.How To -//* xref:how-tos/example.adoc[Example How-To] - -.Technical reference -//* xref:references/example.adoc[Example Reference] - -.Explanation -//* xref:explanations/example.adoc[Example Explanation] diff --git a/docs/modules/ROOT/pages/examples/.gitkeep b/docs/modules/ROOT/pages/examples/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docs/modules/ROOT/pages/explanations/.gitkeep b/docs/modules/ROOT/pages/explanations/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docs/modules/ROOT/pages/how-tos/.gitkeep b/docs/modules/ROOT/pages/how-tos/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/modules/ROOT/pages/index.adoc deleted file mode 100644 index 6d528e4..0000000 --- a/docs/modules/ROOT/pages/index.adoc +++ /dev/null @@ -1,21 +0,0 @@ -// TODO: Edit start page - -= {page-component-name} - -[discrete] -== Introduction - -Go Bootstrap is a template repository that helps bootstrapping new Go applications quickly with a standardized setup. - -[discrete] -== Documentation - -The documentation is inspired by the https://documentation.divio.com/[Divio's documentation structure]: - -Tutorials:: _Learning-oriented_: Simple lessons to learn about this project. - -How-to guides:: _Problem-oriented_: step-by-step guides to achieve a goal. - -Technical reference:: _Information-oriented_: explaining the inner ongoings. - -Explanation:: _Understanding-oriented_: puts this project in context. diff --git a/docs/modules/ROOT/pages/references/.gitkeep b/docs/modules/ROOT/pages/references/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docs/modules/ROOT/pages/tutorials/.gitkeep b/docs/modules/ROOT/pages/tutorials/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docs/modules/ROOT/partials/.gitkeep b/docs/modules/ROOT/partials/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docs/package-lock.json b/docs/package-lock.json deleted file mode 100644 index 0c87cee..0000000 --- a/docs/package-lock.json +++ /dev/null @@ -1,727 +0,0 @@ -{ - "name": "docs", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "dependencies": { - "gh-pages": "3.2.3" - } - }, - "node_modules/array-union": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", - "dependencies": { - "array-uniq": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/async": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", - "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", - "dependencies": { - "lodash": "^4.17.14" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, - "node_modules/commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=" - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "node_modules/email-addresses": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-3.1.0.tgz", - "integrity": "sha512-k0/r7GrWVL32kZlGwfPNgB2Y/mMXVTq/decgLczm/j34whdaspNrZO8CnXPf1laaHxI6ptUlsnAxN+UAPw+fzg==" - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/filename-reserved-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", - "integrity": "sha1-q/c9+rc10EVECr/qLZHzieu/oik=", - "engines": { - "node": ">=4" - } - }, - "node_modules/filenamify": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-4.3.0.tgz", - "integrity": "sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg==", - "dependencies": { - "filename-reserved-regex": "^2.0.0", - "strip-outer": "^1.0.1", - "trim-repeated": "^1.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-cache-dir": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", - "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", - "dependencies": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/avajs/find-cache-dir?sponsor=1" - } - }, - "node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "node_modules/gh-pages": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-3.2.3.tgz", - "integrity": "sha512-jA1PbapQ1jqzacECfjUaO9gV8uBgU6XNMV0oXLtfCX3haGLe5Atq8BxlrADhbD6/UdG9j6tZLWAkAybndOXTJg==", - "dependencies": { - "async": "^2.6.1", - "commander": "^2.18.0", - "email-addresses": "^3.0.1", - "filenamify": "^4.3.0", - "find-cache-dir": "^3.3.1", - "fs-extra": "^8.1.0", - "globby": "^6.1.0" - }, - "bin": { - "gh-pages": "bin/gh-pages.js", - "gh-pages-clean": "bin/gh-pages-clean.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/globby": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", - "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", - "dependencies": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==" - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "engines": { - "node": ">=6" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dependencies": { - "pinkie": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/strip-outer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", - "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", - "dependencies": { - "escape-string-regexp": "^1.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/trim-repeated": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", - "integrity": "sha1-42RqLqTokTEr9+rObPsFOAvAHCE=", - "dependencies": { - "escape-string-regexp": "^1.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - } - }, - "dependencies": { - "array-union": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", - "requires": { - "array-uniq": "^1.0.1" - } - }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=" - }, - "async": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", - "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", - "requires": { - "lodash": "^4.17.14" - } - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, - "commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=" - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "email-addresses": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-3.1.0.tgz", - "integrity": "sha512-k0/r7GrWVL32kZlGwfPNgB2Y/mMXVTq/decgLczm/j34whdaspNrZO8CnXPf1laaHxI6ptUlsnAxN+UAPw+fzg==" - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" - }, - "filename-reserved-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", - "integrity": "sha1-q/c9+rc10EVECr/qLZHzieu/oik=" - }, - "filenamify": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-4.3.0.tgz", - "integrity": "sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg==", - "requires": { - "filename-reserved-regex": "^2.0.0", - "strip-outer": "^1.0.1", - "trim-repeated": "^1.0.0" - } - }, - "find-cache-dir": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", - "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", - "requires": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - } - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "gh-pages": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-3.2.3.tgz", - "integrity": "sha512-jA1PbapQ1jqzacECfjUaO9gV8uBgU6XNMV0oXLtfCX3haGLe5Atq8BxlrADhbD6/UdG9j6tZLWAkAybndOXTJg==", - "requires": { - "async": "^2.6.1", - "commander": "^2.18.0", - "email-addresses": "^3.0.1", - "filenamify": "^4.3.0", - "find-cache-dir": "^3.3.1", - "fs-extra": "^8.1.0", - "globby": "^6.1.0" - } - }, - "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "globby": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", - "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", - "requires": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==" - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "requires": { - "p-locate": "^4.1.0" - } - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "requires": { - "semver": "^6.0.0" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "requires": { - "pinkie": "^2.0.0" - } - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "requires": { - "find-up": "^4.0.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" - }, - "strip-outer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", - "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", - "requires": { - "escape-string-regexp": "^1.0.2" - } - }, - "trim-repeated": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", - "integrity": "sha1-42RqLqTokTEr9+rObPsFOAvAHCE=", - "requires": { - "escape-string-regexp": "^1.0.2" - } - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - } - } -} diff --git a/docs/package.json b/docs/package.json deleted file mode 100644 index e1be63a..0000000 --- a/docs/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "dependencies": { - "gh-pages": "3.2.3" - }, - "scripts": { - "deploy": "gh-pages -d ../.public --dotfiles -m \"Update documentation rev $(git rev-parse --short HEAD), $(date --utc '+%Y-%m-%d %H:%M')\"" - } -} diff --git a/example_command.go b/example_command.go deleted file mode 100644 index 82e1a7d..0000000 --- a/example_command.go +++ /dev/null @@ -1,67 +0,0 @@ -package main - -import ( - "fmt" - "os" - "sync" - - "github.com/urfave/cli/v2" -) - -type exampleCommand struct { - ExampleFlag string -} - -var exampleCommandName = "example" - -func newExampleCommand() *cli.Command { - command := &exampleCommand{} - // TODO: Start hacking here - return &cli.Command{ - Name: exampleCommandName, - Usage: "Start example command", - Before: command.validate, - Action: command.execute, - Flags: []cli.Flag{ - &cli.StringFlag{Destination: &command.ExampleFlag, Name: "flag", EnvVars: envVars("EXAMPLE_FLAG"), Value: "foo", Usage: "a demonstration how to configure the command", Required: true}, - }, - } -} - -func (c *exampleCommand) validate(context *cli.Context) error { - _ = LogMetadata(context) - log := AppLogger(context).WithName(exampleCommandName) - log.V(1).Info("validating config") - // The `Required` property in the StringFlag above already checks if it's non-empty. - if len(c.ExampleFlag) <= 2 { - return fmt.Errorf("option needs at least 3 characters: %s", "flag") - } - return nil -} - -func (c *exampleCommand) execute(context *cli.Context) error { - log := AppLogger(context).WithName(exampleCommandName) - wg := &sync.WaitGroup{} - wg.Add(1) - go func() { - // Shutdown hook. Can be used to gracefully shutdown listeners or pre-shutdown cleanup. - // Can be removed if not needed. - // Please note that this example is incomplete and doesn't cover all cases when properly implementing shutdowns. - defer wg.Done() - <-context.Done() - err := c.shutdown(context) - if err != nil { - log.Error(err, "cannot properly shut down") - os.Exit(2) - } - }() - log.Info("Hello from example command!", "config", c) - wg.Wait() - return nil -} - -func (c *exampleCommand) shutdown(context *cli.Context) error { - log := AppLogger(context).WithName(exampleCommandName) - log.Info("Shutting down example command") - return nil -} diff --git a/example_command_test.go b/example_command_test.go deleted file mode 100644 index 17b6d59..0000000 --- a/example_command_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package main - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestExampleCommand_Validate(t *testing.T) { - tests := map[string]struct { - givenExampleFlag string - expectedError string - }{ - // TODO: test cases - "GivenEmptyFlag_ThenExpectError": { - expectedError: "option needs at least 3 characters: flag", - }, - "GivenValidConfig_ThenExpectNoError": { - givenExampleFlag: "test", - }, - } - for name, tt := range tests { - t.Run(name, func(t *testing.T) { - // arrange... - command := exampleCommand{ - ExampleFlag: tt.givenExampleFlag, - } - ctx := newAppContext(t) - - // act... - err := command.validate(ctx) - - // assert... - if tt.expectedError != "" { - require.EqualError(t, err, tt.expectedError) - return - } - assert.NoError(t, err) - }) - } -} diff --git a/go.mod b/go.mod index dba1d50..476cef8 100644 --- a/go.mod +++ b/go.mod @@ -1,35 +1,19 @@ -// TODO: Replace module name -module github.com/vshn/go-bootstrap +module github.com/appuio/appuio-cloud-agent -go 1.17 +go 1.18 -require ( - github.com/go-logr/logr v1.2.2 - github.com/go-logr/zapr v1.2.3 - github.com/stretchr/testify v1.7.0 - github.com/urfave/cli/v2 v2.3.0 - go.uber.org/zap v1.21.0 - sigs.k8s.io/kind v0.11.1 -) +require sigs.k8s.io/kind v0.11.1 require ( github.com/BurntSushi/toml v0.3.1 // indirect github.com/alessio/shellescape v1.4.1 // indirect - github.com/benbjohnson/clock v1.1.0 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect github.com/evanphx/json-patch/v5 v5.2.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/mattn/go-isatty v0.0.12 // indirect github.com/pelletier/go-toml v1.8.1 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/russross/blackfriday/v2 v2.0.1 // indirect - github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect github.com/spf13/cobra v1.1.1 // indirect github.com/spf13/pflag v1.0.5 // indirect - go.uber.org/atomic v1.7.0 // indirect - go.uber.org/multierr v1.6.0 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect gopkg.in/yaml.v2 v2.2.8 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect diff --git a/go.sum b/go.sum index aa0b31f..1dca306 100644 --- a/go.sum +++ b/go.sum @@ -26,8 +26,6 @@ github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hC github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= @@ -40,8 +38,6 @@ github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= 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= @@ -54,7 +50,6 @@ github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkg github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v4.9.0+incompatible h1:kLcOMZeuLAJvL2BPWLMIj5oaZQobrkAqrL+WFZwQses= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.2.0 h1:8ozOH5xxoMYDt5/u+yMTsVXydVCbTORFnOOoq2lumco= github.com/evanphx/json-patch/v5 v5.2.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= @@ -69,10 +64,6 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A= -github.com/go-logr/zapr v1.2.3/go.mod h1:eIauM6P8qSvTw5o2ez6UEAfGjQKrxQTl5EoK+Qa2oG4= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= @@ -205,7 +196,6 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -220,11 +210,9 @@ github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7z github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -246,39 +234,22 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= -go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= -go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= -go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -298,7 +269,6 @@ golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -318,7 +288,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -327,7 +296,6 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -348,12 +316,9 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -380,12 +345,8 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= @@ -435,7 +396,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/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/logger.go b/logger.go deleted file mode 100644 index 38ae851..0000000 --- a/logger.go +++ /dev/null @@ -1,77 +0,0 @@ -package main - -import ( - "log" - "os" - "runtime" - "strings" - "sync/atomic" - - "github.com/go-logr/logr" - "github.com/go-logr/zapr" - "github.com/urfave/cli/v2" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" -) - -type loggerContextKey struct{} - -// AppLogger retrieves the application-wide logger instance from the cli.Context. -func AppLogger(c *cli.Context) logr.Logger { - return c.Context.Value(loggerContextKey{}).(*atomic.Value).Load().(logr.Logger) -} - -// LogMetadata prints various metadata to the root logger. -// It prints version, architecture and current user ID and returns nil. -func LogMetadata(c *cli.Context) error { - logger := AppLogger(c) - if !usesProductionLoggingConfig(c) { - logger = logger.WithValues("version", version) - } - logger.WithValues( - "date", date, - "commit", commit, - "go_os", runtime.GOOS, - "go_arch", runtime.GOARCH, - "go_version", runtime.Version(), - "uid", os.Getuid(), - "gid", os.Getgid(), - ).Info("Starting up " + appName) - return nil -} - -func setupLogging(c *cli.Context) error { - logger := newZapLogger(appName, c.Bool("debug"), usesProductionLoggingConfig(c)) - c.Context.Value(loggerContextKey{}).(*atomic.Value).Store(logger) - return nil -} - -func usesProductionLoggingConfig(c *cli.Context) bool { - return strings.EqualFold("JSON", c.String("log-format")) -} - -func newZapLogger(name string, debug bool, useProductionConfig bool) logr.Logger { - cfg := zap.NewDevelopmentConfig() - cfg.EncoderConfig.ConsoleSeparator = " | " - if useProductionConfig { - cfg = zap.NewProductionConfig() - } - if debug { - // Zap's levels get more verbose as the number gets smaller, - // bug logr's level increases with greater numbers. - cfg.Level = zap.NewAtomicLevelAt(zapcore.Level(-2)) // max logger.V(2) - } else { - cfg.Level = zap.NewAtomicLevelAt(zapcore.InfoLevel) - } - z, err := cfg.Build() - zap.ReplaceGlobals(z) - if err != nil { - log.Fatalf("error configuring the logging stack") - } - logger := zapr.NewLogger(z).WithName(name) - if useProductionConfig { - // Append the version to each log so that logging stacks like EFK/Loki can correlate errors with specific versions. - return logger.WithValues("version", version) - } - return logger -} diff --git a/main.go b/main.go index b88560a..e1a7b63 100644 --- a/main.go +++ b/main.go @@ -1,16 +1,7 @@ package main import ( - "context" - "fmt" - "os" - "os/signal" - "sync/atomic" - "syscall" "time" - - "github.com/go-logr/logr" - "github.com/urfave/cli/v2" ) var ( @@ -20,99 +11,13 @@ var ( date = time.Now().Format("2006-01-02") // TODO: Adjust app name - appName = "go-bootstrap" - appLongName = "a generic bootstrapping project" + appName = "appuio-cloud-agent" + appLongName = "agent running on every APPUiO Cloud Zone" // TODO: Adjust or clear env var prefix // envPrefix is the global prefix to use for the keys in environment variables - envPrefix = "BOOTSTRAP" + envPrefix = "APPUIO_CLOUD_AGENT" ) func main() { - ctx, stop, app := newApp() - defer stop() - err := app.RunContext(ctx, os.Args) - // If required flags aren't set, it will return with error before we could set up logging - if err != nil { - _, _ = fmt.Fprintf(os.Stderr, "%v\n", err) - os.Exit(1) - } -} - -func newApp() (context.Context, context.CancelFunc, *cli.App) { - logInstance := &atomic.Value{} - logInstance.Store(logr.Discard()) - app := &cli.App{ - Name: appName, - Usage: appLongName, - Version: fmt.Sprintf("%s, revision=%s, date=%s", version, commit, date), - Compiled: compilationDate(), - - EnableBashCompletion: true, - - Before: setupLogging, - Flags: []cli.Flag{ - &cli.BoolFlag{ - Name: "debug", - Aliases: []string{"verbose", "d"}, - Usage: "sets the log level to debug", - EnvVars: envVars("DEBUG"), - }, - &cli.StringFlag{ - Name: "log-format", - Usage: "sets the log format (values: [json, console])", - EnvVars: envVars("LOG_FORMAT"), - DefaultText: "console", - }, - }, - Commands: []*cli.Command{ - newExampleCommand(), - }, - ExitErrHandler: func(context *cli.Context, err error) { - if err != nil { - AppLogger(context).Error(err, "fatal error") - cli.HandleExitCoder(cli.Exit("", 1)) - } - }, - } - hasSubcommands := len(app.Commands) > 0 - app.Action = rootAction(hasSubcommands) - // There is logr.NewContext(...) which returns a context that carries the logger instance. - // However, since we are configuring and replacing this logger after starting up and parsing the flags, - // we'll store a thread-safe atomic reference. - parentCtx := context.WithValue(context.Background(), loggerContextKey{}, logInstance) - ctx, stop := signal.NotifyContext(parentCtx, syscall.SIGINT, syscall.SIGTERM) - return ctx, stop, app -} - -func rootAction(hasSubcommands bool) func(context *cli.Context) error { - return func(context *cli.Context) error { - if hasSubcommands { - return cli.ShowAppHelp(context) - } - return LogMetadata(context) - } -} - -// env combines envPrefix with given suffix delimited by underscore. -func env(suffix string) string { - return envPrefix + "_" + suffix -} - -// envVars combines envPrefix with each given suffix delimited by underscore. -func envVars(suffixes ...string) []string { - arr := make([]string, len(suffixes)) - for i := range suffixes { - arr[i] = env(suffixes[i]) - } - return arr -} - -func compilationDate() time.Time { - compiled, err := time.Parse(time.RFC3339, date) - if err != nil { - // an empty Time{} causes cli.App to guess it from binary's file timestamp. - return time.Time{} - } - return compiled } diff --git a/main_test.go b/main_test.go deleted file mode 100644 index 2a3c97c..0000000 --- a/main_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package main - -import ( - "context" - "flag" - "sync/atomic" - "testing" - - "github.com/go-logr/zapr" - "github.com/urfave/cli/v2" - "go.uber.org/zap/zaptest" -) - -func newAppContext(t *testing.T) *cli.Context { - logger := zapr.NewLogger(zaptest.NewLogger(t)) - instance := &atomic.Value{} - instance.Store(logger) - return cli.NewContext(&cli.App{}, flag.NewFlagSet("", flag.ContinueOnError), &cli.Context{ - Context: context.WithValue(context.Background(), loggerContextKey{}, instance), - }) -}