diff --git a/.github/workflows/_filechange_checker.yml b/.github/workflows/_filechange_checker.yml index 105a1b33d..273868728 100644 --- a/.github/workflows/_filechange_checker.yml +++ b/.github/workflows/_filechange_checker.yml @@ -3,9 +3,12 @@ name: Filechange Checker on: workflow_call: outputs: - fileschanged: + srcfileschanged: description: "'true' if src/** or .github/workflows/** files have changed in the branch" - value: ${{ jobs.file-change-check.outputs.fileschanged }} + value: ${{ jobs.file-change-check.outputs.srcfileschanged }} + docfileschanged: + description: "'true' if docs/** or src/** or .github/workflows/** files have changed in the branch" + value: ${{ jobs.file-change-check.outputs.docfileschanged }} jobs: file-change-check: @@ -14,7 +17,8 @@ jobs: contents: read pull-requests: read outputs: - fileschanged: ${{ steps.checker.outputs.fileschanged }} + srcfileschanged: ${{ steps.srcchecker.outputs.srcfileschanged }} + docfileschanged: ${{ steps.docchecker.outputs.docfileschanged }} steps: - uses: actions/checkout@v3 @@ -27,11 +31,21 @@ jobs: filters: | src: - 'src/**' + docs: + - 'docs/**' actions: - '.github/workflows/**' - - name: Check dorny for changes in specified filepaths - id: checker + + - name: Check dorny for changes in src filepaths + id: srcchecker if: steps.dornycheck.outputs.src == 'true' || steps.dornycheck.outputs.actions == 'true' run: | echo "src or workflow file changes occurred" - echo ::set-output name=fileschanged::true \ No newline at end of file + echo ::set-output name=srcfileschanged::true + + - name: Check dorny for changes in docs related filepaths + id: docchecker + if: steps.dornycheck.outputs.src == 'true' || steps.dornycheck.outputs.docs == 'true' || steps.dornycheck.outputs.actions == 'true' + run: | + echo "docs, src or workflow file changes occurred" + echo ::set-output name=docfileschanged::true \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b88a8d22..f6e13b0ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,19 +1,22 @@ -name: CI Tests +name: Build/Release Corso on: - push: - branches: [main] + workflow_dispatch: # TODO(meain): post-merge: verify manual dispatch pull_request: - branches: [main] + branches: [ main ] + push: + branches: [ main ] + tags: [ 'v*.*.*' ] permissions: # required to retrieve AWS credentials id-token: write contents: write + packages: write pull-requests: read # cancel currently running jobs if a new version of the branch is pushed concurrency: - group: ci-linting-${{ github.workflow }}-${{ github.ref }} + group: ci-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: @@ -21,11 +24,11 @@ jobs: # ---------------------------------------------------------------------------------------------------- # --- Prechecks and Checkouts ------------------------------------------------------------------------ # ---------------------------------------------------------------------------------------------------- - precheck: + Precheck: uses: alcionai/corso/.github/workflows/_filechange_checker.yml@main - checkout: - needs: precheck + Checkout: + needs: [Precheck] environment: Testing runs-on: ubuntu-latest defaults: @@ -33,21 +36,91 @@ jobs: working-directory: src steps: - uses: actions/checkout@v3 - + + # single setup and sum cache handling here. + # the results will cascade onto both testing and linting. - name: Setup Golang with cache - if: needs.precheck.outputs.fileschanged == 'true' uses: ./.github/actions/go-setup-cache + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.docfileschanged == 'true' with: go-version-file: src/go.mod + # ---------------------------------------------------------------------------------------------------- + # --- Generate CLI docs ------------------------------------------------------------------------------ + # ---------------------------------------------------------------------------------------------------- + + Generate-CLI-Docs: + needs: [Precheck, Checkout] + environment: Testing + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.srcfileschanged == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup Golang with cache + uses: magnetikonline/action-golang-cache@v3 + with: + go-version-file: src/go.mod + + # run the markdown generator + - name: Generate Markdown + working-directory: ./src + run: | + go run ./cmd/mdgen/mdgen.go generate + + # migrate generated md files into /docs/docs/cli + - name: Move CLI .md to Docs + run: | + mkdir -p ./docs/docs/cli + mv ./src/cmd/mdgen/cli_markdown/* ./docs/docs/cli/ + rm -R ./src/cmd/mdgen/cli_markdown/ + + - uses: actions/upload-artifact@master + name: Upload cli docs as artifacts + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' + with: + name: cli-docs + path: docs/docs/cli + + # ---------------------------------------------------------------------------------------------------- + # --- Docs Linting ----------------------------------------------------------------------------------- + # ---------------------------------------------------------------------------------------------------- + + Docs-Linting: + needs: [Generate-CLI-Docs] + environment: Testing + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.docfileschanged == 'true' + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies for docs lint + run: | + wget https://github.com/errata-ai/vale/releases/download/v2.20.2/vale_2.20.2_Linux_64-bit.tar.gz # NOTE: update in Dockerfile when updating + mkdir bin && tar -xvzf vale_2.20.2_Linux_64-bit.tar.gz -C bin + echo "$PWD/bin" >> $GITHUB_PATH + npm i -g markdownlint-cli@0.32.2 # NOTE: update in Dockerfile when updating + + - uses: actions/download-artifact@master + name: Download cli docs from build step + with: + name: cli-docs + path: docs/docs/cli + + - name: Run docs lint + run: | + cd docs && make -o genclidocs check + # ---------------------------------------------------------------------------------------------------- # --- Integration and Unit Testing ------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------- Test-Suite: - needs: [precheck, checkout] + needs: [Precheck, Checkout] environment: Testing runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.srcfileschanged == 'true' defaults: run: working-directory: src @@ -55,7 +128,6 @@ jobs: - uses: actions/checkout@v3 - name: Setup Golang with cache - if: needs.precheck.outputs.fileschanged == 'true' uses: magnetikonline/action-golang-cache@v3 with: go-version-file: src/go.mod @@ -64,21 +136,18 @@ jobs: # Install gotestfmt - name: Set up gotestfmt - if: needs.precheck.outputs.fileschanged == 'true' run: go install github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest # AWS creds - name: Configure AWS credentials from Test account - if: needs.precheck.outputs.fileschanged == 'true' uses: aws-actions/configure-aws-credentials@v1 with: - role-to-assume: arn:aws:iam::951767375776:role/corso-testing-role + role-to-assume: ${{ secrets.AWS_IAM_ROLE }} role-session-name: integration-testing aws-region: us-east-1 # run the tests - name: Integration Tests - if: needs.precheck.outputs.fileschanged == 'true' env: CLIENT_ID: ${{ secrets.CLIENT_ID }} CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} @@ -95,11 +164,11 @@ jobs: # Upload the original go test log as an artifact for later review. - name: Upload test log - if: failure() && needs.precheck.outputs.fileschanged == 'true' + if: failure() uses: actions/upload-artifact@v3 with: name: test-log - path: src/testlog/gotest.log + path: testlog/gotest.log if-no-files-found: error retention-days: 14 @@ -108,9 +177,10 @@ jobs: # ---------------------------------------------------------------------------------------------------- Linting: - needs: [precheck, checkout] + needs: [Precheck, Checkout] environment: Testing runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.srcfileschanged == 'true' defaults: run: working-directory: src @@ -118,13 +188,11 @@ jobs: - uses: actions/checkout@v3 - name: Setup Golang with cache - if: needs.precheck.outputs.fileschanged == 'true' uses: magnetikonline/action-golang-cache@v3 with: go-version-file: src/go.mod - name: Go Lint - if: needs.precheck.outputs.fileschanged == 'true' uses: golangci/golangci-lint-action@v3 with: version: v1.45.2 @@ -133,9 +201,163 @@ jobs: # check licenses - name: Get go-licenses - if: needs.precheck.outputs.fileschanged == 'true' run: go install github.com/google/go-licenses@latest - name: Run go-licenses - if: needs.precheck.outputs.fileschanged == 'true' - run: go-licenses check github.com/alcionai/corso/src --ignore github.com/alcionai/corso/src \ No newline at end of file + run: go-licenses check github.com/alcionai/corso/src --ignore github.com/alcionai/corso/src + + # ---------------------------------------------------------------------------------------------------- + # --- Publish steps ---------------------------------------------------------------------------------- + # ---------------------------------------------------------------------------------------------------- + + SetEnv: + environment: Testing + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + outputs: + environment: ${{ steps.set-env.outputs.environment }} + steps: + - name: Figure out environment + id: set-env + run: | + if ${{ startsWith(github.ref, 'refs/tags/') }}; then + echo "set-output name=environment::Production" + echo "::set-output name=environment::Production" + else + echo "set-output name=environment::Testing" + echo "::set-output name=environment::Testing" + fi + + + Publish-Binary: + needs: [Test-Suite, Linting, Docs-Linting, SetEnv] + environment: ${{ needs.SetEnv.outputs.environment }} + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' + defaults: + run: + working-directory: src + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # needed to pull changelog + + - name: Setup Golang with cache + uses: magnetikonline/action-golang-cache@v3 + with: + go-version-file: src/go.mod + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v3 # TODO(meain): make sure release builds work + with: + version: latest + args: release --rm-dist --timeout 500m + workdir: src + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload assets + uses: actions/upload-artifact@v3 + with: + name: corso + path: src/dist/* + + Publish-Docs: + needs: [Test-Suite, Linting, Docs-Linting, SetEnv] + environment: ${{ needs.SetEnv.outputs.environment }} + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' + defaults: + run: + working-directory: docs + + steps: + - uses: actions/checkout@v3 + + - uses: actions/download-artifact@master + name: Download cli docs from build step + with: + name: cli-docs + path: docs/docs/cli + + - name: Configure AWS credentials from Test account + uses: aws-actions/configure-aws-credentials@v1 + with: + role-to-assume: ${{ secrets.AWS_IAM_ROLE }} + role-session-name: integration-testing + aws-region: us-east-1 + + - name: Build docs + run: | + npm ci + CORSO_DOCS_BASEURL="/preview/" npm run build # TODO: update base url once finalized + + # TODO(meain): post-merge: validate push to prod env + - name: Push docs + run: | + echo "$DOCS_BUCKET" | base64 + aws s3 sync build "s3://${{ secrets.DOCS_S3_BUCKET }}/preview" + + - name: Invalidate cloudfront + run: | + aws cloudfront create-invalidation --distribution-id ${{ secrets.DOCS_CF_DISTRIBUTION }} --paths "/*" + + Publish-Image: + needs: [Test-Suite, Linting, Docs-Linting, SetEnv] + environment: ${{ needs.SetEnv.outputs.environment }} + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' + defaults: + run: + working-directory: build + env: + imageName: ghcr.io/alcionai/corso + PLATFORMS: linux/amd64,linux/arm64 + steps: + - uses: actions/checkout@v3 + + - name: Build Corso Binaries + run: > + ./build.sh + --platforms ${{ env.PLATFORMS }} + + # apparently everyone uses this step + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + # setup Docker build action + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + + # retrieve credentials for ghcr.io + - name: Login to Github Packages + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.imageName }} # TODO(meain): post-merge: validate push with tag + tags: | + type=ref,event=tag + type=sha,format=short,prefix= + + # deploy the image + - name: Build image and push to GitHub Container Registry + uses: docker/build-push-action@v3 + with: + context: . + file: ./build/Dockerfile + platforms: ${{ env.PLATFORMS }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + # use the github cache + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/.github/workflows/docgen.yml b/.github/workflows/docgen.yml deleted file mode 100644 index 34d98827d..000000000 --- a/.github/workflows/docgen.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Document Generation -on: - push: - branches: [main] - -permissions: - contents: write - pull-requests: write - deployments: write - -jobs: - precheck: - uses: alcionai/corso/.github/workflows/_filechange_checker.yml@main - - Generate-Markdown: - needs: precheck - if: needs.precheck.outputs.fileschanged == 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.ref }} - - - name: Setup Golang with cache - uses: magnetikonline/action-golang-cache@v3 - with: - go-version-file: src/go.mod - - # run the markdown generator - - name: Generate Markdown - working-directory: ./src - run: | - go run ./cmd/mdgen/mdgen.go generate - - # migrate generated md files into /docs/docs/cli - - name: Move CLI .md to Docs - run: | - mkdir -p ./docs/docs/cli - mv ./src/cmd/mdgen/cli_markdown/* ./docs/docs/cli/ - rm -R ./src/cmd/mdgen/cli_markdown/ - - # make a PR for the docs_autogen branch - - name: Make a PR For the `docs_autogen` Branch - uses: peter-evans/create-pull-request@v4 - with: - commit-message: "Documentation Auto-Generation" - branch: docs_autogen - delete-branch: true - base: main - title: "Docs Auto-Generation" - - # make sure it gets approved - - name: Auto approve - if: steps.cpr.outputs.pull-request-operation == 'created' - uses: juliangruber/approve-pull-request-action@v1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - number: ${{ steps.cpr.outputs.pull-request-number }} \ No newline at end of file diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml deleted file mode 100644 index 75da2b598..000000000 --- a/.github/workflows/image.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Publish Docker Container Images -on: - push: - branches: [main] - -permissions: - contents: read - packages: write - pull-requests: read - -jobs: - precheck: - uses: alcionai/corso/.github/workflows/_filechange_checker.yml@main - - Per-SHA-Image: - needs: precheck - if: needs.precheck.outputs.fileschanged == 'true' - runs-on: ubuntu-latest - defaults: - run: - working-directory: build - env: - PLATFORMS: linux/amd64,linux/arm64 - steps: - - uses: actions/checkout@v3 - - - name: Build Corso Binaries - run: > - ./build.sh - --platforms ${{ env.PLATFORMS }} - - # - name: Build Corso Binaries Locally - # run: > - # ./multiplatform-binary.sh - # --platforms ${{ env.PLATFORMS }} - - # apparently everyone uses this step - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - # setup Docker buld action - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v2 - - # retrieve credentials for ghcr.io - - name: Login to Github Packages - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - id: hash - run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" - - # deploy the image - - name: Build image and push to GitHub Container Registry - env: - imageName: ghcr.io/alcionai/corso - uses: docker/build-push-action@v3 - with: - context: . - file: ./build/Dockerfile - platforms: ${{ env.PLATFORMS }} - push: true - tags: ${{ env.imageName }}:latest,${{ env.imageName }}:${{ steps.hash.outputs.sha_short }} - # use the github cache - cache-from: type=gha - cache-to: type=gha,mode=max - - # check the image digest - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/load_test.yml b/.github/workflows/load_test.yml index 6adc6f56a..750f20c0e 100644 --- a/.github/workflows/load_test.yml +++ b/.github/workflows/load_test.yml @@ -41,7 +41,7 @@ jobs: - name: Configure AWS credentials from Test account uses: aws-actions/configure-aws-credentials@v1 with: - role-to-assume: arn:aws:iam::951767375776:role/corso-testing-role + role-to-assume: ${{ secrets.AWS_IAM_ROLE }} role-session-name: integration-testing aws-region: us-east-1 diff --git a/.github/workflows/weekly_cleanup.yml b/.github/workflows/weekly_cleanup.yml index f5bbec599..69d9c9bbd 100644 --- a/.github/workflows/weekly_cleanup.yml +++ b/.github/workflows/weekly_cleanup.yml @@ -11,15 +11,16 @@ permissions: jobs: S3-Test-Cleanup: runs-on: ubuntu-latest + environment: Testing steps: - name: Configure AWS credentials from Test account uses: aws-actions/configure-aws-credentials@v1 with: - role-to-assume: arn:aws:iam::951767375776:role/corso-testing-role + role-to-assume: ${{ secrets.AWS_IAM_ROLE }} role-session-name: integration-testing aws-region: us-east-1 - name: Delete all files in the test bucket run: | - aws s3 rm s3://test-corso-repo-init --recursive \ No newline at end of file + aws s3 rm s3://${{ secrets.CI_TESTS_S3_BUCKET }} --recursive \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..3ac58d9db --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +[Unreleased]: https://github.com/https://github.com/alcionai/corso/compare/...HEAD + diff --git a/docs/.gitignore b/docs/.gitignore index 2f63f3bbc..c00d425e3 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -5,6 +5,7 @@ /build # Generated files +docs/cli .docusaurus .cache-loader .vscode diff --git a/docs/Dockerfile b/docs/Dockerfile index 942bdb3ca..f66ed4b9d 100644 --- a/docs/Dockerfile +++ b/docs/Dockerfile @@ -9,13 +9,13 @@ RUN apt-get -y update && apt-get -y install gpg emacs curl git make \ && apt-get autoclean \ && node --version \ && npm --version \ - && cd /tmp && curl -O -L https://github.com/errata-ai/vale/releases/download/v2.20.1/vale_2.20.1_Linux_64-bit.tar.gz \ - && tar -xvzf vale_2.20.1_Linux_64-bit.tar.gz -C /usr/bin vale + && cd /tmp && curl -O -L https://github.com/errata-ai/vale/releases/download/v2.20.1/vale_2.20.1_Linux_64-bit.tar.gz \ # NOTE: update in CI when updating + && tar -xvzf vale_2.20.1_Linux_64-bit.tar.gz -C /usr/bin vale \ + && npm install -g markdownlint-cli@0.32.2 # NOTE: update in CI when updating WORKDIR /usr/src COPY package.json package-lock.json* ./ RUN npm ci \ - && npm install -g markdownlint-cli \ && npm cache clean --force \ && rm -f package.json package-lock.json* ENV PATH /usr/src/node_modules/.bin:$PATH diff --git a/docs/docs/cli/corso_backup_create_exchange.md b/docs/docs/cli/corso_backup_create_exchange.md deleted file mode 100644 index a438a63bf..000000000 --- a/docs/docs/cli/corso_backup_create_exchange.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: corso backup create exchange -hide_title: true ---- -## corso backup create exchange - -Backup M365 Exchange service data - -```bash -corso backup create exchange --user | '*' [flags] -``` - -### Examples - -```bash -# Backup all Exchange data for Alice -corso backup create exchange --user alice@example.com - -# Backup only Exchange contacts for Alice and Bob -corso backup create exchange --user alice@example.com,bob@example.com --data contacts - -# Backup all Exchange data for all M365 users -corso backup create exchange --user '*' -``` - -### Flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--user`||``|Backup Exchange data by user ID; accepts '*' to select all users| -|`--data`||``|Select one or more types of data to backup: email, contacts, or events| -|`--help`|`-h`|`false`|help for exchange| - -### Global and inherited flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--config-file`||`$HOME/.corso.toml`|config file location (default is $HOME/.corso.toml)| -|`--json`||`false`|output data in JSON format| -|`--log-level`||`info`|set the log level to debug|info|warn|error| -|`--no-stats`||`false`|disable anonymous usage statistics gathering| diff --git a/docs/docs/cli/corso_backup_create_onedrive.md b/docs/docs/cli/corso_backup_create_onedrive.md deleted file mode 100644 index 6cc419550..000000000 --- a/docs/docs/cli/corso_backup_create_onedrive.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: corso backup create onedrive -hide_title: true ---- -## corso backup create onedrive - -Backup M365 OneDrive service data - -```bash -corso backup create onedrive --user | '*' [flags] -``` - -### Examples - -```bash -# Backup OneDrive data for Alice -corso backup create onedrive --user alice@example.com - -# Backup OneDrive for Alice and Bob -corso backup create onedrive --user alice@example.com,bob@example.com - -# Backup all OneDrive data for all M365 users -corso backup create onedrive --user '*' -``` - -### Flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--user`||``|Backup OneDrive data by user ID; accepts '*' to select all users.
Required
| -|`--help`|`-h`|`false`|help for onedrive| - -### Global and inherited flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--config-file`||`$HOME/.corso.toml`|config file location (default is $HOME/.corso.toml)| -|`--json`||`false`|output data in JSON format| -|`--log-level`||`info`|set the log level to debug|info|warn|error| -|`--no-stats`||`false`|disable anonymous usage statistics gathering| diff --git a/docs/docs/cli/corso_backup_delete_exchange.md b/docs/docs/cli/corso_backup_delete_exchange.md deleted file mode 100644 index 10a76582f..000000000 --- a/docs/docs/cli/corso_backup_delete_exchange.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: corso backup delete exchange -hide_title: true ---- -## corso backup delete exchange - -Delete backed-up M365 Exchange service data - -```bash -corso backup delete exchange --backup [flags] -``` - -### Examples - -```bash -# Delete Exchange backup with ID 1234abcd-12ab-cd34-56de-1234abcd -corso backup delete exchange --backup 1234abcd-12ab-cd34-56de-1234abcd -``` - -### Flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--backup`|||ID of the backup to delete.
Required
| -|`--help`|`-h`|`false`|help for exchange| - -### Global and inherited flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--config-file`||`$HOME/.corso.toml`|config file location (default is $HOME/.corso.toml)| -|`--json`||`false`|output data in JSON format| -|`--log-level`||`info`|set the log level to debug|info|warn|error| -|`--no-stats`||`false`|disable anonymous usage statistics gathering| diff --git a/docs/docs/cli/corso_backup_delete_onedrive.md b/docs/docs/cli/corso_backup_delete_onedrive.md deleted file mode 100644 index 411f68b1e..000000000 --- a/docs/docs/cli/corso_backup_delete_onedrive.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: corso backup delete onedrive -hide_title: true ---- -## corso backup delete onedrive - -Delete backed-up M365 OneDrive service data - -```bash -corso backup delete onedrive --backup [flags] -``` - -### Examples - -```bash -# Delete OneDrive backup with ID 1234abcd-12ab-cd34-56de-1234abcd -corso backup delete onedrive --backup 1234abcd-12ab-cd34-56de-1234abcd -``` - -### Flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--backup`|||ID of the backup to delete.
Required
| -|`--help`|`-h`|`false`|help for onedrive| - -### Global and inherited flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--config-file`||`$HOME/.corso.toml`|config file location (default is $HOME/.corso.toml)| -|`--json`||`false`|output data in JSON format| -|`--log-level`||`info`|set the log level to debug|info|warn|error| -|`--no-stats`||`false`|disable anonymous usage statistics gathering| diff --git a/docs/docs/cli/corso_backup_details_exchange.md b/docs/docs/cli/corso_backup_details_exchange.md deleted file mode 100644 index d0ceff1e4..000000000 --- a/docs/docs/cli/corso_backup_details_exchange.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: corso backup details exchange -hide_title: true ---- -## corso backup details exchange - -Shows the details of a M365 Exchange service backup - -```bash -corso backup details exchange --backup [flags] -``` - -### Examples - -```bash -# Explore Alice's items in backup 1234abcd-12ab-cd34-56de-1234abcd -corso backup details exchange --backup 1234abcd-12ab-cd34-56de-1234abcd --user alice@example.com - -# Explore Alice's emails with subject containing "Hello world" in folder "Inbox" from a specific backup -corso backup details exchange --backup 1234abcd-12ab-cd34-56de-1234abcd \ - --user alice@example.com --email-subject "Hello world" --email-folder Inbox - -# Explore Bobs's events occurring after start of 2022 from a specific backup -corso backup details exchange --backup 1234abcd-12ab-cd34-56de-1234abcd \ - --user bob@example.com --event-starts-after 2022-01-01T00:00:00 - -# Explore Alice's contacts with name containing Andy from a specific backup -corso backup details exchange --backup 1234abcd-12ab-cd34-56de-1234abcd \ - --user alice@example.com --contact-name Andy -``` - -### Flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--backup`|||ID of the backup to explore.
Required
| -|`--user`||``|Select backup details by user ID; accepts '*' to select all users.| -|`--email`||``|Select backup details for emails by email ID; accepts '*' to select all emails.| -|`--email-folder`||``|Select backup details for emails within a folder; accepts '*' to select all email folders.| -|`--email-subject`|||Select backup details for emails with a subject containing this value.| -|`--email-sender`|||Select backup details for emails from a specific sender.| -|`--email-received-after`|||Select backup details for emails received after this datetime.| -|`--email-received-before`|||Select backup details for emails received before this datetime.| -|`--event`||``|Select backup details for events by event ID; accepts '*' to select all events.| -|`--event-calendar`||``|Select backup details for events under a calendar; accepts '*' to select all events.| -|`--event-subject`|||Select backup details for events with a subject containing this value.| -|`--event-organizer`|||Select backup details for events from a specific organizer.| -|`--event-recurs`|||Select backup details for recurring events. Use `--event-recurs false` to select non-recurring events.| -|`--event-starts-after`|||Select backup details for events starting after this datetime.| -|`--event-starts-before`|||Select backup details for events starting before this datetime.| -|`--contact`||``|Select backup details for contacts by contact ID; accepts '*' to select all contacts.| -|`--contact-folder`||``|Select backup details for contacts within a folder; accepts '*' to select all contact folders.| -|`--contact-name`|||Select backup details for contacts whose contact name contains this value.| -|`--help`|`-h`|`false`|help for exchange| - -### Global and inherited flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--config-file`||`$HOME/.corso.toml`|config file location (default is $HOME/.corso.toml)| -|`--json`||`false`|output data in JSON format| -|`--log-level`||`info`|set the log level to debug|info|warn|error| -|`--no-stats`||`false`|disable anonymous usage statistics gathering| diff --git a/docs/docs/cli/corso_backup_details_onedrive.md b/docs/docs/cli/corso_backup_details_onedrive.md deleted file mode 100644 index c31bab9f7..000000000 --- a/docs/docs/cli/corso_backup_details_onedrive.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: corso backup details onedrive -hide_title: true ---- -## corso backup details onedrive - -Shows the details of a M365 OneDrive service backup - -```bash -corso backup details onedrive --backup [flags] -``` - -### Examples - -```bash -# Explore Alice's files from backup 1234abcd-12ab-cd34-56de-1234abcd -corso backup details onedrive --backup 1234abcd-12ab-cd34-56de-1234abcd --user alice@example.com - -# Explore Alice or Bob's files with name containing "Fiscal 22" in folder "Reports" -corso backup details onedrive --backup 1234abcd-12ab-cd34-56de-1234abcd \ - --user alice@example.com,bob@example.com --file-name "Fiscal 22" --folder "Reports" - -# Explore Alice's files created before end of 2015 from a specific backup -corso backup details onedrive --backup 1234abcd-12ab-cd34-56de-1234abcd \ - --user alice@example.com --file-created-before 2015-01-01T00:00:00 -``` - -### Flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--backup`|||ID of the backup to explore.
Required
| -|`--folder`||``|Select backup details by OneDrive folder; defaults to root.| -|`--file`||``|Select backup details by file name or ID.| -|`--file-created-after`|||Select backup details for files created after this datetime.| -|`--file-created-before`|||Select backup details for files created before this datetime.| -|`--file-modified-after`|||Select backup details for files modified after this datetime.| -|`--file-modified-before`|||Select backup details for files modified before this datetime.| -|`--help`|`-h`|`false`|help for onedrive| - -### Global and inherited flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--config-file`||`$HOME/.corso.toml`|config file location (default is $HOME/.corso.toml)| -|`--json`||`false`|output data in JSON format| -|`--log-level`||`info`|set the log level to debug|info|warn|error| -|`--no-stats`||`false`|disable anonymous usage statistics gathering| diff --git a/docs/docs/cli/corso_backup_list_exchange.md b/docs/docs/cli/corso_backup_list_exchange.md deleted file mode 100644 index 797f56275..000000000 --- a/docs/docs/cli/corso_backup_list_exchange.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: corso backup list exchange -hide_title: true ---- -## corso backup list exchange - -List the history of M365 Exchange service backups - -```bash -corso backup list exchange [flags] -``` - - -### Flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--help`|`-h`|`false`|help for exchange| - -### Global and inherited flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--config-file`||`$HOME/.corso.toml`|config file location (default is $HOME/.corso.toml)| -|`--json`||`false`|output data in JSON format| -|`--log-level`||`info`|set the log level to debug|info|warn|error| -|`--no-stats`||`false`|disable anonymous usage statistics gathering| diff --git a/docs/docs/cli/corso_backup_list_onedrive.md b/docs/docs/cli/corso_backup_list_onedrive.md deleted file mode 100644 index 75b62daf6..000000000 --- a/docs/docs/cli/corso_backup_list_onedrive.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: corso backup list onedrive -hide_title: true ---- -## corso backup list onedrive - -List the history of M365 OneDrive service backups - -```bash -corso backup list onedrive [flags] -``` - - -### Flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--help`|`-h`|`false`|help for onedrive| - -### Global and inherited flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--config-file`||`$HOME/.corso.toml`|config file location (default is $HOME/.corso.toml)| -|`--json`||`false`|output data in JSON format| -|`--log-level`||`info`|set the log level to debug|info|warn|error| -|`--no-stats`||`false`|disable anonymous usage statistics gathering| diff --git a/docs/docs/cli/corso_env.md b/docs/docs/cli/corso_env.md deleted file mode 100644 index 4674571eb..000000000 --- a/docs/docs/cli/corso_env.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: corso env -hide_title: true ---- -## corso env - -A guide to using environment variables in Corso. - -```bash -corso env [flags] -``` - - -### Flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--help`|`-h`|`false`|help for env| - -### Global and inherited flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--config-file`||`$HOME/.corso.toml`|config file location (default is $HOME/.corso.toml)| -|`--json`||`false`|output data in JSON format| -|`--log-level`||`info`|set the log level to debug|info|warn|error| -|`--no-stats`||`false`|disable anonymous usage statistics gathering| diff --git a/docs/docs/cli/corso_repo_connect_s3.md b/docs/docs/cli/corso_repo_connect_s3.md deleted file mode 100644 index 1acd4c9b4..000000000 --- a/docs/docs/cli/corso_repo_connect_s3.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: corso repo connect s3 -hide_title: true ---- -## corso repo connect s3 - -Ensures a connection to an existing S3 repository. - -```bash -corso repo connect s3 --bucket [flags] -``` - -### Examples - -```bash -# Connect to a Corso repo in AWS S3 bucket named "my-bucket" -corso repo connect s3 --bucket my-bucket - -# Connect to a Corso repo in AWS S3 bucket named "my-bucket" using a prefix -corso repo connect s3 --bucket my-bucket --prefix my-prefix - -# Connect to a Corso repo in an S3 compliant storage provider -corso repo connect s3 --bucket my-bucket --endpoint https://my-s3-server-endpoint -``` - -### Flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--bucket`|||Name of S3 bucket for repo.
Required
| -|`--prefix`|||Repo prefix within bucket.| -|`--endpoint`||`s3.amazonaws.com`|S3 service endpoint.| -|`--help`|`-h`|`false`|help for s3| - -### Global and inherited flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--config-file`||`$HOME/.corso.toml`|config file location (default is $HOME/.corso.toml)| -|`--json`||`false`|output data in JSON format| -|`--log-level`||`info`|set the log level to debug|info|warn|error| -|`--no-stats`||`false`|disable anonymous usage statistics gathering| diff --git a/docs/docs/cli/corso_repo_init_s3.md b/docs/docs/cli/corso_repo_init_s3.md deleted file mode 100644 index 7d2e244f1..000000000 --- a/docs/docs/cli/corso_repo_init_s3.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: corso repo init s3 -hide_title: true ---- -## corso repo init s3 - -Bootstraps a new S3 repository and connects it to your m356 account. - -```bash -corso repo init s3 --bucket [flags] -``` - -### Examples - -```bash -# Create a new Corso repo in AWS S3 bucket named "my-bucket" -corso repo init s3 --bucket my-bucket - -# Create a new Corso repo in AWS S3 bucket named "my-bucket" using a prefix -corso repo init s3 --bucket my-bucket --prefix my-prefix - -# Create a new Corso repo in an S3 compliant storage provider -corso repo init s3 --bucket my-bucket --endpoint https://my-s3-server-endpoint -``` - -### Flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--bucket`|||Name of S3 bucket for repo.
Required
| -|`--prefix`|||Repo prefix within bucket.| -|`--endpoint`||`s3.amazonaws.com`|S3 service endpoint.| -|`--help`|`-h`|`false`|help for s3| - -### Global and inherited flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--config-file`||`$HOME/.corso.toml`|config file location (default is $HOME/.corso.toml)| -|`--json`||`false`|output data in JSON format| -|`--log-level`||`info`|set the log level to debug|info|warn|error| -|`--no-stats`||`false`|disable anonymous usage statistics gathering| diff --git a/docs/docs/cli/corso_restore_exchange.md b/docs/docs/cli/corso_restore_exchange.md deleted file mode 100644 index 6ea0ce454..000000000 --- a/docs/docs/cli/corso_restore_exchange.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: corso restore exchange -hide_title: true ---- -## corso restore exchange - -Restore M365 Exchange service data - -```bash -corso restore exchange --backup [flags] -``` - -### Examples - -```bash -# Restore emails with ID 98765abcdef and 12345abcdef from a specific backup -corso restore exchange --backup 1234abcd-12ab-cd34-56de-1234abcd --email 98765abcdef,12345abcdef - -# Restore Alice's emails with subject containing "Hello world" in "Inbox" from a specific backup -corso restore exchange --backup 1234abcd-12ab-cd34-56de-1234abcd \ - --user alice@example.com --email-subject "Hello world" --email-folder Inbox - -# Restore Bobs's entire calendar from a specific backup -corso restore exchange --backup 1234abcd-12ab-cd34-56de-1234abcd \ - --user bob@example.com --event-calendar Calendar - -# Restore contact with ID abdef0101 from a specific backup -corso restore exchange --backup 1234abcd-12ab-cd34-56de-1234abcd --contact abdef0101 -``` - -### Flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--backup`|||ID of the backup to restore.
Required
| -|`--user`||``|Restore data by user ID; accepts '*' to select all users.| -|`--email`||``|Restore emails by ID; accepts '*' to select all emails.| -|`--email-folder`||``|Restore emails within a folder; accepts '*' to select all email folders.| -|`--email-subject`|||Restore emails with a subject containing this value.| -|`--email-sender`|||Restore emails from a specific sender.| -|`--email-received-after`|||Restore emails received after this datetime.| -|`--email-received-before`|||Restore emails received before this datetime.| -|`--event`||``|Restore events by event ID; accepts '*' to select all events.| -|`--event-calendar`||``|Restore events under a calendar; accepts '*' to select all event calendars.| -|`--event-subject`|||Restore events with a subject containing this value.| -|`--event-organizer`|||Restore events from a specific organizer.| -|`--event-recurs`|||Restore recurring events. Use `--event-recurs false` to restore non-recurring events.| -|`--event-starts-after`|||Restore events starting after this datetime.| -|`--event-starts-before`|||Restore events starting before this datetime.| -|`--contact`||``|Restore contacts by contact ID; accepts '*' to select all contacts.| -|`--contact-folder`||``|Restore contacts within a folder; accepts '*' to select all contact folders.| -|`--contact-name`|||Restore contacts whose contact name contains this value.| -|`--help`|`-h`|`false`|help for exchange| - -### Global and inherited flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--config-file`||`$HOME/.corso.toml`|config file location (default is $HOME/.corso.toml)| -|`--json`||`false`|output data in JSON format| -|`--log-level`||`info`|set the log level to debug|info|warn|error| -|`--no-stats`||`false`|disable anonymous usage statistics gathering| diff --git a/docs/docs/cli/corso_restore_onedrive.md b/docs/docs/cli/corso_restore_onedrive.md deleted file mode 100644 index 30de482d8..000000000 --- a/docs/docs/cli/corso_restore_onedrive.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: corso restore onedrive -hide_title: true ---- -## corso restore onedrive - -Restore M365 OneDrive service data - -```bash -corso restore onedrive --backup [flags] -``` - -### Examples - -```bash -# Restore file with ID 98765abcdef -corso restore onedrive --backup 1234abcd-12ab-cd34-56de-1234abcd --file 98765abcdef - -# Restore Alice's file named "FY2021 Planning.xlsx in "Documents/Finance Reports" from a specific backup -corso restore onedrive --backup 1234abcd-12ab-cd34-56de-1234abcd \ - --user alice@example.com --file "FY2021 Planning.xlsx" --folder "Documents/Finance Reports" - -# Restore all files from Bob's folder that were created before 2020 when captured in a specific backup -corso restore onedrive --backup 1234abcd-12ab-cd34-56de-1234abcd - --user bob@example.com --folder "Documents/Finance Reports" --file-created-before 2020-01-01T00:00:00 -``` - -### Flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--backup`|||ID of the backup to restore.
Required
| -|`--user`||``|Restore data by user ID; accepts '*' to select all users.| -|`--folder`||``|Restore items by OneDrive folder; defaults to root| -|`--file`||``|Restore items by file name or ID| -|`--file-created-after`|||Restore files created after this datetime| -|`--file-created-before`|||Restore files created before this datetime| -|`--file-modified-after`|||Restore files modified after this datetime| -|`--file-modified-before`|||Restore files modified before this datetime| -|`--help`|`-h`|`false`|help for onedrive| - -### Global and inherited flags - -|Flag|Short|Default|Help| -|:----|:-----|:-------|:----| -|`--config-file`||`$HOME/.corso.toml`|config file location (default is $HOME/.corso.toml)| -|`--json`||`false`|output data in JSON format| -|`--log-level`||`info`|set the log level to debug|info|warn|error| -|`--no-stats`||`false`|disable anonymous usage statistics gathering| diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 8a827d340..cf930f63b 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -9,7 +9,7 @@ const config = { title: 'Corso Documentation', tagline: 'Free, Secure, and Open-Source Backup for Microsoft 365', url: 'https://corsobackup.io', - baseUrl: '/', + baseUrl: process.env.CORSO_DOCS_BASEURL || '/', onBrokenLinks: 'throw', onBrokenMarkdownLinks: 'throw', favicon: 'img/corso_logo.svg', diff --git a/docs/styles/Vocab/Base/accept.txt b/docs/styles/Vocab/Base/accept.txt index ebc30b679..ac3eb9079 100644 --- a/docs/styles/Vocab/Base/accept.txt +++ b/docs/styles/Vocab/Base/accept.txt @@ -5,4 +5,5 @@ Config datetime (?i)OneDrive [Rr]epo -env \ No newline at end of file +env +src \ No newline at end of file diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 000000000..849ddff3b --- /dev/null +++ b/src/.gitignore @@ -0,0 +1 @@ +dist/ diff --git a/src/.goreleaser.yaml b/src/.goreleaser.yaml new file mode 100644 index 000000000..8f251243f --- /dev/null +++ b/src/.goreleaser.yaml @@ -0,0 +1,30 @@ +builds: + # https://goreleaser.com/customization/build/#builds + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: # other options: 386, arm + - amd64 + - arm64 + ignore: + - goos: windows + goarch: arm64 +archives: + - replacements: + darwin: Darwin + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj