From ef6ca8583ab25434e71241c913a51bd0073f8512 Mon Sep 17 00:00:00 2001 From: ryanfkeepers Date: Wed, 7 Feb 2024 12:22:07 -0700 Subject: [PATCH] necessary renaming and deployment prevention --- .../actions/backup-restore-test/action.yml | 12 +++--- .github/actions/publish-binary/action.yml | 35 ++++++++++------ .github/workflows/binary-publish.yml | 2 + .github/workflows/ci.yml | 40 ++++++++++++++----- .github/workflows/longevity_test.yml | 37 ++++++++--------- .github/workflows/nightly_test.yml | 2 +- .github/workflows/sanity-test.yaml | 12 +++--- .github/workflows/website-publish.yml | 4 ++ .gitignore | 4 +- README.md | 2 +- build/Dockerfile | 10 ++--- build/build.sh | 10 ++--- docker/Dockerfile | 6 +-- src/.gitignore | 6 +-- src/Makefile | 2 +- src/cli/cli.go | 24 +++++------ src/cli/testdata/cli.go | 2 +- src/cmd/graph_pwsh/README.md | 18 ++++----- src/internal/kopia/conn.go | 2 +- website/docs/developers/build.md | 2 +- 20 files changed, 134 insertions(+), 98 deletions(-) diff --git a/.github/actions/backup-restore-test/action.yml b/.github/actions/backup-restore-test/action.yml index 2916bb34d..2b274ca51 100644 --- a/.github/actions/backup-restore-test/action.yml +++ b/.github/actions/backup-restore-test/action.yml @@ -59,7 +59,7 @@ runs: CATEGORY_SUFFIX="" [[ -n "${{ inputs.category }}" ]] && CATEGORY_SUFFIX="-${{ inputs.category }}" CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-${{ inputs.service }}${CATEGORY_SUFFIX}-backup-${{inputs.kind }}.log - ./corso backup create '${{ inputs.service }}' \ + ./canario backup create '${{ inputs.service }}' \ --no-stats --hide-progress --json \ ${{ inputs.backup-args }} | tee /dev/stderr | # for printing logs @@ -80,7 +80,7 @@ runs: CATEGORY_SUFFIX="" [[ -n "${{ inputs.category }}" ]] && CATEGORY_SUFFIX="-${{ inputs.category }}" CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-${{ inputs.service }}${CATEGORY_SUFFIX}-restore-${{inputs.kind }}.log - ./corso restore '${{ inputs.service }}' \ + ./canario restore '${{ inputs.service }}' \ --no-stats \ --hide-progress \ --collisions ${{ inputs.on-collision }} \ @@ -128,7 +128,7 @@ runs: CATEGORY_SUFFIX="" [[ -n "${{ inputs.category }}" ]] && CATEGORY_SUFFIX="-${{ inputs.category }}" CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-${{ inputs.service }}${CATEGORY_SUFFIX}-restore-${{inputs.kind }}.log - ./corso export '${{ inputs.service }}' \ + ./canario export '${{ inputs.service }}' \ /tmp/export-${{ inputs.service }}${CATEGORY_SUFFIX}-${{inputs.kind }} \ --no-stats \ --hide-progress \ @@ -170,7 +170,7 @@ runs: CATEGORY_SUFFIX="" [[ -n "${{ inputs.category }}" ]] && CATEGORY_SUFFIX="-${{ inputs.category }}" CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-${{ inputs.service }}${CATEGORY_SUFFIX}-restore-${{inputs.kind }}.log - ./corso export '${{ inputs.service }}' \ + ./canario export '${{ inputs.service }}' \ /tmp/export-${{ inputs.service }}${CATEGORY_SUFFIX}-${{inputs.kind }}-archive \ --no-stats \ --hide-progress \ @@ -213,7 +213,7 @@ runs: CATEGORY_SUFFIX="" [[ -n "${{ inputs.category }}" ]] && CATEGORY_SUFFIX="-${{ inputs.category }}" CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-backup-${{ inputs.service }}${CATEGORY_SUFFIX}-list-${{inputs.kind }}.log - ./corso backup list ${{ inputs.service }} \ + ./canario backup list ${{ inputs.service }} \ --no-stats \ --hide-progress \ 2>&1 | @@ -237,7 +237,7 @@ runs: CATEGORY_SUFFIX="" [[ -n "${{ inputs.category }}" ]] && CATEGORY_SUFFIX="-${{ inputs.category }}" CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-backup-list-${{ inputs.service }}${CATEGORY_SUFFIX}-single-${{inputs.kind }}.log - ./corso backup list ${{ inputs.service }} \ + ./canario backup list ${{ inputs.service }} \ --no-stats \ --hide-progress \ --backup "${{ steps.backup.outputs.result }}" \ diff --git a/.github/actions/publish-binary/action.yml b/.github/actions/publish-binary/action.yml index 847b2a04b..127a7c034 100644 --- a/.github/actions/publish-binary/action.yml +++ b/.github/actions/publish-binary/action.yml @@ -1,5 +1,14 @@ name: Publish Binary +################################### +# notice: +# This file has undergone major +# renaming for the canario fork. +# In case of re-incorporation back +# to corso, this refactoring will +# need to be undone. +################################### + inputs: version: description: Corso version to use for publishing @@ -40,36 +49,36 @@ runs: workdir: src env: GITHUB_TOKEN: ${{ inputs.github_token }} - RUDDERSTACK_CORSO_WRITE_KEY: ${{ inputs.rudderstack_write_key }} - RUDDERSTACK_CORSO_DATA_PLANE_URL: ${{ inputs.rudderstack_data_plane_url }} - CORSO_VERSION: ${{ inputs.version }} + RUDDERSTACK_CANARIO_WRITE_KEY: ${{ inputs.rudderstack_write_key }} + RUDDERSTACK_CANARIO_DATA_PLANE_URL: ${{ inputs.rudderstack_data_plane_url }} + CANARIO_VERSION: ${{ inputs.version }} - name: Upload darwin arm64 uses: actions/upload-artifact@v3 with: - name: corso_Darwin_arm64 - path: src/dist/corso_darwin_arm64/corso + name: canario_Darwin_arm64 + path: src/dist/canario_darwin_arm64/canario - name: Upload linux arm64 uses: actions/upload-artifact@v3 with: - name: corso_Linux_arm64 - path: src/dist/corso_linux_arm64/corso + name: canario_Linux_arm64 + path: src/dist/canario_linux_arm64/canario - name: Upload darwin amd64 uses: actions/upload-artifact@v3 with: - name: corso_Darwin_amd64 - path: src/dist/corso_darwin_amd64_v1/corso + name: canario_Darwin_amd64 + path: src/dist/canario_darwin_amd64_v1/canario - name: Upload linux amd64 uses: actions/upload-artifact@v3 with: - name: corso_Linux_amd64 - path: src/dist/corso_linux_amd64_v1/corso + name: canario_Linux_amd64 + path: src/dist/canario_linux_amd64_v1/canario - name: Upload windows amd64 uses: actions/upload-artifact@v3 with: - name: corso_Windows_amd64 - path: src/dist/corso_windows_amd64_v1/corso.exe + name: canario_Windows_amd64 + path: src/dist/canario_windows_amd64_v1/canario.exe diff --git a/.github/workflows/binary-publish.yml b/.github/workflows/binary-publish.yml index c6eab38dc..7468fb7ed 100644 --- a/.github/workflows/binary-publish.yml +++ b/.github/workflows/binary-publish.yml @@ -29,6 +29,8 @@ jobs: - uses: actions/checkout@v4 - name: Publish Binary + # canario should never publish + if: false uses: ./.github/actions/publish-binary with: version: ${{ needs.SetEnv.outputs.version }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d21bafd77..d8fbc6c81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: Build/Release Corso env: - IMAGE_NAME: ghcr.io/alcionai/corso + IMAGE_NAME: ghcr.io/alcionai/canario on: workflow_dispatch: @@ -30,7 +30,7 @@ jobs: # --- Prechecks and Checkouts ------------------------------------------------------------------------ # ---------------------------------------------------------------------------------------------------- Precheck: - uses: alcionai/corso/.github/workflows/_filechange_checker.yml@main + uses: alcionai/canario/.github/workflows/_filechange_checker.yml@main Checkout: needs: [Precheck] @@ -52,7 +52,7 @@ jobs: # SetM365App will decide which M365 app to use for this CI run SetM365App: - uses: alcionai/corso/.github/workflows/accSelector.yaml@main + uses: alcionai/canario/.github/workflows/accSelector.yaml@main SetEnv: environment: Testing @@ -571,6 +571,8 @@ jobs: - uses: actions/checkout@v4 - name: Publish Binary + # canario should never publish + if: false uses: ./.github/actions/publish-binary with: version: ${{ needs.SetEnv.outputs.version }} @@ -582,7 +584,9 @@ jobs: needs: [Test-Suite-Trusted, Source-Code-Linting, Website-Linting, SetEnv] environment: ${{ needs.SetEnv.outputs.environment }} runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') + # canario should never publish + if: false + # if: startsWith(github.ref, 'refs/tags/') defaults: run: working-directory: build @@ -635,7 +639,9 @@ jobs: needs: [Publish-Binary, Publish-Image, SetEnv] environment: Testing runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') + # canario should never publish + if: false + # if: startsWith(github.ref, 'refs/tags/') env: CORSO_VERSION: ${{ needs.SetEnv.outputs.version }} steps: @@ -665,7 +671,9 @@ jobs: needs: [Publish-Binary, Publish-Image, SetEnv] environment: Testing runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') + # canario should never publish + if: false + # if: startsWith(github.ref, 'refs/tags/') env: CORSO_VERSION: ${{ needs.SetEnv.outputs.version }} steps: @@ -687,7 +695,9 @@ jobs: needs: [Publish-Binary, Publish-Image, SetEnv] environment: Testing runs-on: macos-latest - if: startsWith(github.ref, 'refs/tags/') + # canario should never publish + if: false + # if: startsWith(github.ref, 'refs/tags/') env: CORSO_VERSION: ${{ needs.SetEnv.outputs.version }} steps: @@ -709,7 +719,9 @@ jobs: needs: [Publish-Binary, Publish-Image, SetEnv] environment: Testing runs-on: windows-latest - if: startsWith(github.ref, 'refs/tags/') + # canario should never publish + if: false + # if: startsWith(github.ref, 'refs/tags/') env: CORSO_VERSION: ${{ needs.SetEnv.outputs.version }} steps: @@ -730,6 +742,8 @@ jobs: - uses: actions/checkout@v4 # need to checkout to make the action available - name: Publish website + # canario should never publish + if: false uses: ./.github/actions/publish-website with: aws-iam-role: ${{ secrets.AWS_IAM_ROLE }} @@ -740,12 +754,16 @@ jobs: needs: [SetEnv, Validate-Linux-Artifacts, Validate-MacOS-Artifacts, Validate-Docker-Artifacts, Validate-Windows-Artifacts] environment: ${{ needs.SetEnv.outputs.environment }} runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') + # canario should never publish + if: false + # if: startsWith(github.ref, 'refs/tags/') steps: - uses: actions/checkout@v4 # need to checkout to make the action available - name: Publish website + # canario should never publish + if: false uses: ./.github/actions/publish-website with: aws-iam-role: ${{ secrets.AWS_IAM_ROLE }} @@ -756,7 +774,9 @@ jobs: needs: [Publish-Website-Prod, SetEnv] environment: Testing runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') + # canario should never publish + if: false + # if: startsWith(github.ref, 'refs/tags/') env: CORSO_VERSION: ${{ needs.SetEnv.outputs.version }} steps: diff --git a/.github/workflows/longevity_test.yml b/.github/workflows/longevity_test.yml index f6b97a49a..94883dad7 100644 --- a/.github/workflows/longevity_test.yml +++ b/.github/workflows/longevity_test.yml @@ -20,7 +20,7 @@ concurrency: jobs: SetM365App: - uses: alcionai/corso/.github/workflows/accSelector.yaml@main + uses: alcionai/canario/.github/workflows/accSelector.yaml@main Longevity-Tests: needs: [ SetM365App ] @@ -76,7 +76,8 @@ jobs: git checkout ${{ steps.version.outputs.version }} git checkout ${{ github.ref }} -- .github - - run: go build -o corso + - run: + timeout-minutes: 10 - run: mkdir ${CORSO_LOG_DIR} @@ -97,7 +98,7 @@ jobs: - name: Version Test timeout-minutes: 10 run: | - ./corso --version | grep -c 'Corso version:' + ./canario --version | grep -c 'Corso version:' - name: Repo init test id: repo-init @@ -105,7 +106,7 @@ jobs: run: | set -euo pipefail echo -e "\nRepo init test\n" >> ${{ env.CORSO_LOG_FILE }} - ./corso repo init s3 \ + ./canario repo init s3 \ --no-stats \ --hide-progress \ --retention-mode $(echo "${{ env.RETENTION_MODE }}" | tr '[:upper:]' '[:lower:]') \ @@ -127,7 +128,7 @@ jobs: run: | set -euo pipefail echo -e "\nRepo connect test\n" >> ${{ env.CORSO_LOG_FILE }} - ./corso repo connect s3 \ + ./canario repo connect s3 \ --no-stats \ --hide-progress \ --prefix ${{ env.PREFIX }} \ @@ -148,7 +149,7 @@ jobs: timeout-minutes: 30 run: | echo -e "\nBackup Exchange test\n" >> ${CORSO_LOG_FILE} - ./corso backup create exchange \ + ./canario backup create exchange \ --no-stats \ --mailbox "${TEST_USER}" \ --hide-progress \ @@ -174,7 +175,7 @@ jobs: run: | set -euo pipefail echo -e "\nBackup OneDrive test\n" >> ${CORSO_LOG_FILE} - ./corso backup create onedrive \ + ./canario backup create onedrive \ --no-stats \ --hide-progress \ --user "${TEST_USER}" \ @@ -200,7 +201,7 @@ jobs: set -euo pipefail echo -e "\nBackup SharePoint test\n" >> ${CORSO_LOG_FILE} - ./corso backup create sharepoint \ + ./canario backup create sharepoint \ --no-stats \ --hide-progress \ --site "${{ vars.CORSO_M365_TEST_SITE_URL }}" \ @@ -265,9 +266,9 @@ jobs: echo -e "\Export OneDrive test\n" >> ${CORSO_LOG_FILE} echo -e "\Export OneDrive test - first entry\n" >> ${CORSO_LOG_FILE} - ./corso backup list onedrive 2>/dev/null | tail -n+2 | head -n1 | awk '{print $1}' | + ./canario backup list onedrive 2>/dev/null | tail -n+2 | head -n1 | awk '{print $1}' | while read -r line; do - ./corso export onedrive \ + ./canario export onedrive \ "/tmp/corso-export--$line" \ --no-stats \ --backup "$line" \ @@ -275,9 +276,9 @@ jobs: done echo -e "\Export OneDrive test - last entry\n" >> ${CORSO_LOG_FILE} - ./corso backup list onedrive 2>/dev/null | tail -n1 | awk '{print $1}' | + ./canario backup list onedrive 2>/dev/null | tail -n1 | awk '{print $1}' | while read -r line; do - ./corso export onedrive \ + ./canario export onedrive \ "/tmp/corso-export--$line" \ --no-stats \ --backup "$line" \ @@ -293,9 +294,9 @@ jobs: echo -e "\Export SharePoint test\n" >> ${CORSO_LOG_FILE} echo -e "\Export SharePoint test - first entry\n" >> ${CORSO_LOG_FILE} - ./corso backup list sharepoint 2>/dev/null | tail -n+2 | head -n1 | awk '{print $1}' | + ./canario backup list sharepoint 2>/dev/null | tail -n+2 | head -n1 | awk '{print $1}' | while read -r line; do - ./corso export sharepoint \ + ./canario export sharepoint \ "/tmp/corso-export--$line" \ --no-stats \ --backup "$line" \ @@ -303,9 +304,9 @@ jobs: done echo -e "\Export SharePoint test - last entry\n" >> ${CORSO_LOG_FILE} - ./corso backup list sharepoint 2>/dev/null | tail -n1 | awk '{print $1}' | + ./canario backup list sharepoint 2>/dev/null | tail -n1 | awk '{print $1}' | while read -r line; do - ./corso export sharepoint \ + ./canario export sharepoint \ "/tmp/corso-export--$line" \ --no-stats \ --backup "$line" \ @@ -324,7 +325,7 @@ jobs: # Run with the force flag so it doesn't fail if the github runner # hostname isn't what's expected. This is only safe because we can # guarantee only one runner will be executing maintenance at a time. - ./corso repo maintenance --mode metadata \ + ./canario repo maintenance --mode metadata \ --no-stats \ --hide-progress \ --force \ @@ -339,7 +340,7 @@ jobs: set -euo pipefail echo -e "\n Maintenance test Weekly\n" >> ${CORSO_LOG_FILE} - ./corso repo maintenance --mode complete \ + ./canario repo maintenance --mode complete \ --no-stats \ --hide-progress \ --force \ diff --git a/.github/workflows/nightly_test.yml b/.github/workflows/nightly_test.yml index 4e65b52a5..e49ce7730 100644 --- a/.github/workflows/nightly_test.yml +++ b/.github/workflows/nightly_test.yml @@ -41,7 +41,7 @@ jobs: # SetM365App will decide which M365 app to use for this CI run SetM365App: - uses: alcionai/corso/.github/workflows/accSelector.yaml@main + uses: alcionai/canario/.github/workflows/accSelector.yaml@main # ---------------------------------------------------------------------------------------------------- # --- Nightly Testing ------------------------------------------------------------------- diff --git a/.github/workflows/sanity-test.yaml b/.github/workflows/sanity-test.yaml index da18b2228..87bab7be2 100644 --- a/.github/workflows/sanity-test.yaml +++ b/.github/workflows/sanity-test.yaml @@ -20,7 +20,7 @@ concurrency: jobs: SetM365App: - uses: alcionai/corso/.github/workflows/accSelector.yaml@main + uses: alcionai/canario/.github/workflows/accSelector.yaml@main Sanity-Tests: needs: [ SetM365App ] @@ -56,7 +56,7 @@ jobs: with: go-version-file: src/go.mod - - run: go build -o corso + - run: go build -o canario timeout-minutes: 10 - run: go build -o sanity-test ./cmd/sanity_test @@ -114,7 +114,7 @@ jobs: - name: Version Test timeout-minutes: 10 run: | - ./corso --version | grep -c 'Corso version:' + ./canario --version | grep -c 'Corso version:' - name: Repo init test timeout-minutes: 10 @@ -123,7 +123,7 @@ jobs: set -euo pipefail prefix=$(date +"%Y-%m-%d-%T") echo -e "\nRepo init test\n" >> ${{ env.CORSO_LOG_FILE }} - ./corso repo init s3 \ + ./canario repo init s3 \ --no-stats \ --hide-progress \ --prefix $prefix \ @@ -143,7 +143,7 @@ jobs: run: | set -euo pipefail echo -e "\nRepo connect test\n" >> ${{ env.CORSO_LOG_FILE }} - ./corso repo connect s3 \ + ./canario repo connect s3 \ --no-stats \ --hide-progress \ --prefix ${{ steps.repo-init.outputs.result }} \ @@ -163,7 +163,7 @@ jobs: run: | set -euo pipefail echo -e "\nRepo maintenance test\n" >> ${{ env.CORSO_LOG_FILE }} - ./corso repo maintenance \ + ./canario repo maintenance \ --no-stats \ --hide-progress \ --mode complete \ diff --git a/.github/workflows/website-publish.yml b/.github/workflows/website-publish.yml index 4581d9bfe..fa73ab8f6 100644 --- a/.github/workflows/website-publish.yml +++ b/.github/workflows/website-publish.yml @@ -49,6 +49,8 @@ jobs: Publish-Website: needs: [Website-Linting] + # canario should never publish + if: false environment: Production runs-on: ubuntu-latest defaults: @@ -59,6 +61,8 @@ jobs: - uses: actions/checkout@v4 # need to checkout to make the action available - name: Publish website + # canario should never publish + if: false uses: ./.github/actions/publish-website with: aws-iam-role: ${{ secrets.AWS_IAM_ROLE }} diff --git a/.gitignore b/.gitignore index bdda0724b..72fb5bb09 100644 --- a/.gitignore +++ b/.gitignore @@ -19,8 +19,8 @@ testlog/ *.swp # Standard configuration file names -.corso_test.toml -.corso.toml +.canario_test.toml +.canario.toml # Logging *.log diff --git a/README.md b/README.md index 413072d50..5583b9c16 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

Corso Logo

-

Corso

+

--CANARIO--

[![Go Report Card](https://goreportcard.com/badge/github.com/alcionai/corso/src)](https://goreportcard.com/report/github.com/alcionai/corso/src) [![Discord](https://img.shields.io/badge/discuss-discord-blue)](https://discord.gg/63DTTSnuhT) diff --git a/build/Dockerfile b/build/Dockerfile index 061ad6787..9ed406ce9 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -4,21 +4,21 @@ WORKDIR /go/src/app COPY src . ARG CORSO_BUILD_LDFLAGS="" -RUN go build -o corso -ldflags "$CORSO_BUILD_LDFLAGS" +RUN go build -o canario -ldflags "$CORSO_BUILD_LDFLAGS" FROM alpine:3 -LABEL org.opencontainers.image.title="Corso" +LABEL org.opencontainers.image.title="Canario" LABEL org.opencontainers.image.description="Free, Secure, and Open-Source Backup for Microsoft 365" LABEL org.opencontainers.image.url="https://github.com/alcionai/canario" LABEL org.opencontainers.image.source="https://github.com/alcionai/canario" LABEL org.opencontainers.image.vendor="Alcion, Inc." -COPY --from=builder /go/src/app/corso /corso +COPY --from=builder /go/src/app/canario /canario RUN apk add --no-cache ca-certificates -ENV CORSO_HOME=/app/corso +ENV CORSO_HOME=/app/canario ENV CORSO_CONFIG_DIR=$CORSO_HOME \ KOPIA_CONFIG_PATH=$CORSO_HOME/kopia/config/repository.config \ KOPIA_LOG_DIR=$CORSO_HOME/kopia/logs \ @@ -26,4 +26,4 @@ ENV CORSO_CONFIG_DIR=$CORSO_HOME \ KOPIA_PERSIST_CREDENTIALS_ON_CONNECT=false \ KOPIA_CHECK_FOR_UPDATES=false -ENTRYPOINT ["/corso"] \ No newline at end of file +ENTRYPOINT ["/canario"] \ No newline at end of file diff --git a/build/build.sh b/build/build.sh index 1053c860d..9fcf28399 100755 --- a/build/build.sh +++ b/build/build.sh @@ -30,7 +30,7 @@ Darwin) GOOS="darwin" ;; esac PLATFORMS="$GOOS/$GOARCH" # default platform -TAG="alcionai/corso" # default image tag +TAG="alcionai/canario" # default image tag MODE="binary" case "$1" in @@ -68,13 +68,13 @@ if [ "$MODE" == "binary" ]; then --env GOOS=${GOOS} --env GOARCH=${GOARCH} \ --workdir "/app/src" \ golang:${GOVER} \ - go build -o corso -ldflags "${CORSO_BUILD_LDFLAGS}" + go build -o canario -ldflags "${CORSO_BUILD_LDFLAGS}" - OUTFILE="corso" - [ "$GOOS" == "windows" ] && OUTFILE="corso.exe" + OUTFILE="canario" + [ "$GOOS" == "windows" ] && OUTFILE="canario.exe" mkdir -p "${ROOT}/bin/${GOOS}-${GOARCH}" - mv "${ROOT}/src/corso" "${ROOT}/bin/${GOOS}-${GOARCH}/${OUTFILE}" + mv "${ROOT}/src/canario" "${ROOT}/bin/${GOOS}-${GOARCH}/${OUTFILE}" echo Corso $platform binary available in "${ROOT}/bin/${GOOS}-${GOARCH}/${OUTFILE}" done else diff --git a/docker/Dockerfile b/docker/Dockerfile index cae074692..736bf38a3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -17,13 +17,13 @@ COPY ./src . FROM base AS build ARG TARGETOS ARG TARGETARCH -RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /corso . +RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /canario . ## Deploy FROM ubuntu:22.10 -COPY --from=build /corso / +COPY --from=build /canario / USER nobody -ENTRYPOINT ["/corso"] +ENTRYPOINT ["/canario"] diff --git a/src/.gitignore b/src/.gitignore index b06b4dde6..be1a7f455 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,5 +1,5 @@ dist/ -corso +canario # Test binary, built with `go test -c` *.test @@ -14,8 +14,8 @@ testlog/ *.swp # Standard configuration file names -.corso_test.toml -.corso.toml +.canario_test.toml +.canario.toml # Logging *.log diff --git a/src/Makefile b/src/Makefile index ef13a79f8..b993d5871 100644 --- a/src/Makefile +++ b/src/Makefile @@ -9,7 +9,7 @@ BAD_LINT_MSG := "Missing golangci-lint version $(WANTED_LINT_VERSION). Visit $(I .PHONY: check-lint check-lint-version lint load-test build: - go build -o corso + go build -o canario lint: check-lint-version golangci-lint run diff --git a/src/cli/cli.go b/src/cli/cli.go index cb9e9c666..f06398c97 100644 --- a/src/cli/cli.go +++ b/src/cli/cli.go @@ -28,9 +28,9 @@ import ( // ------------------------------------------------------------------------------------------ // The root-level command. -// `corso [] [] [...]` -var corsoCmd = &cobra.Command{ - Use: "corso", +// `canario [] [] [...]` +var canarioCmd = &cobra.Command{ + Use: "canario", Short: "Free, Secure, Open-Source Backup for M365.", Long: `Free, Secure, and Open-Source Backup for Microsoft 365.`, RunE: handleCorsoCmd, @@ -54,7 +54,7 @@ func preRun(cc *cobra.Command, args []string) error { } avoidTheseCommands := []string{ - "corso", "env", "help", "backup", "details", "list", "restore", "export", "delete", "repo", "init", "connect", + "canario", "env", "help", "backup", "details", "list", "restore", "export", "delete", "repo", "init", "connect", } if len(logger.ResolvedLogFile) > 0 && !slices.Contains(avoidTheseCommands, cc.Use) { @@ -62,7 +62,7 @@ func preRun(cc *cobra.Command, args []string) error { } // handle deprecated user flag in Backup exchange command - if cc.CommandPath() == "corso backup create exchange" { + if cc.CommandPath() == "canario backup create exchange" { handleMailBoxFlag(ctx, cc, flagSl) } @@ -83,8 +83,8 @@ func handleMailBoxFlag(ctx context.Context, c *cobra.Command, flagNames []string } } -// Handler for flat calls to `corso`. -// Produces the same output as `corso --help`. +// Handler for flat calls to `canario`. +// Produces the same output as `canario --help`. func handleCorsoCmd(cmd *cobra.Command, args []string) error { v, _ := cmd.Flags().GetBool("version") if v { @@ -99,7 +99,7 @@ func handleCorsoCmd(cmd *cobra.Command, args []string) error { // The command tree is built and attached to the returned command. func CorsoCommand() *cobra.Command { c := &cobra.Command{} - *c = *corsoCmd + *c = *canarioCmd BuildCommandTree(c) return c @@ -118,7 +118,7 @@ func BuildCommandTree(cmd *cobra.Command) { observe.AddProgressBarFlags(cmd) print.AddOutputFlag(cmd) flags.AddGlobalOperationFlags(cmd) - cmd.SetUsageTemplate(indentExamplesTemplate(corsoCmd.UsageTemplate())) + cmd.SetUsageTemplate(indentExamplesTemplate(canarioCmd.UsageTemplate())) cmd.CompletionOptions.DisableDefaultCmd = true @@ -139,10 +139,10 @@ func Handle() { //nolint:forbidigo ctx := config.Seed(context.Background()) ctx, log := logger.Seed(ctx, logger.PreloadLoggingFlags(os.Args[1:])) - ctx = print.SetRootCmd(ctx, corsoCmd) + ctx = print.SetRootCmd(ctx, canarioCmd) ctx = observe.SeedObserver(ctx, print.StderrWriter(ctx), observe.PreloadFlags()) - BuildCommandTree(corsoCmd) + BuildCommandTree(canarioCmd) defer func() { observe.Flush(ctx) // flush the progress bars @@ -150,7 +150,7 @@ func Handle() { _ = log.Sync() // flush all logs in the buffer }() - if err := corsoCmd.ExecuteContext(ctx); err != nil { + if err := canarioCmd.ExecuteContext(ctx); err != nil { logger.CtxErr(ctx, err).Error("cli execution") os.Exit(1) } diff --git a/src/cli/testdata/cli.go b/src/cli/testdata/cli.go index 24b75c22c..c09b2d03c 100644 --- a/src/cli/testdata/cli.go +++ b/src/cli/testdata/cli.go @@ -22,7 +22,7 @@ import ( func StubRootCmd(args ...string) *cobra.Command { id := uuid.NewString() now := time.Now().UTC().Format(time.RFC3339Nano) - cmdArg := "testing-corso" + cmdArg := "testing-canario" c := &cobra.Command{ Use: cmdArg, Short: id, diff --git a/src/cmd/graph_pwsh/README.md b/src/cmd/graph_pwsh/README.md index b34a877b5..bc3d32f03 100644 --- a/src/cmd/graph_pwsh/README.md +++ b/src/cmd/graph_pwsh/README.md @@ -14,7 +14,7 @@ It provides a convenient wrapper and great coverage of the API surface. Before using the tool you want to build the container that packages it. ```sh -docker build -t corso/graph_pwsh:latest . +docker build -t canario/graph_pwsh:latest . ``` A prebuilt image is also available currently available as `gmatev/graph_pwsh`. @@ -40,13 +40,13 @@ This is suitable if you would like to issue a number of MS Graph API commands fr interactive shell in the container. ```sh -docker run --rm -it -v $(pwd):/usr/pwsh -e AZURE_TENANT_ID -e AZURE_CLIENT_ID -e AZURE_CLIENT_SECRET corso/graph_pwsh pwsh +docker run --rm -it -v $(pwd):/usr/pwsh -e AZURE_TENANT_ID -e AZURE_CLIENT_ID -e AZURE_CLIENT_SECRET canario/graph_pwsh pwsh ``` Alternatively you can use an environment variable file `env_names` that has the names of the required environment variables ```sh -docker run --rm -it -v $(pwd):/usr/pwsh --env-file env_names corso/graph_pwsh pwsh +docker run --rm -it -v $(pwd):/usr/pwsh --env-file env_names canario/graph_pwsh pwsh ``` Before you run any command you want to authenticate with Graph using a convenient script @@ -64,7 +64,7 @@ Suitable when you want to run just a single command. Essentially running the `Au before the actual command you want to run. ```sh -docker run --rm -it -v $(pwd):/usr/pwsh --env-file env_names corso/graph_pwsh \ +docker run --rm -it -v $(pwd):/usr/pwsh --env-file env_names canario/graph_pwsh \ pwsh -c "" ``` @@ -72,7 +72,7 @@ Here is a complete example to get all users ```sh # This is the equivalent of GET https://graph.microsoft.com/v1.0/users -docker run --rm -it -v $(pwd):/usr/pwsh --env-file env_names corso/graph_pwsh \ +docker run --rm -it -v $(pwd):/usr/pwsh --env-file env_names canario/graph_pwsh \ pwsh -c "Get-MgUser -All" ``` @@ -80,7 +80,7 @@ Another example to retrieve an email message for a given user by ID. ```sh # This is the equivalent of GET https://graph.microsoft.com/v1.0//messages/ -docker run --rm -it -v $(pwd):/usr/pwsh --env-file env_names corso/graph_pwsh \ +docker run --rm -it -v $(pwd):/usr/pwsh --env-file env_names canario/graph_pwsh \ pwsh -c "Get-MgUserMessage -UserId -MessageID " ``` @@ -95,7 +95,7 @@ and execute the container which will pull it and then execute it. This can be do `Execute-Script.ps1` command as follows. ```sh -docker run --rm -it -v $(pwd):/usr/pwsh --env-file env_names corso/graph_pwsh \ +docker run --rm -it -v $(pwd):/usr/pwsh --env-file env_names canario/graph_pwsh \ pwsh -c "Execute-Script.ps1 -ScriptUrl