======= 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
--> ed260ba40ff
STEP 3/23: ARG BOOTSTRAP=true
--> d43e6a38a69
STEP 4/23: ENV BOOTSTRAP=${BOOTSTRAP}
--> f64a1aa37be
STEP 5/23: ARG ALLOWED_REGISTRIES=""
--> fccaf840dfd
STEP 6/23: ENV ALLOWED_REGISTRIES=${ALLOWED_REGISTRIES}
--> 500d5d7b866
STEP 7/23: ARG ALLOWED_TAGS=""
--> 28b78aa8ace
STEP 8/23: ENV ALLOWED_TAGS=${ALLOWED_TAGS}
--> a0b7628360a
STEP 9/23: COPY ./build/dockerfiles/content_sets_rhel8.repo /etc/yum.repos.d/
--> 9f2f04c0599
STEP 10/23: COPY ./build/dockerfiles/rhel.install.sh /tmp
--> b1b4b803e33
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=f79e5a33e6fe52263198043a80c34fccc8f4ffee5cd104d5c3ab4798b747b5a3
  Stored in directory: /tmp/pip-ephem-wheel-cache-dkz8i5gq/wheels/95/84/67/ebeac632c63797cfbeb90128ca41073117721540dad526d213
Successfully built PyYAML
Installing collected packages: toml, argcomplete, PyYAML, xmltodict, 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
--> bcb3f9fb35a
STEP 12/23: COPY ./build/scripts ./versions.json /build/
--> a1c78b19821
STEP 13/23: COPY ./build/scripts/clone_and_zip.sh /build/build/scripts/
--> cc37af7c520
STEP 14/23: COPY ./VERSION /
--> b43f4fa03a4
STEP 15/23: COPY ./devfiles /build/devfiles
--> ccf86651bb3
STEP 16/23: WORKDIR /build/
--> 2aee848fd69
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 9.107s

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.
--> bc686813582
STEP 18/23: RUN chmod -R g+rwX /build/resources
--> 845c9fb2efb
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
--> 8dfbbb5229b
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'
--> cc68cc1e71a
STEP 21/23: COPY ./build/dockerfiles/rhel.cache_projects.sh /tmp/ 
--> 7c609395a48
STEP 22/23: RUN /tmp/rhel.cache_projects.sh /build/ && rm -rf /tmp/rhel.cache_projects.sh /tmp/resources.tgz 
--> e0305b2012b
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
--> 7a0671c557d
Successfully tagged localhost/devfileregistry:tmp
7a0671c557db1689f70843f537222a4c323edd94a08228382df751f4132117df
<======= END BOOTSTRAP BUILD =======
Downloading root-local.tgz
Downloading resources.tgz
DIFF START *****
Only in /tmp/tmp.BEMSGq2njr/bin: python-argcomplete-tcsh
Only in /tmp/tmp.BEMSGq2njr/bin: register-python-argcomplete.cmd
Only in /tmp/tmp.BEMSGq2njr/lib/python3.8/site-packages: argcomplete-2.0.6.dist-info
Only in /tmp/tmp.MEuKDrUCml/lib/python3.8/site-packages: argcomplete-2.1.1.dist-info
diff --suppress-common-lines -u -r -x '*.pyc' -x installed-files.txt /tmp/tmp.BEMSGq2njr/lib/python3.8/site-packages/PyYAML-6.0.dist-info/METADATA /tmp/tmp.MEuKDrUCml/lib/python3.8/site-packages/PyYAML-6.0.dist-info/METADATA
--- /tmp/tmp.BEMSGq2njr/lib/python3.8/site-packages/PyYAML-6.0.dist-info/METADATA	2023-03-06 16:45:29.000000000 +0000
+++ /tmp/tmp.MEuKDrUCml/lib/python3.8/site-packages/PyYAML-6.0.dist-info/METADATA	2023-03-15 14:19:28.709187934 +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.BEMSGq2njr/lib/python3.8/site-packages/PyYAML-6.0.dist-info/RECORD /tmp/tmp.MEuKDrUCml/lib/python3.8/site-packages/PyYAML-6.0.dist-info/RECORD
--- /tmp/tmp.BEMSGq2njr/lib/python3.8/site-packages/PyYAML-6.0.dist-info/RECORD	2023-03-06 16:45:29.000000000 +0000
+++ /tmp/tmp.MEuKDrUCml/lib/python3.8/site-packages/PyYAML-6.0.dist-info/RECORD	2023-03-15 14:19:28.709187934 +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.BEMSGq2njr/lib/python3.8/site-packages/PyYAML-6.0.dist-info/WHEEL /tmp/tmp.MEuKDrUCml/lib/python3.8/site-packages/PyYAML-6.0.dist-info/WHEEL
--- /tmp/tmp.BEMSGq2njr/lib/python3.8/site-packages/PyYAML-6.0.dist-info/WHEEL	2023-03-06 16:45:29.000000000 +0000
+++ /tmp/tmp.MEuKDrUCml/lib/python3.8/site-packages/PyYAML-6.0.dist-info/WHEEL	2023-03-15 14:19:28.709187934 +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.BEMSGq2njr/lib/python3.8/site-packages/yaml: _yaml.cpython-38-x86_64-linux-gnu.so
***** END DIFF
Untagged: localhost/devfileregistry:tmp
Deleted: 7a0671c557db1689f70843f537222a4c323edd94a08228382df751f4132117df
Deleted: e0305b2012b97632f36978e46a8e026798610ffa5b32405d5e34bfb704308813
Deleted: 7c609395a484f111c492dba611fcbc1832d49ce174f78788f942395b261f0215
Deleted: cc68cc1e71ac9d17716eecdd3b6d246b08d85c89b74a6db5e4beaa0d0a549bf0
Deleted: 8dfbbb5229b20ce80c35b35d9a94fffe3474b52603af91dfae80ed1618b32ac7
Deleted: 845c9fb2efb5475c82c0e9fff098abdf211a1d994ca94d27b7c8e12793a8d19d
Deleted: bc6868135827b4fa8b20a6c4ca83c58d2f8bcdd66ec37c6087ae9385cfbedac9
Deleted: 2aee848fd69f635bb95d4e6db610720af509f9d3ac915ca24c60d4460125cf4c
Deleted: ccf86651bb31dff618e926330b58f657c0fd698289292bc81fd2aca55b7eadb8
Deleted: b43f4fa03a4fcd2c28502d85f2ba04d3a1eb191683a93a1c83e69e50faa326a6
Deleted: cc37af7c52088c64fb9d2f8fdf9f95a8b0ae84619e6c82feabf49ec6357d4683
Deleted: a1c78b198218461205a4a677e8fb0ad731bd85f15bc410de9ff202f43d1bbb9e
Deleted: bcb3f9fb35a3f2246f043f016c0027100040791659f8a17387f5b04a8cabb369
Deleted: b1b4b803e334b765e5e069bae1d5715306ec3d5783d0375d7b9b763472c00614
Deleted: 9f2f04c059925a4bf65c85bd10c800302b8978feb3465ed16ed0441a7e62f4a4
Deleted: a0b7628360ae18a805191134b579d10853b12eb214d4ae3e4cf9fdcf48cd4393
Deleted: 28b78aa8acecb932f59cbad48c4d21cedbfad661a1a3d26b213cd3455196d9a8
Deleted: 500d5d7b866846a2e60c5babd62574d3232b515364bf010fdb766c34f640f137
Deleted: fccaf840dfd2d9be74c1405df210ad6d7410ae1c9dd65157798e6243d2c9de60
Deleted: f64a1aa37bef170caa59da78a2f871aa71072b8afc72ac07267606129c36c8ab
Deleted: d43e6a38a692aca93bf9dea4ff2c3c33b78b7ebbfddc104261e366e453e7a66c
Deleted: ed260ba40ffe13b64424bb0cef39cb8868ef25ba497d5f062efd317b006eed05
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'
