diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1b9510a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM python:3.11 as runtime +USER root +RUN curl -L https://go.dev/dl/go1.18.2.linux-amd64.tar.gz -o go1.18.2.linux-amd64.tar.gz +RUN tar -C /usr/local -xzf go1.18.2.linux-amd64.tar.gz +ENV PATH=$PATH:/usr/local/go/bin +RUN python3 -m pip install --upgrade pip || true +RUN yes | pip3 install openshift --upgrade || true +RUN apt-get -y update +RUN apt-get -y install jq +RUN curl -L $(curl -s https://api.github.com/repos/openshift/rosa/releases/latest | jq -r ".assets[] | select(.name == \"rosa-linux-amd64\") | .browser_download_url") --output /usr/local/bin/rosa +RUN curl -L $(curl -s https://api.github.com/repos/openshift-online/ocm-cli/releases/latest | jq -r ".assets[] | select(.name == \"ocm-linux-amd64\") | .browser_download_url") --output /usr/local/bin/ocm +RUN chmod +x /usr/local/bin/rosa && chmod +x /usr/local/bin/ocm +RUN /usr/local/bin/rosa download openshift-client +RUN tar xzvf openshift-client-linux.tar.gz +RUN mv oc kubectl /usr/local/bin/ +RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" +RUN unzip awscliv2.zip +RUN ./aws/install +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash +COPY . / diff --git a/libs/platforms/rosa/terraform/terraform.py b/libs/platforms/rosa/terraform/terraform.py index f16a945..e008a19 100644 --- a/libs/platforms/rosa/terraform/terraform.py +++ b/libs/platforms/rosa/terraform/terraform.py @@ -325,15 +325,15 @@ def create_cluster(self, platform, cluster_name): os.mkdir(cluster_info["path"]) self.logging.debug("Output directory set to %s" % cluster_info["path"]) - while retry_loop <= 600: # 1hr timeout + while retry_loop <= 60: # 10 min timeout retry_loop += 1 cluster_start_time = int(datetime.datetime.utcnow().timestamp()) status_code, status_out, status_err = self.utils.subprocess_exec("rosa describe cluster -c " + cluster_name + " -o json", extra_params={"universal_newlines": True}, log_output=False) if status_code != 0: - if retry_loop <= 600: + if retry_loop <= 60: self.logging.debug(f"ROSA cluster {cluster_name} is not available yet, retrying..") self.logging.debug(status_out) - time.sleep(6) + time.sleep(5) else: cluster_info['status'] = "not ready" self.logging.debug(status_out) @@ -342,8 +342,6 @@ def create_cluster(self, platform, cluster_name): else: cluster_listed_time = int(datetime.datetime.utcnow().timestamp()) preflight_ch = self._preflight_wait(cluster_name, cluster_name) - cluster_apply_time = int(platform.environment["clusters"][cluster_name]["cluster_apply_time"]) - cluster_info["apply_duration"] = cluster_listed_time - cluster_apply_time cluster_info["preflight_checks"] = preflight_ch break @@ -384,6 +382,8 @@ def create_cluster(self, platform, cluster_name): cluster_info['status'] = "Ready, missing workers" return 1 cluster_info['status'] = "ready" + cluster_apply_time = int(platform.environment["clusters"][cluster_name]["cluster_apply_time"]) + cluster_info["apply_duration"] = cluster_listed_time - cluster_apply_time try: with open(cluster_info['path'] + "/metadata_install.json", "w") as metadata_file: json.dump(cluster_info, metadata_file)