Skip to content

Commit

Permalink
Merge branch 'devfile:main' into multi-arch-release
Browse files Browse the repository at this point in the history
  • Loading branch information
AObuchow authored Jan 12, 2024
2 parents 27f43f0 + 1cfdf68 commit 762eeba
Show file tree
Hide file tree
Showing 252 changed files with 504 additions and 339 deletions.
2 changes: 1 addition & 1 deletion .ci/common.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2019-2023 Red Hat, Inc.
# Copyright (c) 2019-2024 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion .ci/oci-devworkspace-happy-path.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2019-2023 Red Hat, Inc.
# Copyright (c) 2019-2024 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion .ci/oci.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2023 Red Hat, Inc.
# Copyright (c) 2019-2024 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion .ci/openshift_e2e.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2019-2023 Red Hat, Inc.
# Copyright (c) 2019-2024 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Global Owners
* @amisevsk @AObuchow @l0rd
* @amisevsk @AObuchow @ibuziuk
2 changes: 1 addition & 1 deletion .github/workflows/devtools-image-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2023 Red Hat, Inc.
# Copyright (c) 2019-2024 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/next-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2023 Red Hat, Inc.
# Copyright (c) 2019-2024 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down Expand Up @@ -31,6 +31,12 @@ jobs:
git-sha: ${{ steps.git-sha.outputs.sha }}

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Checkout devworkspace-operator source code
uses: actions/checkout@v3

Expand All @@ -50,6 +56,7 @@ jobs:
with:
context: .
push: true
platforms: linux/amd64, linux/arm64, linux/ppc64le, linux/s390x
tags: |
quay.io/devfile/devworkspace-controller:next
quay.io/devfile/devworkspace-controller:sha-${{ steps.git-sha.outputs.sha }}
Expand All @@ -60,6 +67,7 @@ jobs:
with:
context: .
push: true
platforms: linux/amd64, linux/arm64, linux/ppc64le, linux/s390x
tags: |
quay.io/devfile/project-clone:next
quay.io/devfile/project-clone:sha-${{ steps.git-sha.outputs.sha }}
Expand Down Expand Up @@ -175,6 +183,7 @@ jobs:
--bundle-tag ${DWO_BUNDLE_TAG} \
--index-image ${DWO_INDEX_IMG} \
--container-tool docker \
--multi-arch \
--debug \
--force
Expand All @@ -185,11 +194,13 @@ jobs:
--render ./olm-catalog/next-digest/ \
--push "${DWO_BUNDLE_REPO}:${DWO_DIGEST_BUNDLE_TAG}" \
--container-tool docker \
--multi-arch \
--debug
cp ./olm-catalog/next/{channel,package}.yaml ./olm-catalog/next-digest
docker build . -t ${DWO_DIGEST_INDEX_IMG} -f build/index.next-digest.Dockerfile
docker push ${DWO_DIGEST_INDEX_IMG}
docker buildx build . -t ${DWO_DIGEST_INDEX_IMG} -f build/index.next-digest.Dockerfile \
--platform linux/amd64,linux/arm64,linux/ppc64le,linux/s390x \
--push
git restore ./olm-catalog/
git clean -fd ./olm-catalog/
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019-2023 Red Hat, Inc.
# Copyright (c) 2019-2024 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 2 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
reviewers:
- amisevsk
- AObuchow
approvers:
- amisevsk
- AObuchow
component: DevWorkspace Operator
2 changes: 1 addition & 1 deletion apis/controller/v1alpha1/attributes.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Red Hat, Inc.
// Copyright (c) 2019-2024 Red Hat, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion apis/controller/v1alpha1/common.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2019-2023 Red Hat, Inc.
// Copyright (c) 2019-2024 Red Hat, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion apis/controller/v1alpha1/devfile.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2019-2023 Red Hat, Inc.
// Copyright (c) 2019-2024 Red Hat, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2019-2023 Red Hat, Inc.
// Copyright (c) 2019-2024 Red Hat, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion apis/controller/v1alpha1/devworkspacerouting_types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2019-2023 Red Hat, Inc.
// Copyright (c) 2019-2024 Red Hat, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion apis/controller/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2019-2023 Red Hat, Inc.
// Copyright (c) 2019-2024 Red Hat, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion apis/controller/v1alpha1/errors.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Red Hat, Inc.
// Copyright (c) 2019-2024 Red Hat, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion apis/controller/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2019-2023 Red Hat, Inc.
// Copyright (c) 2019-2024 Red Hat, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion apis/controller/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2023 Red Hat, Inc.
# Copyright (c) 2019-2024 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 2 additions & 0 deletions build/buildkitd.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[worker.oci]
max-parallelism = 1
2 changes: 1 addition & 1 deletion build/devtools.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2023 Red Hat, Inc.
# Copyright (c) 2019-2024 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion build/make/olm.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2023 Red Hat, Inc.
# Copyright (c) 2019-2024 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
35 changes: 31 additions & 4 deletions build/scripts/build_digests_bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
set -eo pipefail

PODMAN=podman
MULTI_ARCH="false"
ARCHITECTURES="linux/amd64,linux/arm64,linux/ppc64le,linux/s390x"
SCRIPT_DIR=$(cd "$(dirname "$0")" || exit; pwd)

DEFAULT_BUILDER_NAME="dwo-multi-platform-builder"

usage() {
cat <<EOF
This script converts a operator bundle image that may have images referred to by
Expand All @@ -20,6 +24,8 @@ Arguments:
--push <IMAGE> : Push processed digests bundle to <IMAGE> (required). Pushing the bundle image to a
repository is required because opm render works from a remote repository.
--container-tool <TOOL> : Use specific container tool for building/pushing images (default: use podman).
--multi-arch : Create images for the following architectures: $ARCHITECTURES. Note: Docker buildx will be
used for building and pushing the images, instead of the container tool selected with --container-tool.
--debug, -d : Print debug information.
--help, -h : Show this message.
EOF
Expand Down Expand Up @@ -51,6 +57,7 @@ parse_args() {
'--render') RENDER="$2"; shift;;
'--push') PUSH_IMAGE="$2"; shift;;
'--container-tool') PODMAN="$2"; shift;;
'--multi-arch') MULTI_ARCH="true";;
'-d'|'--debug') DEBUG="true";;
'-h'|'--help') usage; exit 0;;
*) error "Unknown parameter is used: $1."; usage; exit 1;;
Expand Down Expand Up @@ -81,6 +88,19 @@ preflight() {
parse_args "$@"
preflight

if [ "$MULTI_ARCH" == "true" ]; then
# Create a multi-arch builder if one doesn't already exist
BUILDER_EXISTS=0
docker buildx use "$DEFAULT_BUILDER_NAME" || BUILDER_EXISTS=$?

if [ $BUILDER_EXISTS -eq 0 ]; then
echo "Using $DEFAULT_BUILDER_NAME for build"
else
echo "Setting up Docker buildx builder:"
docker buildx create --name "$DEFAULT_BUILDER_NAME" --driver docker-container --config build/buildkitd.toml --use
fi
fi

# Work in a temporary directory
TMPDIR="$(mktemp -d)"
info "Working in $TMPDIR"
Expand Down Expand Up @@ -125,10 +145,17 @@ if [ "$DEBUG" == true ]; then
cat "${PROCESSED_DIR}/bundle.Dockerfile" | sed 's|^| |g'
fi

info "Building bundle $PUSH_IMAGE"
$PODMAN build -t "$PUSH_IMAGE" -f "${PROCESSED_DIR}/bundle.Dockerfile" "$PROCESSED_DIR" | sed 's|^| |g'
info "Pushing bundle $PUSH_IMAGE"
$PODMAN push "$PUSH_IMAGE" 2>&1 | sed 's|^| |g'
if [ "$MULTI_ARCH" == "true" ]; then
info "Building and pushing bundle $PUSH_IMAGE"
docker buildx build -t "$PUSH_IMAGE" -f "${PROCESSED_DIR}/bundle.Dockerfile" "$PROCESSED_DIR" \
--platform "$ARCHITECTURES" \
--push 2>&1 | sed 's|^| |g'
else
info "Building bundle $PUSH_IMAGE"
$PODMAN build -t "$PUSH_IMAGE" -f "${PROCESSED_DIR}/bundle.Dockerfile" "$PROCESSED_DIR" | sed 's|^| |g'
info "Pushing bundle $PUSH_IMAGE"
$PODMAN push "$PUSH_IMAGE" 2>&1 | sed 's|^| |g'
fi

NEW_BUNDLE_SHA=$(skopeo inspect "docker://${PUSH_IMAGE}" | jq -r '.Digest')
NEW_BUNDLE_DIGEST="${PUSH_IMAGE%%:*}@${NEW_BUNDLE_SHA}"
Expand Down
42 changes: 38 additions & 4 deletions build/scripts/build_index_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ set -e

PODMAN=podman
FORCE="false"
MULTI_ARCH="false"
ARCHITECTURES="linux/amd64,linux/arm64,linux/ppc64le,linux/s390x"
DEBUG="false"

DEFAULT_BUNDLE_REPO="quay.io/devfile/devworkspace-operator-bundle"
DEFAULT_BUNDLE_TAG="next"
DEFAULT_INDEX_IMAGE="quay.io/devfile/devworkspace-operator-index:next"
DEFAULT_RELEASE_INDEX_IMAGE="quay.io/devfile/devworkspace-operator-index:release"
DEFAULT_BUILDER_NAME="dwo-multi-platform-builder"

error() {
echo "[ERROR] $1"
Expand All @@ -36,6 +39,9 @@ Arguments:
--container-tool <TOOL> : Use specific container tool for building/pushing images (default: use podman)
--force : Do not prompt for confirmation if pushing to default repos. Intended for
use in CI.
--multi-arch : Create images for the following architectures: $ARCHITECTURES. Note: Docker
buildx will be used for building and pushing the images, instead of
the container tool selected with --container-tool.
--debug : Don't do any normal cleanup on exit, leaving repo in dirty state
Examples:
Expand All @@ -56,6 +62,7 @@ parse_args() {
'--container-tool') PODMAN="$2"; shift 1;;
'--release') RELEASE="true";;
'--force') FORCE="true";;
'--multi-arch') MULTI_ARCH="true";;
'--debug') DEBUG="true";;
*) echo "[ERROR] Unknown parameter is used: $1."; usage; exit 1;;
esac
Expand All @@ -65,6 +72,19 @@ parse_args() {

parse_args "$@"

if [ "$MULTI_ARCH" == "true" ]; then
# Create a multi-arch builder if one doesn't already exist
BUILDER_EXISTS=0
docker buildx use "$DEFAULT_BUILDER_NAME" || BUILDER_EXISTS=$?

if [ $BUILDER_EXISTS -eq 0 ]; then
echo "Using $DEFAULT_BUILDER_NAME for build"
else
echo "Setting up Docker buildx builder:"
docker buildx create --name "$DEFAULT_BUILDER_NAME" --driver docker-container --config build/buildkitd.toml --use
fi
fi

if [ "$RELEASE" == "true" ]; then
# Set up for release and check arguments
BUNDLE_REPO="${BUNDLE_REPO:-DEFAULT_BUNDLE_REPO}"
Expand Down Expand Up @@ -118,8 +138,15 @@ fi
make generate_olm_bundle_yaml

echo "Building bundle image $BUNDLE_IMAGE"
$PODMAN build . -t "$BUNDLE_IMAGE" -f build/bundle.Dockerfile
$PODMAN push "$BUNDLE_IMAGE" 2>&1
if [ "$MULTI_ARCH" == "true" ]; then
docker buildx build . -t "$BUNDLE_IMAGE" -f build/bundle.Dockerfile \
--platform "$ARCHITECTURES" \
--push
else
$PODMAN build . -t "$BUNDLE_IMAGE" -f build/bundle.Dockerfile
$PODMAN push "$BUNDLE_IMAGE" 2>&1
fi


BUNDLE_SHA=$(skopeo inspect "docker://${BUNDLE_IMAGE}" | jq -r '.Digest')
BUNDLE_DIGEST="${BUNDLE_REPO}@${BUNDLE_SHA}"
Expand Down Expand Up @@ -177,8 +204,15 @@ opm validate "$OUTDIR"

# Build index container
echo "Building index image $INDEX_IMAGE"
$PODMAN build . -t "$INDEX_IMAGE" -f "$DOCKERFILE"
$PODMAN push "$INDEX_IMAGE" 2>&1
if [ "$MULTI_ARCH" == "true" ]; then
docker buildx build . -t "$INDEX_IMAGE" -f "$DOCKERFILE" \
--platform "$ARCHITECTURES" \
--push
else
$PODMAN build . -t "$INDEX_IMAGE" -f "$DOCKERFILE"
$PODMAN push "$INDEX_IMAGE" 2>&1
fi


if [ $DEBUG != "true" ] && [ "$RELEASE" != "true" ]; then
echo "Cleaning up"
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/generate_deployment.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2019-2023 Red Hat, Inc.
# Copyright (c) 2019-2024 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Red Hat, Inc.
// Copyright (c) 2019-2024 Red Hat, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2019-2023 Red Hat, Inc.
// Copyright (c) 2019-2024 Red Hat, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Red Hat, Inc.
// Copyright (c) 2019-2024 Red Hat, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion controllers/controller/devworkspacerouting/predicates.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2019-2023 Red Hat, Inc.
// Copyright (c) 2019-2024 Red Hat, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
Loading

0 comments on commit 762eeba

Please sign in to comment.