Skip to content
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
17 changes: 14 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ COPY . .
ARG GIT_COMMIT=unknown
RUN make build GIT_COMMIT=${GIT_COMMIT}

RUN chmod +x /build/bin/hyperfleet-e2e
RUN chmod +x /build/bin/hyperfleet-e2e

FROM registry.ci.openshift.org/ci/hyperfleet-credential-provider:latest AS hyperfleet-credential-provider

Expand All @@ -39,7 +39,19 @@ RUN curl -fsSL "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release
# Install Helm
RUN curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
Comment thread
coderabbitai[bot] marked this conversation as resolved.

# Install Helm plugins - helm-git and helm-diff
# Set up Helm directories (cache and config writable, plugins read-only)
# OpenShift Prow runs with random UID in group 0, requiring group-writable dirs
RUN mkdir -p /tmp/helm-home/.cache/helm \
/tmpl/helm-home/.config/helm \
/usr/local/share/helm/plugins && \
chown -R 0:0 /tmp/helm-home /usr/local/share/helm/plugins && \
chmod -R g=u /tmp/helm-home /usr/local/share/helm/plugins

ENV HELM_CACHE_HOME=/tmp/helm-home/.cache/helm \
HELM_CONFIG_HOME=/tmp/helm-home/.config/helm \
HELM_PLUGINS=/usr/local/share/helm/plugins

# Install Helm plugins
ARG HELM_GIT_VERSION=v1.5.2
ARG HELM_DIFF_VERSION=3.15.7
RUN helm plugin install https://github.com/aslafy-z/helm-git --version ${HELM_GIT_VERSION} && \
Expand Down Expand Up @@ -71,7 +83,6 @@ COPY --from=builder /build/env /e2e/env
# Copy cleanup scripts
COPY --from=builder /build/scripts /e2e/scripts


# Copy default config (fallback if ConfigMap is not mounted)
COPY --from=builder /build/configs /e2e/configs

Expand Down
32 changes: 20 additions & 12 deletions scripts/cleanup-pubsub-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ log_error() {
echo "[ERROR] $*" >&2
}

log_verbose() {
echo "[VERBOSE] $*"
}

log_section() {
Comment thread
ma-hill marked this conversation as resolved.
echo ""
echo "========================================"
Expand Down Expand Up @@ -127,7 +123,7 @@ discover_pubsub_topics() {
local namespace="$1"
local project_id="${GCP_PROJECT_ID}"

log_verbose "Discovering Pub/Sub topics for namespace: ${namespace}"
log_info "Discovering Pub/Sub topics for namespace: ${namespace}" >&2

if [[ -z "${project_id}" ]]; then
log_error "GCP_PROJECT_ID is not set"
Expand Down Expand Up @@ -177,8 +173,8 @@ discover_pubsub_topics() {
done <<< "${all_topics}"

if [[ ${#topics[@]} -eq 0 ]]; then
log_verbose "No Pub/Sub topics found for namespace: ${namespace}" >&2
return 1
log_info "No Pub/Sub topics found for namespace: ${namespace}" >&2
return 2
fi
Comment thread
ma-hill marked this conversation as resolved.

log_info "Found ${#topics[@]} Pub/Sub topic(s) for namespace ${namespace}:" >&2
Expand All @@ -194,7 +190,7 @@ discover_pubsub_subscriptions() {
local namespace="$1"
local project_id="${GCP_PROJECT_ID}"

log_verbose "Discovering Pub/Sub subscriptions for namespace: ${namespace}"
log_info "Discovering Pub/Sub subscriptions for namespace: ${namespace}" >&2

if [[ -z "${project_id}" ]]; then
log_error "GCP_PROJECT_ID is not set"
Expand Down Expand Up @@ -238,8 +234,8 @@ discover_pubsub_subscriptions() {
done <<< "${all_subscriptions}"

if [[ ${#subscriptions[@]} -eq 0 ]]; then
log_verbose "No Pub/Sub subscriptions found for namespace: ${namespace}" >&2
return 1
log_info "No Pub/Sub subscriptions found for namespace: ${namespace}" >&2
return 2
fi

log_info "Found ${#subscriptions[@]} Pub/Sub subscription(s) for namespace ${namespace}:" >&2
Expand Down Expand Up @@ -306,9 +302,15 @@ delete_all_pubsub_subscriptions() {

# Discover subscriptions (stdout only contains resource names, stderr has logs)
local subscriptions
if ! subscriptions=$(discover_pubsub_subscriptions "${namespace}"); then
local discovery_exit_code=0
subscriptions=$(discover_pubsub_subscriptions "${namespace}") || discovery_exit_code=$?

if [[ ${discovery_exit_code} -eq 2 ]]; then
log_info "No Pub/Sub subscriptions to delete"
return 0
elif [[ ${discovery_exit_code} -ne 0 ]]; then
log_error "Failed to discover Pub/Sub subscriptions"
return 1
fi

# Delete each subscription
Expand Down Expand Up @@ -338,9 +340,15 @@ delete_all_pubsub_topics() {

# Discover topics (stdout only contains resource names, stderr has logs)
local topics
if ! topics=$(discover_pubsub_topics "${namespace}"); then
local discovery_exit_code=0
topics=$(discover_pubsub_topics "${namespace}") || discovery_exit_code=$?

if [[ ${discovery_exit_code} -eq 2 ]]; then
log_info "No Pub/Sub topics to delete"
return 0
elif [[ ${discovery_exit_code} -ne 0 ]]; then
log_error "Failed to discover Pub/Sub topics"
return 1
fi

# Delete each topic
Expand Down