diff --git a/.github/workflows/sld-api-docker-image.yml b/.github/workflows/sld-api-docker-image.yml index 65dcebfe..00027430 100644 --- a/.github/workflows/sld-api-docker-image.yml +++ b/.github/workflows/sld-api-docker-image.yml @@ -24,11 +24,11 @@ jobs: - name: Build the Docker image with tag working-directory: ./sld-api-backend - run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-api:2.27.0 + run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-api:2.28.0 - name: Docker Push with tag #if: github.event.pull_request.merged == true - run: docker push ${{ secrets.DOCKER_USERNAME }}/sld-api:2.27.0 + run: docker push ${{ secrets.DOCKER_USERNAME }}/sld-api:2.28.0 - name: Build the Docker image working-directory: ./sld-api-backend diff --git a/.github/workflows/sld-dashboard-docker-image.yml b/.github/workflows/sld-dashboard-docker-image.yml index 10be7d90..19ddbec9 100644 --- a/.github/workflows/sld-dashboard-docker-image.yml +++ b/.github/workflows/sld-dashboard-docker-image.yml @@ -24,11 +24,11 @@ jobs: - name: Build the Docker image with tags working-directory: ./sld-dashboard - run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:2.27.0 + run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:2.28.0 - name: Docker Push with tags #if: github.event.pull_request.merged == true - run: docker push ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:2.27.0 + run: docker push ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:2.28.0 - name: Build the Docker image working-directory: ./sld-dashboard run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:latest diff --git a/play-with-sld/kubernetes/k8s/sld-api-backend.yml b/play-with-sld/kubernetes/k8s/sld-api-backend.yml index f3fe1a2f..0c6ed152 100644 --- a/play-with-sld/kubernetes/k8s/sld-api-backend.yml +++ b/play-with-sld/kubernetes/k8s/sld-api-backend.yml @@ -17,7 +17,7 @@ spec: subdomain: primary containers: - name: api-backend - image: d10s0vsky/sld-api:2.27.0 + image: d10s0vsky/sld-api:2.28.0 imagePullPolicy: Always command: ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"] ports: diff --git a/play-with-sld/kubernetes/k8s/sld-dashboard.yml b/play-with-sld/kubernetes/k8s/sld-dashboard.yml index 4a78a9fa..a489702e 100644 --- a/play-with-sld/kubernetes/k8s/sld-dashboard.yml +++ b/play-with-sld/kubernetes/k8s/sld-dashboard.yml @@ -17,7 +17,7 @@ spec: subdomain: primary containers: - name: sld-dashboard - image: d10s0vsky/sld-dashboard:2.27.0 + image: d10s0vsky/sld-dashboard:2.28.0 env: - name: PATH value: "/home/sld/.asdf/shims:/home/sld/.asdf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" diff --git a/play-with-sld/kubernetes/k8s/sld-worker-default.yml b/play-with-sld/kubernetes/k8s/sld-worker-default.yml index 6c14fab3..fdb28d84 100644 --- a/play-with-sld/kubernetes/k8s/sld-worker-default.yml +++ b/play-with-sld/kubernetes/k8s/sld-worker-default.yml @@ -17,7 +17,7 @@ spec: subdomain: primary containers: - name: stack-deploy-worker-default - image: d10s0vsky/sld-api:2.27.0 + image: d10s0vsky/sld-api:2.28.0 imagePullPolicy: Always env: - name: TF_WARN_OUTPUT_ERRORS diff --git a/play-with-sld/kubernetes/k8s/sld-worker-squad1.yml b/play-with-sld/kubernetes/k8s/sld-worker-squad1.yml index 9a5f6284..c396036b 100644 --- a/play-with-sld/kubernetes/k8s/sld-worker-squad1.yml +++ b/play-with-sld/kubernetes/k8s/sld-worker-squad1.yml @@ -17,7 +17,7 @@ spec: subdomain: primary containers: - name: stack-deploy-worker-squad1 - image: d10s0vsky/sld-api:2.27.0 + image: d10s0vsky/sld-api:2.28.0 imagePullPolicy: Always env: - name: TF_WARN_OUTPUT_ERRORS diff --git a/play-with-sld/kubernetes/k8s/sld-worker-squad2.yml b/play-with-sld/kubernetes/k8s/sld-worker-squad2.yml index 7d33fbbe..b5e7d655 100644 --- a/play-with-sld/kubernetes/k8s/sld-worker-squad2.yml +++ b/play-with-sld/kubernetes/k8s/sld-worker-squad2.yml @@ -17,7 +17,7 @@ spec: subdomain: primary containers: - name: stack-deploy-worker-squad2 - image: d10s0vsky/sld-api:2.27.0 + image: d10s0vsky/sld-api:2.28.0 imagePullPolicy: Always env: - name: TF_WARN_OUTPUT_ERRORS diff --git a/sld-api-backend/src/worker/domain/services/command.py b/sld-api-backend/src/worker/domain/services/command.py index bedea757..2e062de1 100644 --- a/sld-api-backend/src/worker/domain/services/command.py +++ b/sld-api-backend/src/worker/domain/services/command.py @@ -10,7 +10,9 @@ def command(command: str, channel: str): try: output_lines = [] command_description = f"Executing command: {command}" + output_lines.append("-" * 80) output_lines.append(command_description) + output_lines.append("-" * 80) redis_client.publish(channel, "-" * 80) redis_client.publish(channel, command_description) redis_client.publish(channel, "-" * 80) diff --git a/sld-api-backend/src/worker/providers/hashicorp/actions.py b/sld-api-backend/src/worker/providers/hashicorp/actions.py index 14cf8d77..9a3cae97 100644 --- a/sld-api-backend/src/worker/providers/hashicorp/actions.py +++ b/sld-api-backend/src/worker/providers/hashicorp/actions.py @@ -46,15 +46,18 @@ def execute_terraform_command(self, action: str) -> dict: plan_command = f"/tmp/{self.version}/terraform plan -input=false -refresh -no-color -var-file={variables_files} -out={self.name}.tfplan" apply_command = f"/tmp/{self.version}/terraform apply -input=false -auto-approve -no-color {self.name}.tfplan" destroy_command = f"/tmp/{self.version}/terraform destroy -input=false -auto-approve -no-color -var-file={variables_files}" - + output = [] if action == "plan": - result, output = command(init_command, channel=channel) - result, output = self.subprocess_handler(plan_command, channel=channel) + result, output_init = command(init_command, channel=channel) + result, output_plan = self.subprocess_handler(plan_command, channel=channel) + output = output_init + output_plan if action == "apply": - result, output = self.subprocess_handler(apply_command, channel=channel) + result, output_apply = self.subprocess_handler(apply_command, channel=channel) + output = output + output_apply elif action == "destroy": - result, output = command(init_command, channel=channel) - result, output = self.subprocess_handler(destroy_command, channel=channel) + result, output_init = command(init_command, channel=channel) + result, output_destroy = self.subprocess_handler(destroy_command, channel=channel) + output = output_init + output_destroy unsecret(self.stack_name, self.environment, self.squad, self.name, self.secreto) diff --git a/sld-dashboard/app/base/static/assets/css/volt.css b/sld-dashboard/app/base/static/assets/css/volt.css index 0df768fd..e79cf86b 100644 --- a/sld-dashboard/app/base/static/assets/css/volt.css +++ b/sld-dashboard/app/base/static/assets/css/volt.css @@ -41830,8 +41830,8 @@ pre { .beta-icon { font-weight: bold; - font-size: 18px; - background-color: #d9534f; /* Color de fondo para el ícono */ + color: var(--bs-dark); + font-size: 25px; padding: 5px 10px; border-radius: 4px; margin-right: 5px; diff --git a/sld-dashboard/app/home/routes.py b/sld-dashboard/app/home/routes.py index b389afe9..5755aa78 100644 --- a/sld-dashboard/app/home/routes.py +++ b/sld-dashboard/app/home/routes.py @@ -57,7 +57,7 @@ def deploy_stream(task_id): @login_required def stream(task_id): def generate(): - pubsub = s.pubsub(ignore_subscribe_messages=True) + pubsub = s.pubsub(ignore_subscribe_messages=False) pubsub.subscribe(f'{task_id}') for message in pubsub.listen(): logging.info(message) diff --git a/sld-dashboard/app/home/templates/deploy-stream.html b/sld-dashboard/app/home/templates/deploy-stream.html index c1bd8201..0b78a7db 100644 --- a/sld-dashboard/app/home/templates/deploy-stream.html +++ b/sld-dashboard/app/home/templates/deploy-stream.html @@ -36,7 +36,8 @@
{% include 'includes/navigation.html' %}
- BETA + Console Log -> +

This is a beta version of the feature. Feedback is welcome!

@@ -72,15 +73,36 @@

Deployment Output:

eventSource.onmessage = function(e) { const sseDataElement = document.getElementById('sse-data'); - if (e.data !== '1') { + if (e.data !== '1' && e.data !== 'null') { + // Handle normal data, excluding 'null' sseDataElement.textContent += e.data + '\n'; - // Delay scroll adjustment to ensure the browser has processed the new content setTimeout(() => { const lastLine = document.createElement("div"); sseDataElement.appendChild(lastLine); lastLine.scrollIntoView({ behavior: "smooth", block: "end" }); }, 30); - } + } else if (typeof e.data === 'string') { + // Handle the case where '1' is received - fetch additional data + fetch('/output/' + taskId) + .then(response => response.json()) // Parse the JSON response + .then(dataArray => { + if (dataArray && dataArray.length > 0) { + // Iterate over each string in the array and append it, excluding 'null' + dataArray.forEach(item => { + if (item && item !== 'null') { + sseDataElement.textContent += item + '\n'; + } + }); + } else { + sseDataElement.textContent = 'No additional task data available.'; + } + }) + .catch(error => { + console.error('Error fetching additional task data:', error); + sseDataElement.textContent = 'Error fetching data.'; + }); + } }; + {% endblock javascripts %} diff --git a/sld-dashboard/app/home/templates/deploys-list.html b/sld-dashboard/app/home/templates/deploys-list.html index 1a159abe..ed0593f0 100644 --- a/sld-dashboard/app/home/templates/deploys-list.html +++ b/sld-dashboard/app/home/templates/deploys-list.html @@ -268,7 +268,7 @@

All Deploys

- + @@ -531,9 +531,9 @@