-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Adrian Riobo Lorenzo <[email protected]>
- Loading branch information
1 parent
f6be286
commit 03e15cd
Showing
18 changed files
with
1,009 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Changelog | ||
|
||
## 1.0.0 | ||
|
||
* Initial version for managinig 2 types of builders | ||
* linux multi arch container based | ||
* windows and mac build on remote target | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# CRC Builder | ||
|
||
## Modifications to the image | ||
|
||
Changes to `crc-builder/os/macos/builder/build.sh` require re-building and pushing the image to internal registry (ImageStream). Make sure the changes are pushed to some `mybranch` on your fork of the QE platform repo (`github.com/<your-username>/qe-platform`). Since the `crc-builder/manifests/buildconfig.yaml` will be guiding the build of the image, it needs to specify your branch on your fork as the source. | ||
|
||
```diff | ||
source: | ||
contextDir: support/images/crc-builder | ||
git: | ||
# dev | ||
+ ref: 'mybranch' | ||
+ uri: 'https://gitlab.cee.redhat.com/<your-username>/qe-platform.git' | ||
- ref: v2.14.0 | ||
- uri: 'https://gitlab.cee.redhat.com/crc/qe-platform.git' | ||
type: Git | ||
``` | ||
|
||
Log in to `codeready-container` project, apply the changes in `crc-builder/manifests/buildconfig.yaml` and start the build from the corresponding `BuildConfig` (depending on the platform). | ||
|
||
```bash | ||
oc apply -f support/images/crc-builder/manifests/buildconfig.yaml | ||
oc start-build image-crc-builder-<platform> | ||
``` | ||
|
||
Lastly, make sure that `imagePullPolicy` is set to `Always` in all places that use this imageStreamTag (e.g. `crc-builder:v0.0.3-macos`). In our case, we needed to change and re-apply the following YAML. | ||
|
||
```bash | ||
oc apply -f orchestrator/catalog/task/crc-builder-installer/0.3/crc-builder-installer.yaml | ||
``` | ||
|
||
Then undo changes to `crc-builder/manifests/buildconfig.yaml` so it points to the upstream repository. | ||
|
||
_If everything works as expected, send an MR to `gitlab.cee.redhat.com/crc/qe-platform`._ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#8.10 | ||
FROM --platform=$TARGETPLATFORM quay.io/almalinuxorg/8-minimal@sha256:6c50656775e5971f7fb5e0d0d5b17f246873408a67b571ef720b7c1324118433 | ||
|
||
ARG TARGETARCH | ||
|
||
LABEL org.opencontainers.image.authors="CodeReady Containers <[email protected]>" | ||
|
||
ENV GO_VERSION 1.21.11 | ||
|
||
RUN microdnf -y install git make gcc libvirt-devel perl-Digest-SHA xz findutils diffutils tar \ | ||
&& curl -Lo /tmp/${GO_VERSION}.tar.gz https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz \ | ||
&& tar -xzvf /tmp/${GO_VERSION}.tar.gz -C /usr/lib \ | ||
&& ln -s /usr/lib/go/bin/go /usr/local/bin/go \ | ||
&& curl -k -Lo /usr/local/bin/mc https://dl.min.io/client/mc/release/linux-${TARGETARCH}/mc \ | ||
&& chmod +x /usr/local/bin/mc \ | ||
&& rm /tmp/${GO_VERSION}.tar.gz | ||
|
||
COPY lib/common.sh /usr/local/bin | ||
COPY lib/linux/entrypoint.sh /usr/local/bin/entrypoint.sh | ||
|
||
ENTRYPOINT entrypoint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM registry.access.redhat.com/ubi8/ubi-minimal as preparer | ||
|
||
ARG OS | ||
ENV OS ${OS} | ||
|
||
COPY lib/${OS}/builder/* /usr/local/crc-builder/ | ||
COPY lib/${OS}/entrypoint.sh /usr/local/bin/entrypoint.sh | ||
|
||
RUN cd /usr/local/crc-builder && \ | ||
if [[ ${OS} == 'windows' ]]; then \ | ||
curl -k -LO https://dl.minio.io/client/mc/release/windows-amd64/mc.exe; \ | ||
else \ | ||
curl -k -LO https://dl.min.io/client/mc/release/darwin-amd64/mc; \ | ||
chmod +x mc; \ | ||
fi; | ||
|
||
FROM quay.io/rhqp/support-tools:v0.0.2 | ||
|
||
LABEL org.opencontainers.image.authors="CodeReady Containers <[email protected]>" | ||
|
||
ENV PLATFORM ${PLATFORM} | ||
ENV BUILDER_RESOURCES "/usr/local/crc-builder" | ||
|
||
COPY --from=preparer /usr/local/crc-builder ${BUILDER_RESOURCES} | ||
COPY --from=preparer /usr/local/bin/entrypoint.sh /usr/local/bin | ||
COPY lib/common.sh /usr/local/bin | ||
|
||
ENTRYPOINT entrypoint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/bin/sh | ||
|
||
# Validate required envs are setup to run the container | ||
validate_envs () { | ||
local validate=1 | ||
|
||
[[ -z "${TARGET_HOST+x}" ]] \ | ||
&& echo "TARGET_HOST required" \ | ||
&& validate=0 | ||
|
||
[[ -z "${TARGET_HOST_USERNAME+x}" ]] \ | ||
&& echo "TARGET_HOST_USERNAME required" \ | ||
&& validate=0 | ||
|
||
[[ -z "${TARGET_HOST_KEY_PATH+x}" && -z "${TARGET_HOST_PASSWORD+x}" ]] \ | ||
&& echo "TARGET_HOST_KEY_PATH or TARGET_HOST_PASSWORD required" \ | ||
&& validate=0 | ||
|
||
return $validate | ||
} | ||
|
||
validate_assets_info () { | ||
local validate=1 | ||
|
||
[[ -z "${TRAY_URL+x}" ]] \ | ||
&& echo "TRAY_URL required" \ | ||
&& validate=0 | ||
|
||
return $validate | ||
} | ||
|
||
validate_s3_configuration () { | ||
local validate=1 | ||
|
||
[[ -z "${DATALAKE_URL}" || -z "${DATALAKE_ACCESS_KEY}" || -z "${DATALAKE_SECRET_KEY}" ]] \ | ||
&& echo "s3 credentials are required, binary can not be updaloaded" \ | ||
&& validate=0 | ||
|
||
return $validate | ||
} | ||
|
||
# Define remote connection | ||
remote_connection () { | ||
local remote="${TARGET_HOST_USERNAME}@${TARGET_HOST}" | ||
if [[ ! -z "${TARGET_HOST_DOMAIN+x}" ]]; then | ||
remote="${TARGET_HOST_USERNAME}@${TARGET_HOST_DOMAIN}@${TARGET_HOST}" | ||
fi | ||
echo "${remote}" | ||
} | ||
|
||
# scp connection string | ||
scp_cmd () { | ||
local options='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' | ||
if [[ ! -z "${TARGET_HOST_KEY_PATH+x}" ]]; then | ||
echo "scp -r ${options} -i ${TARGET_HOST_KEY_PATH} " | ||
else | ||
echo "sshpass -p ${TARGET_HOST_PASSWORD} scp -r ${options} " | ||
fi | ||
} | ||
|
||
# ssh connection string | ||
ssh_cmd () { | ||
local options='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' | ||
local connection_string=$(remote_connection) | ||
if [[ ! -z "${TARGET_HOST_KEY_PATH+x}" ]]; then | ||
echo "ssh ${options} -i ${TARGET_HOST_KEY_PATH} ${connection_string}" | ||
else | ||
echo "sshpass -p ${TARGET_HOST_PASSWORD} ssh ${options} ${connection_string}" | ||
fi | ||
} | ||
|
||
upload_path() { | ||
path="distributables/app" | ||
if [[ -z ${CRC_VERSION+x} ]]; then | ||
if [[ ! -z ${PULL_REQUEST+x} ]]; then | ||
echo "${path}/pr-${PULL_REQUEST}" | ||
else | ||
echo "${path}/${REF}" | ||
fi | ||
else | ||
echo "${path}/release/${CRC_VERSION}" | ||
fi | ||
} |
Oops, something went wrong.