Skip to content

Commit 884e176

Browse files
committed
qwer
1 parent eb02342 commit 884e176

File tree

3 files changed

+201
-16
lines changed

3 files changed

+201
-16
lines changed

.tekton/jupyter-minimal-ubi9-python-3-11-pull-request.yaml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,99 @@ spec:
598598
operator: in
599599
values:
600600
- "false"
601+
- name: check-image-software
602+
params:
603+
- name: IMAGE_URL
604+
value: $(tasks.build-image-index.results.IMAGE_URL)
605+
# - name: PLATFORM
606+
# value: $(tasks.build-image-index.results.IMAGE_URL)
607+
- name: CHAINS-GIT_URL
608+
value: $(tasks.clone-repository.results.url)
609+
- name: CHAINS-GIT_COMMIT
610+
value: $(tasks.clone-repository.results.commit)
611+
- name: COSIGN_VERSION
612+
value: v2.4.3
613+
runAfter:
614+
# - show-sbom
615+
- build-image-index
616+
# taskRef:
617+
# params:
618+
# - name: name
619+
# value: show-sbom
620+
# - name: bundle
621+
# value: quay.io/konflux-ci/tekton-catalog/task-show-sbom:0.1@sha256:04f15cbce548e1db7770eee3f155ccb2cc0140a6c371dc67e9a34d83673ea0c0
622+
# - name: kind
623+
# value: task
624+
# resolver: bundles
625+
taskSpec:
626+
params:
627+
- name: IMAGE_URL
628+
# - name: PLATFORM
629+
- name: CHAINS-GIT_URL
630+
- name: CHAINS-GIT_COMMIT
631+
- name: COSIGN_VERSION
632+
results:
633+
- name: CHECK_OUTPUT
634+
description: Check output
635+
steps:
636+
- name: check-image-software
637+
image: registry.redhat.io/openshift4/ose-cli:latest
638+
env:
639+
- name: IMAGE_URL
640+
value: $(params.IMAGE_URL)
641+
# - name: PLATFORM
642+
# value: $(params.PLATFORM)
643+
- name: GIT_URL
644+
value: $(params.CHAINS-GIT_URL)
645+
- name: GIT_COMMIT
646+
value: $(params.CHAINS-GIT_COMMIT)
647+
- name: COSIGN_VERSION
648+
value: $(params.COSIGN_VERSION)
649+
script: |
650+
#!/bin/bash
651+
echo "Hello world, Stuchy!"
652+
env
653+
wget --output-document=cosign "https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign-linux-amd64"
654+
chmod a+x cosign
655+
656+
dnf install -y jq skopeo
657+
658+
download_sbom_with_retry() {
659+
status=-1
660+
max_try=5
661+
wait_sec=2
662+
663+
PLATFORM_ARG="${1}"
664+
for run in $(seq 1 ${max_try}); do
665+
status=0
666+
./cosign download sbom $PLATFORM_ARG $IMAGE_URL 2>>err
667+
status=$?
668+
if [ "$status" -eq 0 ]; then
669+
break
670+
fi
671+
sleep $wait_sec
672+
done
673+
if [ "$status" -ne 0 ]; then
674+
echo "Failed to get SBOM after ${max_try} tries" >&2
675+
cat err >&2
676+
fi
677+
}
678+
679+
RAW_OUTPUT=$(skopeo inspect --no-tags --raw docker://${IMAGE_URL})
680+
if [ "$(jq 'has("manifests")' <<< "$RAW_OUTPUT")" == "true" ] ; then
681+
# Multi arch
682+
ARCHES=$(jq -r '.manifests[].platform.architecture' <<< $RAW_OUTPUT)
683+
else
684+
ARCHES=""
685+
fi
686+
687+
if [ -z "${ARCHES}" ] ; then
688+
# single arch image
689+
download_sbom_with_retry ""
690+
else
691+
download_sbom_with_retry " --platform=${PLATFORM} "
692+
fi
693+
601694
workspaces:
602695
- name: git-auth
603696
optional: true

.tekton/jupyter-minimal-ubi9-python-3-11-push.yaml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,98 @@ spec:
594594
operator: in
595595
values:
596596
- "false"
597+
- name: check-image-software
598+
params:
599+
- name: IMAGE_URL
600+
value: $(tasks.build-image-index.results.IMAGE_URL)
601+
# - name: PLATFORM
602+
# value: $(tasks.build-image-index.results.IMAGE_URL)
603+
- name: CHAINS-GIT_URL
604+
value: $(tasks.clone-repository.results.url)
605+
- name: CHAINS-GIT_COMMIT
606+
value: $(tasks.clone-repository.results.commit)
607+
- name: COSIGN_VERSION
608+
value: v2.4.3
609+
runAfter:
610+
# - show-sbom
611+
- build-image-index
612+
# taskRef:
613+
# params:
614+
# - name: name
615+
# value: show-sbom
616+
# - name: bundle
617+
# value: quay.io/konflux-ci/tekton-catalog/task-show-sbom:0.1@sha256:04f15cbce548e1db7770eee3f155ccb2cc0140a6c371dc67e9a34d83673ea0c0
618+
# - name: kind
619+
# value: task
620+
# resolver: bundles
621+
taskSpec:
622+
params:
623+
- name: IMAGE_URL
624+
# - name: PLATFORM
625+
- name: CHAINS-GIT_URL
626+
- name: CHAINS-GIT_COMMIT
627+
- name: COSIGN_VERSION
628+
results:
629+
- name: CHECK_OUTPUT
630+
description: Check output
631+
steps:
632+
- name: check-image-software
633+
image: registry.redhat.io/openshift4/ose-cli:latest
634+
env:
635+
- name: IMAGE_URL
636+
value: $(params.IMAGE_URL)
637+
# - name: PLATFORM
638+
# value: $(params.PLATFORM)
639+
- name: GIT_URL
640+
value: $(params.CHAINS-GIT_URL)
641+
- name: GIT_COMMIT
642+
value: $(params.CHAINS-GIT_COMMIT)
643+
- name: COSIGN_VERSION
644+
value: $(params.COSIGN_VERSION)
645+
script: |
646+
#!/bin/bash
647+
echo "Hello world, Stuchy!"
648+
env
649+
wget --output-document=cosign "https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign-linux-amd64"
650+
chmod a+x cosign
651+
652+
dnf install -y jq skopeo
653+
654+
download_sbom_with_retry() {
655+
status=-1
656+
max_try=5
657+
wait_sec=2
658+
659+
PLATFORM_ARG="${1}"
660+
for run in $(seq 1 ${max_try}); do
661+
status=0
662+
./cosign download sbom $PLATFORM_ARG $IMAGE_URL 2>>err
663+
status=$?
664+
if [ "$status" -eq 0 ]; then
665+
break
666+
fi
667+
sleep $wait_sec
668+
done
669+
if [ "$status" -ne 0 ]; then
670+
echo "Failed to get SBOM after ${max_try} tries" >&2
671+
cat err >&2
672+
fi
673+
}
674+
675+
RAW_OUTPUT=$(skopeo inspect --no-tags --raw docker://${IMAGE_URL})
676+
if [ "$(jq 'has("manifests")' <<< "$RAW_OUTPUT")" == "true" ] ; then
677+
# Multi arch
678+
ARCHES=$(jq -r '.manifests[].platform.architecture' <<< $RAW_OUTPUT)
679+
else
680+
ARCHES=""
681+
fi
682+
683+
if [ -z "${ARCHES}" ] ; then
684+
# single arch image
685+
download_sbom_with_retry ""
686+
else
687+
download_sbom_with_retry " --platform=${PLATFORM} "
688+
fi
597689
workspaces:
598690
- name: git-auth
599691
optional: true

jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/oc
2626
####################
2727
# jupyter-minimal #
2828
####################
29-
FROM base AS jupyter-minimal
29+
FROM base AS jupyter-minimal
3030

3131
ARG JUPYTER_REUSABLE_UTILS=jupyter/utils
3232
ARG MINIMAL_SOURCE_CODE=jupyter/minimal/ubi9-python-3.11
@@ -47,20 +47,20 @@ COPY ${JUPYTER_REUSABLE_UTILS} utils/
4747

4848
COPY ${MINIMAL_SOURCE_CODE}/Pipfile.lock ${MINIMAL_SOURCE_CODE}/start-notebook.sh ./
4949

50-
# Install Python dependencies from Pipfile.lock file
51-
RUN echo "Installing softwares and packages" && \
52-
micropipenv install && \
53-
rm -f ./Pipfile.lock && \
54-
# Disable announcement plugin of jupyterlab \
55-
jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \
56-
# Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \
57-
sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \
58-
# Fix permissions to support pip in Openshift environments \
59-
chmod -R g+w /opt/app-root/lib/python3.11/site-packages && \
60-
fix-permissions /opt/app-root -P && \
61-
# Apply JupyterLab addons \
62-
/opt/app-root/bin/utils/addons/apply.sh
63-
50+
# # Install Python dependencies from Pipfile.lock file
51+
# RUN echo "Installing softwares and packages" && \
52+
# micropipenv install && \
53+
# rm -f ./Pipfile.lock && \
54+
# # Disable announcement plugin of jupyterlab \
55+
# jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \
56+
# # Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \
57+
# sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \
58+
# # Fix permissions to support pip in Openshift environments \
59+
# chmod -R g+w /opt/app-root/lib/python3.11/site-packages && \
60+
# fix-permissions /opt/app-root -P && \
61+
# # Apply JupyterLab addons \
62+
# /opt/app-root/bin/utils/addons/apply.sh
63+
6464
WORKDIR /opt/app-root/src
6565

66-
ENTRYPOINT ["start-notebook.sh"]
66+
ENTRYPOINT ["start-notebook.sh"]

0 commit comments

Comments
 (0)