Skip to content

Commit cb49dc5

Browse files
committed
Remove bazel
Signed-off-by: Martin Necas <mnecas@redhat.com>
1 parent fb9d138 commit cb49dc5

File tree

10 files changed

+98
-105
lines changed

10 files changed

+98
-105
lines changed

.github/workflows/build_push_tests.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ jobs:
1010
REGISTRY: quay.io
1111
REGISTRY_TAG: ${{ github.head_ref || github.ref_name }}
1212
REGISTRY_ORG: kubev2v
13-
USE_BAZEL_VERSION: 5.4.0
1413
steps:
1514
- name: Check out forkliftci repository
1615
uses: actions/checkout@v3
@@ -21,8 +20,9 @@ jobs:
2120
- name: Checkout forklift
2221
uses: actions/checkout@v3
2322
with:
24-
repository: kubev2v/forklift
23+
repository: mnecas/forklift
2524
path: forklift
25+
ref: remove_bazel
2626

2727
- name: Login to quay.io with bot account
2828
uses: docker/login-action@v2
@@ -31,15 +31,6 @@ jobs:
3131
username: ${{ secrets.QUAY_USERNAME }}
3232
password: ${{ secrets.QUAY_TOKEN }}
3333

34-
- name: Bazel cache
35-
id: bazel-cache
36-
uses: actions/cache@v3
37-
with:
38-
path: ~/.cache/bazel
39-
key: ${{ runner.os }}-bazel-cache-${{ hashFiles('WORKSPACE') }}
40-
41-
#- run: cd forklift/ && bazel sync --configure
42-
4334
# this is required by nbdkit plugin compiler
4435
- run: sudo apt-get install -y nbdkit-plugin-dev
4536

.github/workflows/deploy-sno-okd.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ jobs:
2626
- name: Checkout forklift
2727
uses: actions/checkout@v3
2828
with:
29-
repository: kubev2v/forklift
29+
repository: mnecas/forklift
3030
path: forklift
31+
ref: remove_bazel
3132

3233
- name: run OKD deployment
3334
uses: ./ci/deploy-okd

build_and_setup_everything_bazel_manually.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ source ./cluster/common.sh
1212
. ./cluster/kind/kind_with_registry.sh
1313

1414
# clone the forklift repo
15-
./cluster/get_forklift_bazel.sh
15+
./cluster/get_forklift.sh
1616

1717
# deploy kubevirt
1818
./cluster/k8s-deploy-kubevirt.sh

build_forklift_bazel.sh

Lines changed: 18 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ PROVIDER_NAME=${1:-all}
99

1010
echo "Building for provider ${PROVIDER_NAME}"
1111

12-
13-
14-
15-
1612
[ ! -d ${FORKLIFT_DIR:-forklift} ] && FORKLIFT_DIR="${SCRIPT_DIR}/forklift"
1713

1814
# verify there is WORKSPACE file
@@ -27,71 +23,23 @@ export XDG_RUNTIME_DIR="$(mktemp -p /tmp -d xdg-runtime-XXXXXX)"
2723

2824
export REGISTRY=localhost:5001
2925
export REGISTRY_TAG=latest
30-
export REGISTRY_ORG=""
26+
export REGISTRY_ORG="kubev2v"
3127
export CONTAINER_CMD=$(which docker)
3228

33-
# REGISTRY_ORG cannot be empty with docker
34-
if [ "${PROVIDER_NAME}" = "openstack" ]; then
35-
bazel run push-openstack-populator
36-
fi
37-
if [ "${PROVIDER_NAME}" = "ovirt" ]; then
38-
bazel run push-ovirt-populator
39-
fi
40-
if [ "${PROVIDER_NAME}" = "ova" ]; then
41-
bazel run push-ova-provider-server
42-
fi
43-
44-
bazel run push-populator-controller
45-
46-
bazel run push-forklift-api
47-
bazel run push-forklift-controller
48-
bazel run push-forklift-validation
49-
bazel run push-forklift-operator
50-
51-
ACTION_ENV="--action_env CONTROLLER_IMAGE=${REGISTRY}/forklift-controller:${REGISTRY_TAG} \
52-
--action_env VALIDATION_IMAGE=${REGISTRY}/forklift-validation:${REGISTRY_TAG} \
53-
--action_env OPERATOR_IMAGE=${REGISTRY}/forklift-operator:${REGISTRY_TAG} \
54-
--action_env API_IMAGE=${REGISTRY}/forklift-api:${REGISTRY_TAG}"
55-
56-
# if provider is ovirt or openstack, builder populator controller
57-
if [ "${PROVIDER_NAME}" = "ovirt" ] || [ "${PROVIDER_NAME}" = "openstack" ]; then
58-
ACTION_ENV="$ACTION_ENV --action_env POPULATOR_CONTROLLER_IMAGE=${REGISTRY}/populator-controller:${REGISTRY_TAG}"
59-
fi
60-
61-
if [ "${PROVIDER_NAME}" = "ovirt" ]; then
62-
ACTION_ENV="$ACTION_ENV --action_env OVIRT_POPULATOR_IMAGE=${REGISTRY}/ovirt-populator:${REGISTRY_TAG}"
63-
fi
64-
65-
if [ "${PROVIDER_NAME}" = "openstack" ]; then
66-
ACTION_ENV="$ACTION_ENV --action_env OPENSTACK_POPULATOR_IMAGE=${REGISTRY}/openstack-populator:${REGISTRY_TAG}"
67-
fi
68-
69-
if [ "${PROVIDER_NAME}" = "vsphere" ]; then
70-
ACTION_ENV="$ACTION_ENV --action_env VIRT_V2V_IMAGE=quay.io/kubev2v/forklift-virt-v2v-stub:${REGISTRY_TAG} \
71-
--action_env VIRT_V2V_DONT_REQUEST_KVM=true "
72-
fi
73-
74-
if [ "${PROVIDER_NAME}" = "ova" ]; then
75-
ACTION_ENV="$ACTION_ENV --action_env VIRT_V2V_IMAGE=quay.io/kubev2v/forklift-virt-v2v-stub:${REGISTRY_TAG} \
76-
--action_env VIRT_V2V_DONT_REQUEST_KVM=true \
77-
--action_env OVA_PROVIDER_SERVER_IMAGE=${REGISTRY}/forklift-ova-provider-server:${REGISTRY_TAG}"
78-
fi
79-
80-
if [ "${PROVIDER_NAME}" = "all" ]; then
81-
ACTION_ENV="$ACTION_ENV --action_env VIRT_V2V_IMAGE=quay.io/kubev2v/forklift-virt-v2v-stub:${REGISTRY_TAG} \
82-
--action_env VIRT_V2V_DONT_REQUEST_KVM=true \
83-
--action_env OVIRT_POPULATOR_IMAGE=${REGISTRY}/ovirt-populator:${REGISTRY_TAG} \
84-
--action_env OPENSTACK_POPULATOR_IMAGE=${REGISTRY}/openstack-populator:${REGISTRY_TAG} \
85-
--action_env POPULATOR_CONTROLLER_IMAGE=${REGISTRY}/populator-controller:${REGISTRY_TAG} \
86-
--action_env OVA_PROVIDER_SERVER_IMAGE=${REGISTRY}/forklift-ova-provider-server:${REGISTRY_TAG}"
87-
fi
88-
89-
bazel run push-forklift-operator-bundle \
90-
--action_env CONTROLLER_IMAGE=${REGISTRY}/forklift-controller:${REGISTRY_TAG} \
91-
--action_env VALIDATION_IMAGE=${REGISTRY}/forklift-validation:${REGISTRY_TAG} \
92-
--action_env OPERATOR_IMAGE=${REGISTRY}/forklift-operator:${REGISTRY_TAG} \
93-
--action_env API_IMAGE=${REGISTRY}/forklift-api:${REGISTRY_TAG} \
94-
${ACTION_ENV}
95-
96-
bazel run push-forklift-operator-index --action_env REGISTRY=${REGISTRY} --action_env REGISTRY_TAG=${REGISTRY_TAG} --action_env OPM_OPTS="--use-http"
97-
29+
CONTAINER_RUNTIME="$(basename ${CONTAINER_CMD:-$(command -v podman || command -v docker)})"
30+
if [ ! -z "${XDG_RUNTIME_DIR}" ]; then
31+
PODMAN_AUTH_FILE="${XDG_RUNTIME_DIR}/containers/auth.json"
32+
if [ "${CONTAINER_RUNTIME}" == "podman" ]; then
33+
if [ -e "${PODMAN_AUTH_FILE}" ]; then
34+
DOCKER_CONFIG="$(mktemp -d)"
35+
DOCKER_AUTH_FILE="${DOCKER_CONFIG}/config.json"
36+
cp "${PODMAN_AUTH_FILE}" "${DOCKER_AUTH_FILE}"
37+
export DOCKER_CONFIG
38+
else
39+
unset DOCKER_CONFIG
40+
fi
41+
fi
42+
fi
43+
44+
make push-operator-bundle-image push-operator-index-image || echo "tests"
45+
docker pull localhost:5001/kubev2v/forklift-operator-bundle:latest

ci/build-and-setup/action.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,9 @@ runs:
2525
- name: Checkout forklift
2626
uses: actions/checkout@v3
2727
with:
28-
repository: kubev2v/forklift
28+
repository: mnecas/forklift
2929
path: forklift
30-
31-
- name: Bazel cache
32-
id: bazel-cache
33-
uses: actions/cache@v3
34-
with:
35-
path: ~/.cache/bazel
36-
key: ${{ runner.os }}-bazel-cache-${{ hashFiles('forklift/WORKSPACE') }}
30+
ref: remove_bazel
3731

3832
- run: echo "${{ github.action_path }}" >> $GITHUB_PATH
3933
shell: bash
@@ -49,7 +43,7 @@ runs:
4943
env:
5044
GH_TOKEN: ${{ inputs.gh_access_token }}
5145

52-
- name: Build and setup everything with bazel
46+
- name: Build and setup everything
5347
shell: bash
5448
run: |
5549
echo $GITHUB_WORKSPACE

cluster/get_forklift.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
echo "Running $0"
3+
4+
git clone git@github.com:mnecas/forklift.git
5+
cd forklift
6+
git checkout remove_bazel
7+
cd ..

cluster/get_forklift_bazel.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

kind.sh

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/sh
2+
set -o errexit
3+
4+
# 1. Create registry container unless it already exists
5+
reg_name='kind-registry'
6+
reg_port='5001'
7+
if [ "$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)" != 'true' ]; then
8+
docker run \
9+
-d --restart=always -p "127.0.0.1:${reg_port}:5000" --network bridge --name "${reg_name}" \
10+
registry:2
11+
fi
12+
13+
# 2. Create kind cluster with containerd registry config dir enabled
14+
# TODO: kind will eventually enable this by default and this patch will
15+
# be unnecessary.
16+
#
17+
# See:
18+
# https://github.com/kubernetes-sigs/kind/issues/2875
19+
# https://github.com/containerd/containerd/blob/main/docs/cri/config.md#registry-configuration
20+
# See: https://github.com/containerd/containerd/blob/main/docs/hosts.md
21+
cat <<EOF | kind create cluster --config=-
22+
kind: Cluster
23+
apiVersion: kind.x-k8s.io/v1alpha4
24+
containerdConfigPatches:
25+
- |-
26+
[plugins."io.containerd.grpc.v1.cri".registry]
27+
config_path = "/etc/containerd/certs.d"
28+
EOF
29+
30+
# 3. Add the registry config to the nodes
31+
#
32+
# This is necessary because localhost resolves to loopback addresses that are
33+
# network-namespace local.
34+
# In other words: localhost in the container is not localhost on the host.
35+
#
36+
# We want a consistent name that works from both ends, so we tell containerd to
37+
# alias localhost:${reg_port} to the registry container when pulling images
38+
REGISTRY_DIR="/etc/containerd/certs.d/localhost:${reg_port}"
39+
for node in $(kind get nodes); do
40+
docker exec "${node}" mkdir -p "${REGISTRY_DIR}"
41+
cat <<EOF | docker exec -i "${node}" cp /dev/stdin "${REGISTRY_DIR}/hosts.toml"
42+
[host."http://${reg_name}:5000"]
43+
EOF
44+
done
45+
46+
# 4. Connect the registry to the cluster network if not already connected
47+
# This allows kind to bootstrap the network but ensures they're on the same network
48+
if [ "$(docker inspect -f='{{json .NetworkSettings.Networks.kind}}' "${reg_name}")" = 'null' ]; then
49+
docker network connect "kind" "${reg_name}"
50+
fi
51+
52+
# 5. Document the local registry
53+
# https://github.com/kubernetes/enhancements/tree/master/keps/sig-cluster-lifecycle/generic/1755-communicating-a-local-registry
54+
cat <<EOF | kubectl apply -f -
55+
apiVersion: v1
56+
kind: ConfigMap
57+
metadata:
58+
name: local-registry-hosting
59+
namespace: kube-public
60+
data:
61+
localRegistryHosting.v1: |
62+
host: "localhost:${reg_port}"
63+
help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
64+
EOF

setup_everything.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
. ./kind/install_kind.sh
3+
. ./cluster/kind/install_kind.sh
44

55
./cluster/k8s-deploy-forklift.sh
66

stub-images/virt-v2v-stub/BUILD.bazel

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ load(
44
)
55
load("@io_bazel_rules_docker//docker/util:run.bzl", "container_run_and_commit_layer")
66

7-
container_run_and_commit_layer(
8-
name = "qemu-img",
9-
commands = [
10-
"dnf -y install qemu-img file",
11-
],
12-
image = "@centos-stream-9//image",
13-
)
14-
157
container_image(
168
name = "forklift-virt-v2v-stub",
179
base = "@centos-stream-9//image",

0 commit comments

Comments
 (0)