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

[FEATURE] Envoyer le commentaire de déploiement des RAs sur les PRs quelque soit leur état #511

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/controllers/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ async function deployPullRequest(
const reviewAppName = `${appName}-pr${prId}`;
try {
const reviewAppExists = await client.reviewAppExists(reviewAppName);
deployedRA.push({ name: appName, isCreated: !reviewAppExists });
if (reviewAppExists) {
await client.deployUsingSCM(reviewAppName, ref);
} else {
Expand All @@ -173,7 +174,6 @@ async function deployPullRequest(
await client.disableAutoDeploy(reviewAppName);
await client.deployUsingSCM(reviewAppName, ref);
}
deployedRA.push({ name: appName, isCreated: !reviewAppExists });
} catch (error) {
logger.error({
event: 'review-app',
Expand Down
2 changes: 1 addition & 1 deletion test/acceptance/build/github_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ describe('Acceptance | Build | Github', function () {
expect(addRADeploymentCheck.isDone()).to.be.true;
expect(res.statusCode).to.equal(200);
expect(res.result).to.eql(
'Triggered deployment of RA on app pix-api-review, pix-audit-logger-review with pr 2',
'Triggered deployment of RA on app pix-api-review, pix-audit-logger-review, pix-front-review with pr 2',
);
});
});
Expand Down
18 changes: 0 additions & 18 deletions test/unit/build/controllers/github_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,24 +662,6 @@ Les variables d'environnement seront accessibles sur scalingo https://dashboard.
});
});

it('throws an error on scalingo deployment fails', async function () {
// given
const scalingoClientStub = sinon.stub();
const deployUsingSCMStub = sinon.stub().rejects(new Error('Deployment error'));
const reviewAppExistsStub = sinon.stub().resolves(true);
scalingoClientStub.getInstance = sinon.stub().returns({
deployUsingSCM: deployUsingSCMStub,
reviewAppExists: reviewAppExistsStub,
});

// when
const result = await catchErr(githubController.handleRA)(request, scalingoClientStub);

// then
expect(result).to.be.instanceOf(Error);
expect(result.message).to.equal('No RA deployed for repository pix and pr3');
});

describe('when the review app does not exist', function () {
it('should call scalingo to create and deploy the corresponding applications', async function () {
// given
Expand Down