Skip to content

feat: add a new feature to run builds #201

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

feat: add a new feature to run builds #201

wants to merge 7 commits into from

Conversation

akocbek
Copy link
Contributor

@akocbek akocbek commented Jun 3, 2025

Description

TestDeployCEProjectDA test refactoring:
- replaced terraform.OutputAllE and terraform.Output with own method getTerraformOutput to prevent print sensitive outputs

  • added writeTfvarsFile function to create tfvars file and added to temp testing folder to use it instead of CLI vars (prevent print sensitive inputs and solving the Error: Can't change variable when applying a saved plan issue)
  • using terratest wrapper for existing resources as well

New implementation:

  • added support to run builds
  • added support to create container image namespace

Release required?

  • No release
  • Patch release (x.x.X)
  • Minor release (x.X.x)
  • Major release (X.x.x)
Release notes content

Run the pipeline

If the CI pipeline doesn't run when you create the PR, the PR requires a user with GitHub collaborators access to run the pipeline.

Run the CI pipeline when the PR is ready for review and you expect tests to pass. Add a comment to the PR with the following text:

/run pipeline

Checklist for reviewers

  • If relevant, a test for the change is included or updated with this PR.
  • If relevant, documentation for the change is included or updated with this PR.

For mergers

  • Use a conventional commit message to set the release level. Follow the guidelines.
  • Include information that users need to know about the PR in the commit message. The commit message becomes part of the GitHub release notes.
  • Use the Squash and merge option.

@akocbek akocbek requested a review from shemau as a code owner June 3, 2025 16:23
@akocbek
Copy link
Contributor Author

akocbek commented Jun 3, 2025

/run pipeline

6 similar comments
@akocbek
Copy link
Contributor Author

akocbek commented Jun 5, 2025

/run pipeline

@akocbek
Copy link
Contributor Author

akocbek commented Jun 5, 2025

/run pipeline

@akocbek
Copy link
Contributor Author

akocbek commented Jun 5, 2025

/run pipeline

@akocbek
Copy link
Contributor Author

akocbek commented Jun 5, 2025

/run pipeline

@akocbek
Copy link
Contributor Author

akocbek commented Jun 5, 2025

/run pipeline

@akocbek
Copy link
Contributor Author

akocbek commented Jun 6, 2025

/run pipeline

@akocbek akocbek requested a review from toddgiguere June 6, 2025 07:27
@akocbek
Copy link
Contributor Author

akocbek commented Jun 9, 2025

/run pipeline

Copy link
Contributor

@shemau shemau left a comment

Choose a reason for hiding this comment

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

Thoughts about the architecture of the solution:

app DA only sets up one application.
project DA sets up multiple complex resources.

Architecturally is it better to align with the app approach and introduce an app-from-source (name negotiable) DA that contains a single build.

Both applications from binary and applications from source are similar. Both require a project.

The 'project' DA could exclude builds, or add applications to be balanced.

@@ -46,7 +46,7 @@ variable "project_name" {
variable "builds" {
description = "A map of code engine builds to be created.[Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-code-engine/blob/main/solutions/project/DA-inputs.md#builds)"
type = map(object({
output_image = string
output_image = optional(string)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should imply a change to the documentation in the link in the description. The DA now has a more complex interaction between this input and container_resgistry_namespace.

fi

# Login to IBM Cloud quietly
if ! ibmcloud login -r "${REGION}" -g "${RESOURCE_GROUP_ID}" --apikey "${IBMCLOUD_API_KEY}" --quiet > /dev/null 2>&1; then
Copy link
Member

Choose a reason for hiding this comment

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

If you are concerned about leaking the api key, the --apikey here is usually not necessary. If the IBMCLOUD_API_KEY is set in the environment it will automatically be used by the login without specifying it in the command line. That way you can be sure it won't leak.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, updated

exit 1
fi

ibmcloud login -r "${REGION}" -g "${RESOURCE_GROUP_ID}" --apikey "${IBMCLOUD_API_KEY}"
Copy link
Member

Choose a reason for hiding this comment

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

This has a potential to leak the api key if this command line gets echo to the logs.

The --apikey is optional here if the environment variable is set, would suggest just to remove --apikey here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, updated

@akocbek
Copy link
Contributor Author

akocbek commented Jun 17, 2025

/run pipeline

@akocbek
Copy link
Contributor Author

akocbek commented Jun 17, 2025

/run pipeline

value = resource.ibm_code_engine_build.ce_build.output_image
}

output "output_secret" {
Copy link
Member

Choose a reason for hiding this comment

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

I might not have caught this last time. Is this an actual secret or is it the ID of a secret? Should it be marked sensitive?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is just a name of a secret, so we are good here

build = {
  "build-adn-3" = {
    "build_id" = "b522ec47-a1a8-4cf1-8c28-fa2ab28ffa5f"
    "id" = "c8e9d124-f0ab-4f36-b09d-a115273005a0/build-adn-3"
    "name" = "build-adn-3"
    "output_image" = "private.us.icr.io/andrej-test/build-adn-3"
    "output_secret" = "andrejsecret3"
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants