Branch deploy -- wrong branch being built

Netlify is building a branch I didn’t set up for branch deployment.

STEPS TO REPRODUCE

Create a branch named “test.1”. Add a section to netlify.toml like context."test.1".environment] to record env vars for this build. Push your commit from local to remote repo. Add “test.1” as a branch deploy under continuous deployment / deploy contexts. Add “test.1” as a branch under domain management / branch subdomains. The subdomain that results (auto rename) is “test-1.yourdomain.com”. Build works. Publish deploy works.

Create a new branch named “test@1”. Add a section to netlify.toml like context."test@1".environment] and commit locally. DO NOT add “test@1” anywhere in Netlify – do not set up as a deploy context or a branch subdomain. Push your commit to remote repo. Netlify builds the branch. Click on publish deploy – Netlify deploys the OTHER build (“test.1”), not this one.

OBSERVATION

Build is triggered by a branch name that should not be monitored.

It appears if builds differ only in characters Netlify maps to “-” when converting branch names to subdomain names, the build happens.

RECOMMENDATION

Build should be triggered on exact branch name only.

Branch name should NOT be converted to subdomain name before verifying the branch name is a target for a branch subdomain build.

Documentation should point out that branch names with characters other than 0-9, a-z, A-Z and hyphen will be mangled when they’re converted into subdomain names.

hey there, thanks for pointing this out and writing such clear steps to reproduce! Very much appreciated!

Thanks for your submission. It’s true that we sanitize branch names when we turn them into subdomains for branch deploys. The rules go like this:

  1. Convert any Unicode characters to their ASCII equivalents
  2. Make the string lowercase
  3. Substitute hyphens for any non-alphanumeric characters

Sounds like this behavior was surprising and more documentation would be helpful.

As I understand it, your bug report is that Netlify will run a build for test@1 if it’s configured to run builds for test.1.

I wasn’t able to reproduce this. It looks to me like we do use the original branch name (not the sanitized version) when deciding which branches to build, but we’d be happy to check out your setup if you want to share your Netlify site name.