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

HARMONY-1873: Add regression image tag support in service deployment. #628

Merged
merged 8 commits into from
Sep 26, 2024

Conversation

ygliuvt
Copy link
Member

@ygliuvt ygliuvt commented Sep 24, 2024

Jira Issue ID

HARMONY-1873

Description

Add regression image tag support in service deployment.

Local Test Steps

Verify the db migration can be run up and down without any issue.
Submit a service update request with regression_test_version field to indicate the regression image tag to use for regression test:

curl -XPUT -H "Authorization: Bearer token" -H 'Content-type: application/json' http://localhost:3000/service-image-tag/harmony-service-example -d '{"tag": "latest", "regression_test_version": "0.1.5"}'

Then, follow the returned deployment status link to see the deployment status, verify that the specified regression test image tag is returned in response. e.g.

{
  "deploymentId": "81c1acd5-57ef-448f-a596-70d28387b5f5",
  "username": "yliu10",
  "service": "harmony-service-example",
  "tag": "latest",
  "regressionTestVersion": "0.1.5",
  "status": "successful",
  "message": "Deployment successful",
  "createdAt": "2024-09-24T21:30:39.838Z",
  "updatedAt": "2024-09-24T21:31:23.081Z"
}

PR Acceptance Checklist

  • Acceptance criteria met
  • Tests added/updated (if needed) and passing
  • Documentation updated (if needed)

Copy link
Contributor

@chris-durbin chris-durbin left a comment

Choose a reason for hiding this comment

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

We should probably discuss the name of the field used to identify the test version to run to see what everyone thinks is best.

I ran into a couple of things while testing:

  1. If the deployment fails to be saved to the database the response is still a 200 with a body like it was successful {"tag":"latest","statusLink":"http://localhost:3000/service-deployment/34fa6e05-8a5a-4f11-a0a8-175420343c56"}, but then obviously when you go to the link it says deployment not found. We should return a 500 internal server error in that scenario.
  2. Extra parameters are not being validated - for example: {"tag": "latest", "foo": "bar"}. It would be nice to reject that request with a message that gives a full list of the valid parameters like we do on our request endpoints.

If we don't address those two things in this PR we should write tickets for them.

@@ -490,13 +497,15 @@ export async function updateServiceImageTag(
}

const { service } = req.params;
const { tag } = req.body;
const { tag, test } = req.body;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering about the name to use for the variable to specify the test version to use. test is probably not enough info and I'm not sure if test suites are always going to be in a docker image so I probably wouldn't put image or tag in the name. Maybe testVersion?

Copy link
Member Author

@ygliuvt ygliuvt Sep 25, 2024

Choose a reason for hiding this comment

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

I used test because that is what stated in the ticket. The variable I ended up using in the response is regressionImageTag. I think I am good with either regressionTestVersion or testVersion based on your suggestion. Going to poll the team.


const deployment = new ServiceDeployment({
deployment_id: deploymentId,
username: req.user,
service: service,
tag: tag,
regression_image_tag: regressionImageTag,
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment here in case Docker is not always used - maybe regression_test_version or test_version?

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed to regression_test_version.

Copy link
Contributor

@chris-durbin chris-durbin left a comment

Choose a reason for hiding this comment

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

Tested out successfully.

@@ -0,0 +1,11 @@
exports.up = function (knex) {
return knex.schema.alterTable('service_deployments', (t) => {
t.string('regression_test_version');
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe use t.string('regression_test_version', 255); to use a varchar(255) here?

Copy link
Contributor

@indiejames indiejames left a comment

Choose a reason for hiding this comment

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

Just one small comment.

@ygliuvt ygliuvt merged commit a79ead0 into main Sep 26, 2024
5 of 6 checks passed
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