Home
Support Forums

Branch deploy via netlify cli

Hi,
I had auto deployments connected to my bitbucket repo for master, uat and development branches working. However I want to do static code analysis and an npm audit as part of my build. I have configured a CI pipeline that will automatically build my site and do my analysis as required. As part of my pipeline I am using the netlify cli to deploy the statically rendered site. I have turned off Netlify auto deploys as I wish to deploy only from my ci pipeline, in doing so I noticed that visiting the branch deploy url doesn’t render the same site as visiting the deploy preview site. The deploy preview site is correct but the branch deploy url does not update to the latest deployed version. The attached screen shot shows the successful deploy and links in question (I have marked up in red text).
The netlify cli command I am using as part of my ci pipeline is as follows
netlify deploy --dir ./dist/static --auth $NETLIFY_LOGIN --site $NETLIFY_SITE -b uat --message "Deploy UAT branch"
As you can see I’m providing the branch name with the -b flag and the branch deploy url is https://uat–…netlify.ap where … is the site name.
Please note I am using linux env variables in the command for the secrets.
I have also pulled down the zip file for the deploy in question to confirm that the site was deployed correctly and the zip file contains the desired changes.

Does anyone know why the 2 links from the same deploy serve different content?

Hi @ChrisM,

Could we ask which site is this regarding?

Hi,
It’s a client site that I don’t really want to publish the url for at this stage. If I give you the siteId would that help?

Yeah, that would help too.

The siteId is 8ab3fad1-c239-4a26-abdc-9bb0e08fce33 and the deploy is question is 60ebf8f25500d302216c5232

I just checked the links https://u**--s*********-p*****.netlify.app and https://60ebf8f25500d302216c5232--s*********-p*****.netlify.app and the websites look some to me, at least by the initial appearances. Is there anything specific that should look different?

The site was deployed via Netlify auto deploy but I have turned that off as I would like to only use my CI pipeline with the netlify cli deploy.
If you have a look at the /blog page on both site, we have made a change to the styles that are applied to the blog categories. The change is to fix the alignment, the preview url has the style applied and the uat branch doesn’t.
I will have to post multiple responses as I am only able to embed a single image in my responses

Screen shot from preview url which is correct
preview

Screen shot from uat url which does not have the updated style applied
uat-branch

Oh yeah, I can see the problem. I’ll investigate this and let you know.

Hi @ChrisM,

I believe this is related to Clarify description of `--alias` flag for `deploy` command · Issue #1984 · netlify/cli · GitHub, quoting from there:

Once you have a branch deploy that was created from our build system, netlify deploy with the same alias as that branch doesn’t update the branch URL.

This is probably the issue in your case.

Yes that is exactly the situation I have.
I couldn’t see a work around listed on the github issue. Are you aware of any work around for this?

At the moment, the only thing you can do it use alias as a different name that was not a branch deployed before.