Skip to content

chore(ci): login with docker #1218

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 2 additions & 6 deletions .buildkite/ci-checkov.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#!/usr/bin/env bash
# Set this to fail on the install
# Set this to fail on the install
set -euxo pipefail

# Install and run the plugin for checkov
# Use the full path to run pip3.10
pip3 install checkov

# List of checks we do not want to run here
# This is a living list and will see additions and mostly removals over time.
SKIP_CHECKS="CKV_GCP_22,CKV_GCP_66,CKV_GCP_13,CKV_GCP_71,CKV_GCP_61,CKV_GCP_21,CKV_GCP_65,CKV_GCP_67,CKV_GCP_20,CKV_GCP_69,CKV_GCP_12,CKV_GCP_24,CKV_GCP_25,CKV_GCP_64,CKV_GCP_68,CKV2_AWS_5,CKV2_GCP_3,CKV2_GCP_5,CKV_AWS_23,CKV_GCP_70,CKV_GCP_62,CKV_GCP_62,CKV_GCP_62,CKV_GCP_62,CKV_GCP_29,CKV_GCP_39"
Expand All @@ -19,7 +15,7 @@ echo "==========================================================================
# Set not to fail on non-zero exit code
set +e
# Run checkov
python3 -m checkov.main --skip-check $SKIP_CHECKS --quiet --framework terraform --compact -d .
checkov --skip-check $SKIP_CHECKS --quiet --framework terraform --compact -d .

# Options
# --quiet: Only show failing tests
Expand Down
7 changes: 6 additions & 1 deletion .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ trap remove_pidfile EXIT
echo $$ > "$PIDFILE"

echo "Installing asdf dependencies as defined in '${WORKDIR}/.tool-versions':"
asdf install
if [ ! -f ".use_mise" ]; then
asdf install
else
mise install
eval "$(mise activate)"
fi
18 changes: 12 additions & 6 deletions .buildkite/vagrant-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@ cleanup() {
}

echo --- ":vagrant: installing plugins"
plugins=(vagrant-google vagrant-env vagrant-scp)
for i in "${plugins[@]}"; do
if ! vagrant plugin list --no-tty | grep "$i"; then
vagrant plugin install "$i"
fi
done
vagrant --version
vagrant plugin install vagrant-google --plugin-version '2.7.0'
vagrant plugin install vagrant-env
vagrant plugin install vagrant-scp

trap cleanup EXIT

echo --- ":lock: builder account key"
KEY_PATH="/tmp/e2e-builder.json"
if [ ! -f ${KEY_PATH} ]; then
gcloud secrets versions access latest --secret=e2e-builder-sa-key --quiet --project=sourcegraph-ci > "${KEY_PATH}"
fi
export GOOGLE_JSON_KEY_LOCATION="${KEY_PATH}"

echo --- ":vagrant: starting box $box"
vagrant up "$box" --provider=google || exit_code=$?

Expand Down
12 changes: 6 additions & 6 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
nodejs 16.7.0
yarn 1.22.4
shellcheck 0.7.1
golang 1.19.8
github-cli 2.46.0
python system
nodejs 16.7.0
yarn 1.22.4
shellcheck 0.7.1
golang 1.19.8
github-cli 2.46.0
asdf:bosmak/asdf-checkov latest
6 changes: 6 additions & 0 deletions .use_mise
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Buildkite Agent CI use the presence of this file to determine whether it should install tools with mise or install them with ASDF.
Thus if you delete this file, CI will use ASDF to install tools and not mise.

The file is only meant to be here while we transition to using mise completely.

For more information you can reach out to the dev-infra team on #discuss-dev-infra.
2 changes: 2 additions & 0 deletions test/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
cat << EOF >> /root/.profile
export GIT_BRANCH=#{ENV['BUILDKITE_BRANCH']}
export TEST_TYPE=#{ENV['TEST_TYPE']}
export DOCKER_USERNAME=#{ENV['DOCKER_USERNAME']}
export DOCKER_PASSWORD=#{ENV['DOCKER_PASSWORD']}
EOF
SHELL

Expand Down
5 changes: 4 additions & 1 deletion test/smoke-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
set -euxfo pipefail

configure_docker() {
if [ -n "${DOCKER_USERNAME}" ] && [ -n "${DOCKER_PASSWORD}" ]; then
docker login -u "${DOCKER_USERNAME}" --password-stdin <<<"$DOCKER_PASSWORD"
fi
gcloud auth configure-docker
gcloud auth configure-docker us-central1-docker.pkg.dev
}
Expand All @@ -14,7 +17,7 @@ deploy_sourcegraph() {
timeout 600s ./pure-docker/deploy.sh
expect_containers="23"
elif [[ "$TEST_TYPE" == "docker-compose-test" ]]; then
docker-compose --file docker-compose/docker-compose.yaml up -d -t 600
docker-compose --file docker-compose/docker-compose.yaml up -d -t 600
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit but I think the spacing is off here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

arg! Yeah! I'll fix it!

expect_containers="25"
fi

Expand Down