Skip to content

Commit

Permalink
Makefile: scripts: Add build args for proxy when using docker build
Browse files Browse the repository at this point in the history
This PR adds build args for proxy when using docker build, this is
specially needed when we are behind a proxy to avoid failures.

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
  • Loading branch information
GabyCT committed Jun 12, 2024
1 parent 15e862d commit 550c956
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ IMG ?= controller:latest
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.24.2

http_proxy := ""
https_proxy := ""

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
Expand Down Expand Up @@ -143,9 +146,9 @@ run: manifests generate fmt vet ## Run a controller from your host.
docker-build: test ## Build docker image with the manager.
ifneq (, $(PEERPODS))
@echo PEERPODS is enabled
docker build -t ${IMG} -f Dockerfile.peerpods .
docker build --build-arg http_proxy=$(http_proxy) --build-arg https_proxy=$(https_proxy) -t ${IMG} -f Dockerfile.peerpods .
else
docker build -t ${IMG} .
docker build --build-arg http_proxy=$(http_proxy) --build-arg https_proxy=$(https_proxy) -t ${IMG} .
endif

.PHONY: docker-push
Expand Down Expand Up @@ -270,7 +273,7 @@ bundle: manifests kustomize operator-sdk## Generate bundle manifests and metadat

.PHONY: bundle-build
bundle-build: ## Build the bundle image.
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
docker build --build-arg http_proxy=$(http_proxy) --build-arg https_proxy=$(https_proxy) -f bundle.Dockerfile -t $(BUNDLE_IMG) .

.PHONY: bundle-push
bundle-push: ## Push the bundle image.
Expand Down
4 changes: 4 additions & 0 deletions install/pre-install-payload/payload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ vfio_gpu_containerd_repo=${vfio_gpu_containerd_repo:-"https://github.com/confide
nydus_snapshotter_repo=${nydus_snapshotter_repo:-"https://github.com/containerd/nydus-snapshotter"}
containerd_dir="$(mktemp -d -t containerd-XXXXXXXXXX)/containerd"
extra_docker_manifest_flags="${extra_docker_manifest_flags:-}"
http_proxy="${http_proxy:-}"
https_proxy="${https_proxy:-}"

registry="${registry:-quay.io/confidential-containers/reqs-payload}"

Expand Down Expand Up @@ -59,6 +61,8 @@ function build_payload() {

echo "Building containerd payload image for ${arch}"
docker buildx build \
--build-arg HTTP_PROXY="${http_proxy}" \
--build-arg HTTPS_PROXY="${https_proxy}" \
--build-arg ARCH="${golang_arch}" \
--build-arg COCO_CONTAINERD_VERSION="${coco_containerd_version}" \
--build-arg COCO_CONTAINERD_REPO="${coco_containerd_repo}" \
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/run-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ undo_changes() {

if [ $step_bootstrap_env -eq 1 ]; then
echo "::info:: Undo the bootstrap"
run 5m ansible-playbook -i localhost, -c local --tags undo ansible/main.yaml || true
run 5m sudo -E ansible-playbook -i localhost, -c local --tags undo ansible/main.yaml || true
fi
popd >/dev/null
}
Expand Down Expand Up @@ -102,7 +102,7 @@ main() {
pushd "$script_dir" >/dev/null
echo "::info:: Bootstrap the local machine"
step_bootstrap_env=1
run 10m ansible-playbook -i localhost, -c local --tags untagged ansible/main.yaml
run 10m sudo -E ansible-playbook -i localhost, -c local --tags untagged ansible/main.yaml

echo "::info:: Bring up the test cluster"
step_start_cluster=1
Expand Down

0 comments on commit 550c956

Please sign in to comment.