Skip to content

Commit

Permalink
added k8s env setup
Browse files Browse the repository at this point in the history
  • Loading branch information
oakrizan committed Apr 3, 2024
1 parent e9de179 commit bd26759
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
Empty file modified .buildkite/deploy/kubernetes/scripts/install-kind.sh
100644 → 100755
Empty file.
Empty file modified .buildkite/deploy/kubernetes/scripts/install-kubectl.sh
100644 → 100755
Empty file.
Empty file modified .buildkite/deploy/kubernetes/scripts/kind-setup.sh
100644 → 100755
Empty file.
Empty file modified .buildkite/deploy/kubernetes/scripts/make.sh
100644 → 100755
Empty file.
Empty file modified .buildkite/deploy/kubernetes/scripts/setup-k8s-env.sh
100644 → 100755
Empty file.
18 changes: 13 additions & 5 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ source .buildkite/env-scripts/util.sh
AWS_SERVICE_ACCOUNT_SECRET_PATH="kv/ci-shared/platform-ingest/aws_account_auth"
PRIVATE_CI_GCS_CREDENTIALS_PATH="kv/ci-shared/platform-ingest/gcp-platform-ingest-ci-service-account"
DOCKER_REGISTRY_SECRET_PATH="kv/ci-shared/platform-ingest/docker_registry_prod"
PRIVATE_CI_GCS_CREDENTIALS_PATH="kv/ci-shared/platform-ingest/private_ci_artifacts_gcs_credentials"
#PRIVATE_CI_GCS_CREDENTIALS_PATH="kv/ci-shared/platform-ingest/private_ci_artifacts_gcs_credentials"
GITHUB_TOKEN_VAULT_PATH="kv/ci-shared/platform-ingest/github_token"

if [[ "$BUILDKITE_PIPELINE_SLUG" == "beats" || "$BUILDKITE_PIPELINE_SLUG" == "filebeat" || "$BUILDKITE_PIPELINE_SLUG" == "auditbeat" || "$BUILDKITE_PIPELINE_SLUG" == "heartbeat" || "$BUILDKITE_PIPELINE_SLUG" == "deploy-k8s" ]]; then
Expand All @@ -24,7 +24,7 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "beats" || "$BUILDKITE_PIPELINE_SLUG" == "fi
fi

# To prevent "OSError: [Errno 24] Too many open files"
ulimit -Sn 80000
ulimit -Sn 150000
echo "--- Ulimit: $(ulimit)"

echo "--- Setting up environment"
Expand All @@ -40,9 +40,13 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "beats" || "$BUILDKITE_PIPELINE_SLUG" == "fi
fi

if [[ "$BUILDKITE_STEP_KEY" == package* ]]; then
export DOCKER_USERNAME_SECRET=$(retry_with_count 5 vault kv get -field user "${DOCKER_REGISTRY_SECRET_PATH}")
export DOCKER_PASSWORD_SECRET=$(retry_with_count 5 vault kv get -field password "${DOCKER_REGISTRY_SECRET_PATH}")
export GITHUB_TOKEN_SECRET=$(retry_with_count 5 vault kv get -field token ${GITHUB_TOKEN_VAULT_PATH})
DOCKER_USERNAME_SECRET=$(retry_with_count 5 vault kv get -field user "${DOCKER_REGISTRY_SECRET_PATH}")
DOCKER_PASSWORD_SECRET=$(retry_with_count 5 vault kv get -field password "${DOCKER_REGISTRY_SECRET_PATH}")
GITHUB_TOKEN_SECRET=$(retry_with_count 5 vault kv get -field token ${GITHUB_TOKEN_VAULT_PATH})

export DOCKER_USERNAME_SECRET
export DOCKER_PASSWORD_SECRET
export GITHUB_TOKEN_SECRET

docker login -u "${DOCKER_USERNAME_SECRET}" -p "${DOCKER_PASSWORD_SECRET}" "${DOCKER_REGISTRY}" 2>/dev/null

Expand All @@ -52,6 +56,10 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "beats" || "$BUILDKITE_PIPELINE_SLUG" == "fi
git config user.name "$github_username"
git config user.email "$github_email"
fi

if [[ "$BUILDKITE_STEP_KEY" == k8s-test* ]]; then
.buildkite/deploy/kubernetes/scripts/setup-k8s-env.sh
fi
fi

ENABLED_BEATS_PIPELINES_SLUGS=(
Expand Down

0 comments on commit bd26759

Please sign in to comment.