aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
456 stars 115 forks source link

Deploying specific CodeCommit CommitId (not a retry of a previous job) #2100

Closed clownbaby closed 3 years ago

clownbaby commented 3 years ago

Please describe which feature you have a question about?

I would like to deploy a specific commit to my amplify app branch, which is connected to a CodeCommit repository. There doesn't seem to be a way to do this.

Provide additional details

I have an app configured to deploy from 'master' branch.

I would like to start a build with a specific commit from that branch.

The start-job API call seems to have a 'commit-id' parameter, but I don't understand how to use it to specify an arbitrary CommitId.

According to the StartJob documentation ( https://docs.aws.amazon.com/amplify/latest/APIReference/API_StartJob.html#API_StartJob_RequestSyntax ), there are four types of Jobs I can start:

RELEASE: Always uses 'HEAD,' so commit-id is ignored. -- Example 1 below

RETRY: Uses whatever commit applies to the job being retried, so commit-id is ignored. I could use RETRY to deploy a previously-deployed CommitId, but that doesn't help me deploy any other CommitIds.

MANUAL: Not applicable to a connected branch. -- Example 2 below

WEB_HOOK: I believe web-hooks always use 'HEAD,' so commit-id is ignored, I would guess. -- Example 3 below

In what situation would the 'commit-id' parameter NOT be ignored?

More importantly, is there a way to start a job with a specific (non-retry) CommitId on a connected branch?

What AWS Services are you utilizing?

AWS Amplify API

Provide additional details e.g. code snippets

For example:

Example 1:

$ aws amplify start-job --app-id <some app-id> --branch master --commit-id <some non-HEAD CommitId> --job-type RELEASE
{
    "jobSummary": {
        "commitId": "HEAD", 
        "commitTime": <some time>,
        "status": "PENDING",
        "jobId": <some job id>,
        "jobArn": <some job arn>
    }
}

Example 2:

$ aws amplify start-job --app-id <some app-id> --branch master --commit-id <some non-HEAD CommitId> --job-type MANUAL

An error occurred (BadRequestException) when calling the StartJob operation: The requested jobType MANUAL does not support.

Example 3:

$ aws amplify start-job --app-id <some app-id> --branch master --commit-id <some non-HEAD CommitId> --job-type WEB_HOOK

An error occurred (BadRequestException) when calling the StartJob operation: The requested jobType WEB_HOOK does not support.
github-actions[bot] commented 3 years ago

Hi :wave:, thanks for opening! While we look into this...

If this issue is related to custom domains, be sure to check the custom domains troubleshooting guide to see if that helps. Also, there is a more general troubleshooting FAQ that may be helpful for other questions.

Lastly, please make sure you've specified the App ID and Region in the issue!

ganipcanot commented 3 years ago

I was able to verify this behavior on my end as well. I'm putting in a code fix that will allow customers to use the RELEASE job type to trigger builds against arbitrary commits. Previously the RELEASE job type would always use HEAD but with my upcoming fix that will no longer be the case - if you specify a commitId we will use that to process the job.

So in the future you'll be able to do something like this: aws amplify start-job --app-id <some app-id> --branch master --commit-id <some non-HEAD CommitId> --job-type RELEASE and it won't just default the commit-id field to HEAD.

clownbaby commented 3 years ago

Thanks!

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.