Skip to content

Evergreen added shell script to create a git archive #1718

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

Merged
merged 2 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 3 additions & 23 deletions .evergreen/.evg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -831,15 +831,7 @@ functions:
set -o errexit
${PREPARE_SHELL}
export K8S_VARIANT=${VARIANT}
cd src
git add .
git commit --allow-empty -m "add files"
# uncompressed tar used to allow appending .git folder
export K8S_DRIVERS_TAR_FILE=/tmp/mongo-java-driver.tar
git archive -o $K8S_DRIVERS_TAR_FILE HEAD
tar -rf $K8S_DRIVERS_TAR_FILE .git
# Loop through all submodule directories and append to the archive
git submodule status --recursive | awk '{ print $2 }' | xargs tar -rf "$K8S_DRIVERS_TAR_FILE"
export K8S_DRIVERS_TAR_FILE=$(./.evergreen/git-archive.sh)
export K8S_TEST_CMD="OIDC_ENV=k8s VARIANT=${VARIANT} ./.evergreen/run-mongodb-oidc-test.sh"
bash $DRIVERS_TOOLS/.evergreen/auth_oidc/k8s/setup-pod.sh
bash $DRIVERS_TOOLS/.evergreen/auth_oidc/k8s/run-self-test.sh
Expand Down Expand Up @@ -939,13 +931,7 @@ tasks:
script: |-
set -o errexit
${PREPARE_SHELL}
cd src
git add .
git commit --allow-empty -m "add files"
# uncompressed tar used to allow appending .git folder
export AZUREOIDC_DRIVERS_TAR_FILE=/tmp/mongo-java-driver.tar
git archive -o $AZUREOIDC_DRIVERS_TAR_FILE HEAD
tar -rf $AZUREOIDC_DRIVERS_TAR_FILE .git
export AZUREOIDC_DRIVERS_TAR_FILE=$(./.evergreen/git-archive.sh)
export AZUREOIDC_TEST_CMD="OIDC_ENV=azure ./.evergreen/run-mongodb-oidc-test.sh"
bash $DRIVERS_TOOLS/.evergreen/auth_oidc/azure/run-driver-test.sh

Expand All @@ -957,13 +943,7 @@ tasks:
script: |-
set -o errexit
${PREPARE_SHELL}
cd src
git add .
git commit --allow-empty -m "add files"
# uncompressed tar used to allow appending .git folder
export GCPOIDC_DRIVERS_TAR_FILE=/tmp/mongo-java-driver.tar
git archive -o $GCPOIDC_DRIVERS_TAR_FILE HEAD
tar -rf $GCPOIDC_DRIVERS_TAR_FILE .git
export GCPOIDC_DRIVERS_TAR_FILE=$(./.evergreen/git-archive.sh)
# Define the command to run on the VM.
# Ensure that we source the environment file created for us, set up any other variables we need,
# and then run our test suite on the vm.
Expand Down
20 changes: 20 additions & 0 deletions .evergreen/git-archive.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Exit the script with error if any of the commands fail
set -o errexit

# Returns the path to the root archive file which includes all git submodules.

echo "Creating root archive"
export GIT_ARCHIVE_FILE="/tmp/mongo-java-driver.tar"

# create root archive
git archive --output $GIT_ARCHIVE_FILE HEAD

echo "Appending submodule archives"
git submodule status --recursive | awk '{ print $2 }' | xargs tar -rf $GIT_ARCHIVE_FILE

echo "Appending .git directory to the root archive"
tar -rf $GIT_ARCHIVE_FILE .git

echo "$GIT_ARCHIVE_FILE"