Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] To Show terraform output in Services #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jaisejose1123
Copy link

@jaisejose1123 jaisejose1123 commented Sep 9, 2024

PR raised for Show terraform output in Services
https://jsw.ibm.com/browse/CP4AIOPS-1082

Before
After executing Terraform through ManageIQ, the results were not stored in the MiqTask and Job tables.

image
The context_data field in the MiqTask table was empty.

image
The context field in the Job table was empty.

image
start_time of OrchestrationStack was nill

After
Now, Terraform results are being stored in the MiqTask and Job tables.

image
The context_data field stores the Terraform results in the MiqTask table.

image
The context field stores the Terraform results in the MiqTask table.

image
start_time of OrchestrationStack get updated

@agrare agrare self-assigned this Sep 9, 2024
@agrare agrare changed the title [wip]-To Show terraform output in Services [WIP] To Show terraform output in Services Sep 9, 2024
@agrare agrare added enhancement New feature or request wip labels Sep 9, 2024
cleanup_git_repository

return queue_signal(:finish, message, status) if success?
if success?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaisejose1123 is it possible to get logs on failure also? I think that's almost more important in order to figure out what went wrong.

}

miq_task.context_data ||= {}
miq_task.context_data[:terraform_respons] = terraform_response
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo, should be :terraform_response


miq_task.context_data ||= {}
miq_task.context_data[:terraform_respons] = terraform_response
context[:terraform_respons] = terraform_response
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, :terraform_response

miq_task.context_data[:terraform_respons] = terraform_response
context[:terraform_respons] = terraform_response

update!(:context => context, :started_on => context[:terraform_respons][:stack_job_start_time])
Copy link
Member

@agrare agrare Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~~Do we want to override the started_on property? Was this not being set before? ~~ I see you said above this was blank.

If it wasn't being set we probably want to set it earlier than post_execute

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agrare
Copy link
Member

agrare commented Sep 9, 2024

@jaisejose1123 are you able to see the log output on the stack or do you have to implement raw_stdout like EmbeddedAnsible does? https://github.com/ManageIQ/manageiq/blob/master/app/models/manageiq/providers/embedded_ansible/automation_manager/job.rb#L149-L151

@jaisejose1123
Copy link
Author

jaisejose1123 commented Sep 10, 2024

@jaisejose1123 are you able to see the log output on the stack or do you have to implement raw_stdout like EmbeddedAnsible does? https://github.com/ManageIQ/manageiq/blob/master/app/models/manageiq/providers/embedded_ansible/automation_manager/job.rb#L149-L151

@agrare We are storing the logs in the database using the format shown below, so we can directly query them from the database.
image

@agrare
Copy link
Member

agrare commented Sep 10, 2024

@jaisejose1123 can you show an example of where this is visible on the UI? I'm surprised we don't have to implement OrchestrationStack stdout like embedded ansible does.

@Fryguy
Copy link
Member

Fryguy commented Sep 13, 2024

I don't think the UI has been built yet - @jaisejose1123 can you add in the UI for showing the terraform template output in services...it's likely going to be a copy paste from ansible. I also expect you'll need the backend code that uses TerminalToHtml. FYI, @GilbertCherrie ^

@jaisejose1123
Copy link
Author

jaisejose1123 commented Sep 14, 2024

backend code that uses TerminalToHtml

completed the UI work but am currently facing few minor errors. The backend code using TerminalToHtml is already finished. I’ll update the PR soon.

Comment on lines +82 to +84
if MiqEnvironment::Command.is_podified?
signal(*args)
else
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaisejose1123 do we need this for terraform? The reason it is like this in embedded_ansible is because the files/directories related to the ansible-runner execution are literally on the pod's filesystem so we have to run it on the same pod, but this has a number of drawbacks and something we want to get away from.

With the opentofu-runner any pod in the namespace should be able to hit that API so any pod could run the next state.

cleanup_git_repository


#cleanup_git_repository
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we no longer cleaning up the git repository?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wip
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants