======= BOOTSTRAP DOCKERFILE =======>
#
# Copyright (c) 2018-2023 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
#   Red Hat, Inc. - initial API and implementation
#   IBM Corporation - implementation
#

# Builder: check meta.yamls and create index.json
# https://registry.access.redhat.com/ubi8/python-38
FROM registry.access.redhat.com/ubi8/python-38:1-121 as builder
#FROM registry-proxy.engineering.redhat.com/ubi8/python-38:1 as builder
USER 0

ARG BOOTSTRAP=true
ENV BOOTSTRAP=${BOOTSTRAP}
# if not defined or string is null, allow all registries/tags in list_referenced_images
# otherwise restrict to only those space-separated registries/tags; if others found, build will fail
# useful for failing build if quay images in an RC, or wrong devspaces image tag (3.2 in 3.1 build)
ARG ALLOWED_REGISTRIES=""
ENV ALLOWED_REGISTRIES=${ALLOWED_REGISTRIES}
ARG ALLOWED_TAGS=""
ENV ALLOWED_TAGS=${ALLOWED_TAGS}

COPY ./build/dockerfiles/content_sets_rhel8.repo /etc/yum.repos.d/
COPY ./build/dockerfiles/rhel.install.sh /tmp
RUN /tmp/rhel.install.sh && rm -f /tmp/rhel.install.sh

COPY ./build/scripts ./versions.json /build/
COPY ./build/scripts/clone_and_zip.sh /build/build/scripts/
COPY ./VERSION /
COPY ./devfiles /build/devfiles
WORKDIR /build/

RUN ./generate_devworkspace_templates.sh
RUN chmod -R g+rwX /build/resources

# validate devfile content
RUN ./check_referenced_images.sh devfiles --registries "${ALLOWED_REGISTRIES}" --tags "${ALLOWED_TAGS}"
RUN ./check_mandatory_fields.sh devfiles

# Cache projects in DS 
COPY ./build/dockerfiles/rhel.cache_projects.sh /tmp/ 
RUN /tmp/rhel.cache_projects.sh /build/ && rm -rf /tmp/rhel.cache_projects.sh /tmp/resources.tgz 

# don't do swaps, or we end up with missing content if built on s390x or ppc64le worker
# RUN ./swap_yamlfiles.sh devfiles
# RUN ./swap_images.sh devfiles
RUN ./index.sh > /build/devfiles/index.json && \
    ./list_referenced_images.sh devfiles > /build/devfiles/external_images.txt && \
    ./list_referenced_images_by_file.sh devfiles > /build/devfiles/external_images_by_devfile.txt && \
    chmod -R g+rwX /build/devfiles

<======= BOOTSTRAP DOCKERFILE =======
======= START BOOTSTRAP BUILD =======>
STEP 1/23: FROM registry.access.redhat.com/ubi8/python-38:1-121 AS builder
STEP 2/23: USER 0
--> e05622eac17
STEP 3/23: ARG BOOTSTRAP=true
--> 96a6d1c1053
STEP 4/23: ENV BOOTSTRAP=${BOOTSTRAP}
--> 836bbcc9f7b
STEP 5/23: ARG ALLOWED_REGISTRIES=""
--> 8d22a14a133
STEP 6/23: ENV ALLOWED_REGISTRIES=${ALLOWED_REGISTRIES}
--> 75e7b9531b7
STEP 7/23: ARG ALLOWED_TAGS=""
--> 42c09a2700a
STEP 8/23: ENV ALLOWED_TAGS=${ALLOWED_TAGS}
--> df86b8dae0e
STEP 9/23: COPY ./build/dockerfiles/content_sets_rhel8.repo /etc/yum.repos.d/
--> 71cbb54eb2f
STEP 10/23: COPY ./build/dockerfiles/rhel.install.sh /tmp
--> aef9f4610ca
STEP 11/23: RUN /tmp/rhel.install.sh && rm -f /tmp/rhel.install.sh

Installed:
  containers-common-2:1-46.module+el8.7.0+17824+66a0202b.ppc64le                
  criu-3.15-3.module+el8.7.0+17824+66a0202b.ppc64le                             
  fuse-common-3.3.0-16.el8.ppc64le                                              
  fuse-overlayfs-1.9-1.module+el8.7.0+17824+66a0202b.ppc64le                    
  fuse3-3.3.0-16.el8.ppc64le                                                    
  fuse3-libs-3.3.0-16.el8.ppc64le                                               
  iptables-libs-1.8.4-23.el8_7.1.ppc64le                                        
  jansson-2.14-1.el8.ppc64le                                                    
  jq-1.6-3.el8.ppc64le                                                          
  kmod-25-19.el8.ppc64le                                                        
  libibverbs-41.0-1.el8.ppc64le                                                 
  libmnl-1.0.4-6.el8.ppc64le                                                    
  libnet-1.1.6-15.el8.ppc64le                                                   
  libnftnl-1.1.5-5.el8.ppc64le                                                  
  libpcap-14:1.9.1-5.el8.ppc64le                                                
  libslirp-4.4.0-1.module+el8.7.0+17824+66a0202b.ppc64le                        
  nftables-1:0.9.3-26.el8.ppc64le                                               
  oniguruma-6.8.2-2.el8.ppc64le                                                 
  protobuf-c-1.3.0-6.el8.ppc64le                                                
  runc-1:1.1.4-1.module+el8.7.0+17824+66a0202b.ppc64le                          
  skopeo-2:1.9.4-0.1.module+el8.7.0+17824+66a0202b.ppc64le                      
  slirp4netns-1.2.0-2.module+el8.7.0+17824+66a0202b.ppc64le                     

Collecting yq
  Downloading https://files.pythonhosted.org/packages/aa/09/31d9eb047a46cf5680c4970f42bee931bd78aab4e3ded448406de4730f96/yq-3.1.1-py3-none-any.whl
Collecting argcomplete
  Downloading https://files.pythonhosted.org/packages/d9/40/13aea82bbe95c0f9f3c4ba21bdaf3ff12f405353b640d347cda55a23778a/argcomplete-2.1.1-py3-none-any.whl
Collecting toml>=0.10.0
  Downloading https://files.pythonhosted.org/packages/44/6f/7120676b6d73228c96e17f1f794d8ab046fc910d781c8d151120c3f1569e/toml-0.10.2-py2.py3-none-any.whl
Collecting PyYAML>=5.3.1
  Downloading https://files.pythonhosted.org/packages/36/2b/61d51a2c4f25ef062ae3f74576b01638bebad5e045f747ff12643df63844/PyYAML-6.0.tar.gz (124kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
    Preparing wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Collecting xmltodict>=0.11.0
  Downloading https://files.pythonhosted.org/packages/94/db/fd0326e331726f07ff7f40675cd86aa804bfd2e5016c727fa761c934990e/xmltodict-0.13.0-py2.py3-none-any.whl
Building wheels for collected packages: PyYAML
  Building wheel for PyYAML (PEP 517): started
  Building wheel for PyYAML (PEP 517): finished with status 'done'
  Created wheel for PyYAML: filename=PyYAML-6.0-cp38-cp38-linux_ppc64le.whl size=45334 sha256=0f1e357869d85498ca662b1000bb3b5ec47d977cfc10a7f6ad5c9d36546b6b43
  Stored in directory: /tmp/pip-ephem-wheel-cache-wi80y2sf/wheels/95/84/67/ebeac632c63797cfbeb90128ca41073117721540dad526d213
Successfully built PyYAML
Installing collected packages: toml, PyYAML, xmltodict, argcomplete, yq
Successfully installed PyYAML-6.0 argcomplete-2.1.1 toml-0.10.2 xmltodict-0.13.0 yq-3.1.1
python: Python 3.8.13
yq: yq 3.1.1
jq: jq-1.6
--> dca2c2782e3
STEP 12/23: COPY ./build/scripts ./versions.json /build/
--> a832ed4ec63
STEP 13/23: COPY ./build/scripts/clone_and_zip.sh /build/build/scripts/
--> 6c169eb7d49
STEP 14/23: COPY ./VERSION /
--> a0a76e0a82b
STEP 15/23: COPY ./devfiles /build/devfiles
--> 07152a79851
STEP 16/23: WORKDIR /build/
--> 1f7694793a1
STEP 17/23: RUN ./generate_devworkspace_templates.sh

> core-js@2.6.12 postinstall /build/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

[96mThank you for using core-js ([94m https://github.com/zloirock/core-js [96m) for polyfilling JavaScript standard library![0m

[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: [0m
[96m>[94m https://opencollective.com/core-js [0m
[96m>[94m https://www.patreon.com/zloirock [0m

[96mAlso, the author of core-js ([94m https://github.com/zloirock [96m) is looking for a good job -)[0m

+ @eclipse-che/che-devworkspace-generator@0.0.1-c8bd5c0
added 119 packages from 183 contributors and audited 119 packages in 8.556s

5 packages are looking for funding
  run `npm fund` for details

found 1 high severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
DevWorkspace che-theia-java-lombok was generated.
DevWorkspace che-code-java-lombok was generated.
DevWorkspace che-code-java-lombok was generated.
DevWorkspace che-idea-java-lombok was generated.
DevWorkspace che-theia-quarkus-quickstart was generated.
DevWorkspace che-code-quarkus-quickstart was generated.
DevWorkspace che-code-quarkus-quickstart was generated.
DevWorkspace che-idea-quarkus-quickstart was generated.
DevWorkspace che-theia-nodejs-mongodb was generated.
DevWorkspace che-code-nodejs-mongodb was generated.
DevWorkspace che-code-nodejs-mongodb was generated.
DevWorkspace che-idea-nodejs-mongodb was generated.
DevWorkspace che-theia-nodejs-web-app was generated.
DevWorkspace che-code-nodejs-web-app was generated.
DevWorkspace che-code-nodejs-web-app was generated.
DevWorkspace che-idea-nodejs-web-app was generated.
DevWorkspace che-theia-python-hello-world was generated.
DevWorkspace che-code-python-hello-world was generated.
DevWorkspace che-code-python-hello-world was generated.
DevWorkspace che-idea-python-hello-world was generated.
DevWorkspace che-theia-cpp was generated.
DevWorkspace che-code-cpp was generated.
DevWorkspace che-code-cpp was generated.
DevWorkspace che-idea-cpp was generated.
DevWorkspace che-theia-dotnet was generated.
DevWorkspace che-code-dotnet was generated.
DevWorkspace che-code-dotnet was generated.
DevWorkspace che-idea-dotnet was generated.
DevWorkspace che-theia-golang was generated.
DevWorkspace che-code-golang was generated.
DevWorkspace che-code-golang was generated.
DevWorkspace che-idea-golang was generated.
DevWorkspace che-theia-php-hello-world was generated.
DevWorkspace che-code-php-hello-world was generated.
DevWorkspace che-code-php-hello-world was generated.
DevWorkspace che-idea-php-hello-world was generated.
--> 77351dff1ae
STEP 18/23: RUN chmod -R g+rwX /build/resources
--> 84ec154de28
STEP 19/23: RUN ./check_referenced_images.sh devfiles --registries "${ALLOWED_REGISTRIES}" --tags "${ALLOWED_TAGS}"
 + registry.redhat.io/devspaces/code-rhel8:3.5 PASS - registry.redhat.io allowed
 + registry.redhat.io/devspaces/idea-rhel8:3.5 PASS - registry.redhat.io allowed
 + registry.redhat.io/devspaces/machineexec-rhel8:3.5 PASS - registry.redhat.io allowed
 + registry.redhat.io/devspaces/theia-endpoint-rhel8:3.5 PASS - registry.redhat.io allowed
 + registry.redhat.io/devspaces/theia-rhel8:3.5 PASS - registry.redhat.io allowed
 + registry.redhat.io/devspaces/udi-rhel8:3.5 PASS - registry.redhat.io allowed
 + registry.redhat.io/rhscl/mongodb-36-rhel7:1-50 PASS - registry.redhat.io allowed
 + registry.redhat.io/devspaces/code-rhel8:3.5 PASS - 3.5 allowed
 + registry.redhat.io/devspaces/idea-rhel8:3.5 PASS - 3.5 allowed
 + registry.redhat.io/devspaces/machineexec-rhel8:3.5 PASS - 3.5 allowed
 + registry.redhat.io/devspaces/theia-endpoint-rhel8:3.5 PASS - 3.5 allowed
 + registry.redhat.io/devspaces/theia-rhel8:3.5 PASS - 3.5 allowed
 + registry.redhat.io/devspaces/udi-rhel8:3.5 PASS - 3.5 allowed
 = registry.redhat.io/rhscl/mongodb-36-rhel7:1-50 PASS
--> 8df3514ff7c
STEP 20/23: RUN ./check_mandatory_fields.sh devfiles
Checking devfile 'devfiles/TP__cpp__c-plus-plus/meta.yaml'
Checking devfile 'devfiles/TP__dotnet__dotnet-web-simple/meta.yaml'
Checking devfile 'devfiles/TP__go__golang-health-check/meta.yaml'
Checking devfile 'devfiles/TP__php__php-hello-world/meta.yaml'
Checking devfile 'devfiles/java11-maven-lombok__lombok-project-sample/meta.yaml'
Checking devfile 'devfiles/java11-maven-quarkus__quarkus-quickstarts/meta.yaml'
Checking devfile 'devfiles/nodejs__nodejs-mongodb-sample/meta.yaml'
Checking devfile 'devfiles/nodejs__web-nodejs-sample/meta.yaml'
Checking devfile 'devfiles/python__python-hello-world/meta.yaml'
--> 0952c252a26
STEP 21/23: COPY ./build/dockerfiles/rhel.cache_projects.sh /tmp/ 
--> 4e6fea2880f
STEP 22/23: RUN /tmp/rhel.cache_projects.sh /build/ && rm -rf /tmp/rhel.cache_projects.sh /tmp/resources.tgz 
--> 38a3b4b47ea
STEP 23/23: RUN ./index.sh > /build/devfiles/index.json &&     ./list_referenced_images.sh devfiles > /build/devfiles/external_images.txt &&     ./list_referenced_images_by_file.sh devfiles > /build/devfiles/external_images_by_devfile.txt &&     chmod -R g+rwX /build/devfiles
COMMIT devfileregistry:tmp
--> 628b60f012e
Successfully tagged localhost/devfileregistry:tmp
628b60f012ec9e04c1b3be78574eccea2a5abf83cbaba47e838fc4d043582cad
<======= END BOOTSTRAP BUILD =======
Downloading root-local.tgz
Downloading resources.tgz
DIFF START *****
diff --suppress-common-lines -u -r -x '*.pyc' -x installed-files.txt /tmp/tmp.k3GRmKU7jK/lib/python3.8/site-packages/PyYAML-6.0.dist-info/METADATA /tmp/tmp.k4rlWVklBz/lib/python3.8/site-packages/PyYAML-6.0.dist-info/METADATA
--- /tmp/tmp.k3GRmKU7jK/lib/python3.8/site-packages/PyYAML-6.0.dist-info/METADATA	2023-03-16 16:25:30.000000000 +0000
+++ /tmp/tmp.k4rlWVklBz/lib/python3.8/site-packages/PyYAML-6.0.dist-info/METADATA	2023-03-16 18:46:55.672539429 +0000
@@ -3,10 +3,10 @@
 Version: 6.0
 Summary: YAML parser and emitter for Python
 Home-page: https://pyyaml.org/
+Download-URL: https://pypi.org/project/PyYAML/
 Author: Kirill Simonov
 Author-email: xi@resolvent.net
 License: MIT
-Download-URL: https://pypi.org/project/PyYAML/
 Project-URL: Bug Tracker, https://github.com/yaml/pyyaml/issues
 Project-URL: CI, https://github.com/yaml/pyyaml/actions
 Project-URL: Documentation, https://pyyaml.org/wiki/PyYAMLDocumentation
@@ -43,4 +43,3 @@
 
 PyYAML is applicable for a broad range of tasks from complex
 configuration files to object serialization and persistence.
-
diff --suppress-common-lines -u -r -x '*.pyc' -x installed-files.txt /tmp/tmp.k3GRmKU7jK/lib/python3.8/site-packages/PyYAML-6.0.dist-info/RECORD /tmp/tmp.k4rlWVklBz/lib/python3.8/site-packages/PyYAML-6.0.dist-info/RECORD
--- /tmp/tmp.k3GRmKU7jK/lib/python3.8/site-packages/PyYAML-6.0.dist-info/RECORD	2023-03-16 16:25:30.000000000 +0000
+++ /tmp/tmp.k4rlWVklBz/lib/python3.8/site-packages/PyYAML-6.0.dist-info/RECORD	2023-03-16 18:46:55.672539429 +0000
@@ -1,8 +1,8 @@
 PyYAML-6.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
 PyYAML-6.0.dist-info/LICENSE,sha256=jTko-dxEkP1jVwfLiOsmvXZBAqcoKVQwfT5RZ6V36KQ,1101
-PyYAML-6.0.dist-info/METADATA,sha256=QmHx9kGp_0yezQCXYaft4eEFeJ6W4oyFfYwHDLP1kdg,2006
+PyYAML-6.0.dist-info/METADATA,sha256=Q56A1jQxEnzMMCyqgYkqM5Egvr9y18VExGF3ciGLjlY,2005
 PyYAML-6.0.dist-info/RECORD,,
-PyYAML-6.0.dist-info/WHEEL,sha256=RiwktpmF40OphKd3_aIG01PzIOQlJ7dpBn3cFSc9vak,217
+PyYAML-6.0.dist-info/WHEEL,sha256=q64M4lAWOr6eqbs0L0fvZKS87xBNWz2Lb7YBpE1K7J4,104
 PyYAML-6.0.dist-info/top_level.txt,sha256=rpj0IVMTisAjh_1vG3Ccf9v5jpCQwAz6cD1IVU5ZdhQ,11
 _yaml/__init__.py,sha256=04Ae_5osxahpJHa3XBZUAf4wi6XX32gR8D6X6p64GEA,1402
 _yaml/__pycache__/__init__.cpython-38.pyc,,
@@ -24,7 +24,6 @@
 yaml/__pycache__/scanner.cpython-38.pyc,,
 yaml/__pycache__/serializer.cpython-38.pyc,,
 yaml/__pycache__/tokens.cpython-38.pyc,,
-yaml/_yaml.cpython-38-x86_64-linux-gnu.so,sha256=lMaKSmQZy3WNZSmmU0Wg5Y5ZAs-HR5vItyGVUIsp8Rg,2847784
 yaml/composer.py,sha256=_Ko30Wr6eDWUeUpauUGT3Lcg9QPBnOPVlTnIMRGJ9FM,4883
 yaml/constructor.py,sha256=kNgkfaeLUkwQYY_Q6Ff1Tz2XVw_pG1xVE9Ak7z-viLA,28639
 yaml/cyaml.py,sha256=6ZrAG9fAYvdVe2FK_w0hmXoG7ZYsoYUwapG8CiC72H0,3851
diff --suppress-common-lines -u -r -x '*.pyc' -x installed-files.txt /tmp/tmp.k3GRmKU7jK/lib/python3.8/site-packages/PyYAML-6.0.dist-info/WHEEL /tmp/tmp.k4rlWVklBz/lib/python3.8/site-packages/PyYAML-6.0.dist-info/WHEEL
--- /tmp/tmp.k3GRmKU7jK/lib/python3.8/site-packages/PyYAML-6.0.dist-info/WHEEL	2023-03-16 16:25:30.000000000 +0000
+++ /tmp/tmp.k4rlWVklBz/lib/python3.8/site-packages/PyYAML-6.0.dist-info/WHEEL	2023-03-16 18:46:55.672539429 +0000
@@ -1,8 +1,5 @@
 Wheel-Version: 1.0
-Generator: bdist_wheel (0.37.0)
+Generator: bdist_wheel (0.40.0)
 Root-Is-Purelib: false
-Tag: cp38-cp38-manylinux_2_5_x86_64
-Tag: cp38-cp38-manylinux1_x86_64
-Tag: cp38-cp38-manylinux_2_12_x86_64
-Tag: cp38-cp38-manylinux2010_x86_64
+Tag: cp38-cp38-linux_ppc64le
 
Only in /tmp/tmp.k3GRmKU7jK/lib/python3.8/site-packages/yaml: _yaml.cpython-38-x86_64-linux-gnu.so
***** END DIFF
Untagged: localhost/devfileregistry:tmp
Deleted: 628b60f012ec9e04c1b3be78574eccea2a5abf83cbaba47e838fc4d043582cad
Deleted: 38a3b4b47ea3bb373e85167b94d1992980b865bcc04f276bca820d6ac89a57f6
Deleted: 4e6fea2880ff1de9e1f5d367ea4dd1f84cbd19bca94fa2d3581e29420f70a062
Deleted: 0952c252a26e7e17278f0cd320f72f8892880dbcd7d6d70eaad8c48a5be43731
Deleted: 8df3514ff7c31b0fd66b7288595d952951731c8e26e8ff56f2c0c26791de542a
Deleted: 84ec154de28ae326ffb910cf8d2acf86a644c9c44eeddd4f5f2cc77556887b8b
Deleted: 77351dff1ae0702e3657f184810c2b67b92991bd580b478bce722e6f342c8e9f
Deleted: 1f7694793a11959e86e11c0c981b8d84e0b3a4653db853cdc10f282b3e1bef92
Deleted: 07152a798517c625085fe08bb69068d9576ed2ed8fa7ffa0c409563c104a44ca
Deleted: a0a76e0a82b3c38c644aad67739338d409cd11141da8263bd53e4f27cbebf0be
Deleted: 6c169eb7d49f3b60cf2f83b85c4206e828a3aeb17f2283674644552aa38a2867
Deleted: a832ed4ec6390230625c3d2971b8ca08d6bb1241c4a4919aff87a2649f1596c9
Deleted: dca2c2782e3ddec6523d10449a9d0ea8ef1f703fcbb7858c6cb540eac5065942
Deleted: aef9f4610ca48c216978628fb1c8bd6a4b4f8574f335d6d1a6791ccab1c08286
Deleted: 71cbb54eb2fd93995d6b8283939e7087e55c690326827eb255d739bf9f04c258
Deleted: df86b8dae0ecfe7f9cf656d662267c3608c4fba538de3df7c8b8071d985e45f8
Deleted: 42c09a2700ae46840b9a9d7da885c1e851a8c3b70a297139ef418851952a5504
Deleted: 75e7b9531b7fdef8083e6adaf3c5ddb3bd16a6e24ba0b9b538560e8cce6f0bf7
Deleted: 8d22a14a1330e1df70a55c1cc19e8f371098dbf5511fb4f93ba8c9b5df2297c7
Deleted: 836bbcc9f7be988808e072b92b46d39c70e988eadb5375609428adb62c86dcd1
Deleted: 96a6d1c1053f57ca3d8e58607377e41125bd1579988891fb9acacc333e84b88a
Deleted: e05622eac17005480036e2a4722a7d2eab3b1142059564c8353497acd5560602
Uploading: root-local.tgz
File already uploaded: resources.tgz
Source upload succeeded. Don't forget to commit the sources file
rm 'resources.tgz'
rm 'root-local.tgz'
