Open steinybot opened 4 years ago
@steinybot just to be clear on your requirement - you want the ability to post to a PR on the status of a build with a link to the frontend URL
The requirement is to be able to go to the frontend preview from a GitLab merge request. A bonus is to have also be able to see the current build status from the GitLab merge request. Another way of putting it is to have feature parity with the GitHub integration.
Any news about that? I really want to use Amplify Previews + Gitlab but as for now, it's "unusable"...
Same here!
Any updates here? That'd be really useful
Guys this is an important feature, any news?
Ended up with a DIY method in gitlab CI.
The preview URL is based on the GitLab merge request ID and Amplify App ID. You can curl GitLab to make a comment with the link manually. To use this
GITLAB_ACCESS_TOKEN
access token env variable to the pipelineYOUR_AMPLIFY_APP_ID
with your amplify app's idstages:
- preview
preview:
stage: preview
only:
- merge_requests
script:
- |
curl \
--data-urlencode "body=## After build preview will 🚀[be here!](https://pr-${CI_MERGE_REQUEST_IID}.YOUR_AMPLIFY_APP_ID.amplifyapp.com/)" \
--request POST \
--header "PRIVATE-TOKEN: ${GITLAB_ACCESS_TOKEN}" \
"https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/merge_requests/${CI_MERGE_REQUEST_IID}/discussions"
Thanks for that @RobertAron! In case anyone else is wondering how to try the above hint, the Amplify app id is the string after the /
in the App ARN, obtained by going to the app's general settings. It is also the subdomain of amplifyapp.com
embedded in the deployment URLs.
Also, CI_PROJECT_ID
can be found by going to the project page > View Source > search for project_id
in the HTML source, although this is only needed during manual testing of the curl
command - it's automatically defined during the pipeline.
One more tip - I found that the above YAML worked great, but in contrast it didn't if instead I added the curl
command to an existing CI job. In that case for some reason it wasn't considered a merge request pipeline, therefore predefined variables for merge request pipelines (in particular CI_MERGE_REQUEST_IID
) weren't defined.
We are trying to migrate from vercel to amplify and just found this... which somehow is a blocker us 😢
Please describe which feature you have a question about?
I have configured previews for my app where the code is hosted in a GitLab repository. AWS Amplify does detect my Merge Requests and starts a build but it does not add any kind of status to the Merge Request in GitLab. Is there any way to do this? I'm assuming that it is not possible to work with the GitLab Pipelines feature but even a simple comment with the URLs to the build and the frontend would be nice.
Provide additional details