diff --git a/.prepushrc.yaml b/.prepushrc.yaml index f0de126b..c9fe86a6 100644 --- a/.prepushrc.yaml +++ b/.prepushrc.yaml @@ -1,10 +1,10 @@ '**/*.{js,jsx,ts,tsx}': - npm run test:web -'archivista/**/*.go': +'subtrees/archivista/**/*.go': - npm run test:archivista -'go-witness/**/*.go': +'subtrees/go-witness/**/*.go': - npm run test:go-witness +'subtrees/witness/**/*.go': + - npm run test:witness 'judge-api/**/*.go': - - npm run test:judge-api -'witness/**/*.go': - - npm run test:witness \ No newline at end of file + - npm run test:judge-api \ No newline at end of file diff --git a/README.subtrees.md b/README.subtrees.md new file mode 100644 index 00000000..f56d90ac --- /dev/null +++ b/README.subtrees.md @@ -0,0 +1,62 @@ +# Subtrees + +This monorepo contains a mix of internal private code and public open source code which we make available to the public. + +The public open source code has been added to the project as [Git Subtrees](https://www.atlassian.com/git/tutorials/git-subtree). + +## List of our subtrees + +- +- `subtrees/archivista` `archivista/` `archivista` +- `subtrees/go-witness` `go-witness/` `go-witness` +- `subtrees/witness` `witness/` `witness` + +## Getting Started + +Assuming you have already gotten started with the root readme.md, then you can do the following: + +1. `npm run remotes:add-all` this is a one time script to add all of our remotes. You'll only need to run it one time initially, and anytime we add more remote subtrees. +1. `npm run remotes:fetch-all` will fetch all the remote subtrees. + +From there you can add more subtrees, update subtree subfolders, and/or update subtree parent repositories. + +## Helper scripts + +Review the scripts in our root `package.json` for helper scripts related to subtrees and remotes. + +## Adding a subtree + +You should add subtrees as remotes for easier management. + +1. `git remote add -f https://github.com/testifysec/some-great-open-source-project.git` with the name of your subtree and the https or ssh link to the git project +1. `git subtree add --prefix main --squash` will create an initial commit for your subtree into the monorepo project. + +## Updating a subtree with upstream changes + +So, some awesome soul decided to help us out and contributed open source changes to one of our subtrees! + +Now what? + +1. `git fetch main` +1. `git subtree pull --prefix main --squash` + +## Contributing internal changes back upstream to the subtree's true git repository + +We can freely commit our fixes to the sub-project in our local working directory now. + +So, you touched a subtree! Great work, we just made our open source project better. + +Now what? + +When it’s time to contribute back to the upstream project, we need to fork the project and add it as another remote: + +1. `git remote add ssh://git@github.com/testifysec/some-great-open-source-project.git` to fork your changes into the subtree's true parent repository +1. `git subtree push --prefix main` + +## Review the Docs + +Please [review the docs](https://gist.github.com/SKempin/b7857a6ff6bddb05717cc17a44091202) on [git subtree](https://www.atlassian.com/git/tutorials/git-subtree). + +## Automate as much as we can, assist your fellow devs + +As we learn and grow, we'll want to master managing these subtrees hygeniecally. Always offer tools and shortcuts for your fellow developers, and if we can, automate as much as we can. diff --git a/dev/Makefile b/dev/Makefile index fa076c54..bdc431da 100644 --- a/dev/Makefile +++ b/dev/Makefile @@ -156,13 +156,13 @@ load-attestations: copy-attestations build-archivistactl build-witness: mkdir -p ./bin - cd ../witness && go build -o bin/witness - mv ../witness/bin/witness ./bin/witness + cd ../subtrees/witness && go build -o bin/witness + mv ../subtrees/witness/bin/witness ./bin/witness build-archivistactl: mkdir -p ./bin - cd ../archivista && go build -o ./bin/archivistactl ./cmd/archivistactl/main.go - mv ../archivista/bin/archivistactl ./bin/archivistactl + cd ../subtrees/archivista && go build -o ./bin/archivistactl ./cmd/archivistactl/main.go + mv ../subtrees/archivista/bin/archivistactl ./bin/archivistactl build-scribe: mkdir -p ./bin diff --git a/dev/judge-platform.code-workspace b/dev/judge-platform.code-workspace index f2f5cd24..20b53b3d 100644 --- a/dev/judge-platform.code-workspace +++ b/dev/judge-platform.code-workspace @@ -16,13 +16,13 @@ "path": "../gitlab-runner" }, { - "path": "../witness" + "path": "../subtrees/witness" }, { - "path": "../go-witness" + "path": "../subtrees/go-witness" }, { - "path": "../archivista" + "path": "../subtrees/archivista" } ], "settings": { diff --git a/dev/skaffold.yaml b/dev/skaffold.yaml index cf0cec77..2bb0c1b9 100644 --- a/dev/skaffold.yaml +++ b/dev/skaffold.yaml @@ -7,7 +7,7 @@ build: useBuildkit: false artifacts: - image: registry.gitlab.com/testifysec/judge-platform/archivista - context: "../archivista" + context: "../subtrees/archivista" ko: dir: "../archivista" main: "../archivista/cmd/archivista" diff --git a/git-conventional-commits.yaml b/git-conventional-commits.yaml index 0e51f230..0bf4c14e 100644 --- a/git-conventional-commits.yaml +++ b/git-conventional-commits.yaml @@ -37,15 +37,10 @@ changelog: docs: Documentation story: Stories breakingChange: BREAKING CHANGES - - ## GitHub - # commitUrl: https://github.com/ACCOUNT/REPOSITORY/commit/%commit% - # commitRangeUrl: https://github.com/ACCOUNT/REPOSITORY/compare/%from%...%to%?diff=split - + ## GitHub - note, subtree commit links will point to monorepo and may not be the commit link we want in the changelog. + commitUrl: https://github.com/testifysec/judge/commit/%commit% + commitRangeUrl: https://github.com/testify/judge/compare/%from%...%to%?diff=split ## GitHub Issues - # issueRegexPattern: "#[0-9]+" - # issueUrl: https://github.com/ACCOUNT/REPOSITORY/issues/%issue% - - ## Jira Issues - # issueRegexPattern: "[A-Z][A-Z0-9]+-[0-9]+" + issueRegexPattern: "#[0-9]+" + issueUrl: https://github.com/testifysec/judge/issues/%issue% # issueUrl: https://WORKSPACE.atlassian.net/browse/%issue%