Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: use git subtree instead of splitsh/lite #401

Merged
merged 139 commits into from
Apr 22, 2022

Conversation

domharrington
Copy link
Member

🧰 What's being changed?

Improved version of #400 with much better history. Bringing in dotnet via git subtree add and now split.sh is working fully!

🧬 Testing

Does ./bin/split.sh work for you?

erunion and others added 30 commits July 8, 2020 16:55
* feat: migrating the repository over to a monorepo structure

* ci: adding a pull request template

* docs: shuffling the readmes around
* feat: migrating the repository over to a monorepo structure

* ci: adding a pull request template

* docs: shuffling the readmes around

* chore(deps): add bson-objectid

* ✨ initial implementation of generating log ids

* 🚨 prettier

* Switch from documentation-url to log-id for now

* Eh, I like x-readme-log better

* test: adding tests to make sure log ids are uuids

* chore: removing an unused package

* chore: removing an unused package

Co-authored-by: Sean Dokko <[email protected]>
Co-authored-by: gkoberger <[email protected]>
* docs: updating the year on the node pkg license

* feat: pulling over the php sdk from https://github.com/readmeio/metrics-php

* ci: directing the node workflow to only look at the node pkg

* style: suppressing a TaintedInput Psalm warning for now

* ci: pulling psalm taint analysis from ci for now
* fix: issue where the same logs would get sent multiple times

This is caused by us only clearing out the queue when the metrics
response came back

* Prettier

* fix: test coverage

* test: improving the tests for queue flushing

* test: delaying for 1s, not 1ms

* fix: removing an unused test callback that was put in place for mocha

* test: making requests slightly more unique to avoid test date flakiness

Co-authored-by: Dom Harrington <[email protected]>
* chore(deps): swapping r2 for node-fetch as r2 is an inactive project

* feat: changing x-readme-log to x-documentation-url and returning a full url

* test: fixing broken tests

* test: renaming the custom jest assertion to match up with the header name

* feat: implementing the x-documentation-url header in the php sdk

* fix: porting some readme api error handling over to node

* Update packages/node/config/localhost.json

Co-authored-by: Kanad Gupta <[email protected]>

* docs: updating the node package docs a bit to have docs on options

* fix: letting base_log_url be set in the php config

* docs: adding documentation to the sdks on their new options

* test: fixing a broken test

Co-authored-by: Kanad Gupta <[email protected]>
Bumps [eslint](https://github.com/eslint/eslint) from 7.4.0 to 7.5.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](eslint/eslint@v7.4.0...v7.5.0)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [is-valid-uuid-v4](https://github.com/jammymalina/is-valid-uuid-v4) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/jammymalina/is-valid-uuid-v4/releases)
- [Commits](https://github.com/jammymalina/is-valid-uuid-v4/commits)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* fix: add json content-type when posting to metrics API

The Metrics API will 400 when receiving new logs

The content-type header isn't set since we're stringifying JSON via the node-fetch package now.

* test: add nock expectation for content-type header

* feat: add user agent to requests to ReadMe and Metrics APIs
* fix: prevent potentially null baseUrls from being used

* test: fixing a test that was asserting against a false positive
Bumps [nock](https://github.com/nock/nock) from 13.0.2 to 13.0.3.
- [Release notes](https://github.com/nock/nock/releases)
- [Changelog](https://github.com/nock/nock/blob/main/CHANGELOG.md)
- [Commits](nock/nock@v13.0.2...v13.0.3)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [eslint](https://github.com/eslint/eslint) from 7.5.0 to 7.6.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](eslint/eslint@v7.5.0...v7.6.0)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [uuid](https://github.com/uuidjs/uuid) from 8.2.0 to 8.3.0.
- [Release notes](https://github.com/uuidjs/uuid/releases)
- [Changelog](https://github.com/uuidjs/uuid/blob/master/CHANGELOG.md)
- [Commits](uuidjs/uuid@v8.2.0...v8.3.0)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@readme/eslint-config](https://github.com/readmeio/eslint-config) from 3.3.3 to 3.4.0.
- [Release notes](https://github.com/readmeio/eslint-config/releases)
- [Changelog](https://github.com/readmeio/eslint-config/blob/master/CHANGELOG.md)
- [Commits](readmeio/standards@3.3.3...3.4.0)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [jest](https://github.com/facebook/jest) from 26.1.0 to 26.2.2.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](jestjs/jest@v26.1.0...v26.2.2)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@readme/eslint-config](https://github.com/readmeio/eslint-config) from 3.4.0 to 3.4.1.
- [Release notes](https://github.com/readmeio/eslint-config/releases)
- [Changelog](https://github.com/readmeio/eslint-config/blob/master/CHANGELOG.md)
- [Commits](readmeio/standards@3.4.0...3.4.1)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [nock](https://github.com/nock/nock) from 13.0.3 to 13.0.4.
- [Release notes](https://github.com/nock/nock/releases)
- [Changelog](https://github.com/nock/nock/blob/main/CHANGELOG.md)
- [Commits](nock/nock@v13.0.3...v13.0.4)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [jest](https://github.com/facebook/jest) from 26.2.2 to 26.4.0.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](jestjs/jest@v26.2.2...v26.4.0)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.20.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.19...4.17.20)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [eslint](https://github.com/eslint/eslint) from 7.6.0 to 7.7.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](eslint/eslint@v7.6.0...v7.7.0)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* ci: loading in splitsh for help to release sdks to r/o repos

* ci: setting up a split flow for mirroring packages to r/o repos
Bumps [@readme/eslint-config](https://github.com/readmeio/eslint-config) from 3.4.1 to 3.4.2.
- [Release notes](https://github.com/readmeio/eslint-config/releases)
- [Changelog](https://github.com/readmeio/eslint-config/blob/master/CHANGELOG.md)
- [Commits](readmeio/standards@3.4.1...3.4.2)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [jest](https://github.com/facebook/jest) from 26.4.0 to 26.4.2.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](jestjs/jest@v26.4.0...v26.4.2)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [prettier](https://github.com/prettier/prettier) from 2.0.5 to 2.1.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md)
- [Commits](prettier/prettier@2.0.5...2.1.1)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@domharrington domharrington requested a review from erunion April 19, 2022 14:01
@domharrington domharrington force-pushed the feature/use-git-subtree-2 branch from 20a8a0d to 7ace9aa Compare April 19, 2022 14:03
@domharrington domharrington requested a review from Dashron April 19, 2022 14:03
Copy link
Contributor

@Dashron Dashron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it worked for me! sent logs to dom

@erunion
Copy link
Member

erunion commented Apr 20, 2022

i don't understand why it didn't work for me :(

This was quite a bit more involved than I wanted it to be, but hopefully
this will mean we never forget to run it, and it will work consistently.

Tested locally using the following command:

```sh
act -j split-monorepo \
  -s METRICS_SDK_NODE_PRIVATE_KEY="$(<~/.ssh/METRICS_SDK_NODE_PRIVATE_KEY)" \
  -s METRICS_SDK_PHP_PRIVATE_KEY="$(<~/.ssh/METRICS_SDK_PHP_PRIVATE_KEY)" \
  -s METRICS_SDK_PYTHON_PRIVATE_KEY="$(<~/.ssh/METRICS_SDK_PYTHON_PRIVATE_KEY)" \
  -s METRICS_SDK_RUBY_PRIVATE_KEY="$(<~/.ssh/METRICS_SDK_RUBY_PRIVATE_KEY)" \
  -s METRICS_SDK_DOTNET_PRIVATE_KEY="$(<~/.ssh/METRICS_SDK_DOTNET_PRIVATE_KEY)" \
  --container-architecture linux/amd64
```

You'll have to fetch these keys from 1password if you want to run it locally.
The previous implementation just used the first ssh key which failed
so now we're using the `GIT_SSH_COMMAND` feature of git to provide a
specific ssh key on each push.

This is all getting kinda hairy tbh 😬 it seems okay but I can imagine
coming back to this code in 6 months and not knowing what's happening 🤯
@domharrington
Copy link
Member Author

domharrington commented Apr 21, 2022

OK this took a little bit longer than I'd have liked, but I think we have an implementation now that will run on every push to main and mirror out to the other packages. See https://github.com/readmeio/metrics-sdks/pull/401/files#diff-90cb4a4a3e03d39bfd2ebfd39c4395a7b82d692e0f64d3792488abf49a67a23d= and the changes I had to make to ./bin/split to accommodate it: https://github.com/readmeio/metrics-sdks/pull/401/files#diff-033fee464010953664c017c36af05bda209ec9d44a83e6e9255debd2f962387c=

The script should still in theory work on our local machines too, but you shouldnt ever have to run it.

You can test this locally by running the following:

act -j split-monorepo \
  -s METRICS_SDK_NODE_PRIVATE_KEY="$(<~/.ssh/METRICS_SDK_NODE_PRIVATE_KEY)" \
  -s METRICS_SDK_PHP_PRIVATE_KEY="$(<~/.ssh/METRICS_SDK_PHP_PRIVATE_KEY)" \
  -s METRICS_SDK_PYTHON_PRIVATE_KEY="$(<~/.ssh/METRICS_SDK_PYTHON_PRIVATE_KEY)" \
  -s METRICS_SDK_RUBY_PRIVATE_KEY="$(<~/.ssh/METRICS_SDK_RUBY_PRIVATE_KEY)" \
  -s METRICS_SDK_DOTNET_PRIVATE_KEY="$(<~/.ssh/METRICS_SDK_DOTNET_PRIVATE_KEY)" \
  --container-architecture linux/amd64

You'll have to fetch the keys from 1password to do so.

domharrington and others added 2 commits April 21, 2022 13:58
* fix(dotnet): update SDK to point to /v1/request

This is an updated API endpoint, we're deprecating the version-less one.

* chore(dotnet): add TODO for later when we upgrade deps

Fix version of RestSharp to v1.0.6 for the dotnet v6 example app

This was breaking due to a deprecated interface

* docs(dotnet): add some better example values to the test apps

The lack of a `context.Request.Headers["key"];` when requesting the test
server over GET was causing the requests to not be set. Lets just hardcode
this for the example app.
@domharrington
Copy link
Member Author

This was required to get it working: 4f33933

    - name: Checkout repository
      uses: actions/checkout@v3
      with:
        fetch-depth: 0

So that it fetches all git history! Gunna merge this in now and hopefully never have to think about this again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants