Skip to content

Commit

Permalink
fix: conditionally rebuild container apis on push
Browse files Browse the repository at this point in the history
This commit adds logic to rebuild container based APIs during
push if necessary.

Refs: #6684
  • Loading branch information
cjihrig-aws committed Apr 30, 2021
1 parent ec1613e commit b571583
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/amplify-category-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import path from 'path';
import { run } from './commands/api/console';
import { getCfnApiArtifactHandler } from './provider-utils/awscloudformation/cfn-api-artifact-handler';

export { NETWORK_STACK_LOGICAL_ID } from './category-constants'
export { NETWORK_STACK_LOGICAL_ID } from './category-constants';
export { DEPLOYMENT_MECHANISM } from './provider-utils/awscloudformation/base-api-stack';
export { EcsStack } from './provider-utils/awscloudformation/ecs-apigw-stack';
export { EcsAlbStack } from './provider-utils/awscloudformation/ecs-alb-stack';
export { getGitHubOwnerRepoFromPath } from './provider-utils/awscloudformation/utils/github';
export { generateContainersArtifacts, ApiResource, processDockerConfig } from './provider-utils/awscloudformation/utils/containers-artifacts';
export {
generateContainersArtifacts,
ApiResource,
processDockerConfig,
} from './provider-utils/awscloudformation/utils/containers-artifacts';
export { getContainers } from './provider-utils/awscloudformation/docker-compose';

const category = 'api';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ export async function run(context: $TSContext, resourceDefinition: $TSObject) {
context.print.info(
`It may take a few moments for this to appear. If you have trouble with first time deployments, please try refreshing this page after a few moments and watch the CodeBuild Details for debugging information.`,
);

if (resourcesToBeUpdated.find(res => res.resourceName === resource.resourceName)) {
resource.lastPackageTimeStamp = undefined;
await context.amplify.updateamplifyMetaAfterResourceUpdate('api', resource.resourceName, 'lastPackageTimeStamp', undefined);
}
}

if (resource.service === ApiServiceNameElasticContainer && resource.category === 'hosting') {
Expand Down

0 comments on commit b571583

Please sign in to comment.