From c5faa799264611bfadaeccf75b97930b8382cbde Mon Sep 17 00:00:00 2001 From: Victor Vazquez Date: Fri, 2 Aug 2024 00:19:12 +0000 Subject: [PATCH 1/3] pin cspell version due to issue on last release --- .github/workflows/cli-ci.yml | 3 ++- .github/workflows/cspell-misc.yml | 3 ++- .github/workflows/templates-ci.yml | 3 ++- .github/workflows/vscode-ci.yml | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cli-ci.yml b/.github/workflows/cli-ci.yml index 4cbddcb5b01..bdb34167508 100644 --- a/.github/workflows/cli-ci.yml +++ b/.github/workflows/cli-ci.yml @@ -37,7 +37,8 @@ jobs: - uses: actions/setup-node@v4 with: node-version: "20" - - run: npm install -g cspell + # use 8.12.1 b/c 8.13.0 has a bug: https://github.com/streetsidesoftware/cspell/issues/6025 + - run: npm install -g cspell@8.12.1 - name: Spell check for CLI source code run: cspell lint '**/*.{go,md}' --config ./cli/azd/.vscode/cspell.yaml --root ./cli/azd --no-progress diff --git a/.github/workflows/cspell-misc.yml b/.github/workflows/cspell-misc.yml index 269a0a360c2..3948a79770b 100644 --- a/.github/workflows/cspell-misc.yml +++ b/.github/workflows/cspell-misc.yml @@ -20,6 +20,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: "20" - - run: npm install -g cspell + # use 8.12.1 b/c 8.13.0 has a bug: https://github.com/streetsidesoftware/cspell/issues/6025 + - run: npm install -g cspell@8.12.1 - name: Spell check for general files run: cspell lint '**/*' --config ./.vscode/cspell.misc.yaml --relative --no-progress diff --git a/.github/workflows/templates-ci.yml b/.github/workflows/templates-ci.yml index 6f9cf4e77d0..307844f8d66 100644 --- a/.github/workflows/templates-ci.yml +++ b/.github/workflows/templates-ci.yml @@ -24,6 +24,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: "20" - - run: npm install -g cspell + # use 8.12.1 b/c 8.13.0 has a bug: https://github.com/streetsidesoftware/cspell/issues/6025 + - run: npm install -g cspell@8.12.1 - name: Spell check for templates run: cspell lint '**/*' --config ./templates/cspell.yaml --root ./templates --no-progress diff --git a/.github/workflows/vscode-ci.yml b/.github/workflows/vscode-ci.yml index dc78420e2e8..071483d07ad 100644 --- a/.github/workflows/vscode-ci.yml +++ b/.github/workflows/vscode-ci.yml @@ -20,7 +20,8 @@ jobs: - uses: actions/setup-node@v4 with: node-version: "20" - - run: npm install -g cspell + # use 8.12.1 b/c 8.13.0 has a bug: https://github.com/streetsidesoftware/cspell/issues/6025 + - run: npm install -g cspell@8.12.1 - name: Spell check for vscode extension run: cspell lint '**/*.ts' --config ./ext/vscode/.vscode/cspell.yaml --root ./ext/vscode --no-progress From f10154f1735a008a7ed5c04d57bcabbc22db1166 Mon Sep 17 00:00:00 2001 From: Victor Vazquez Date: Fri, 23 Aug 2024 02:26:01 +0000 Subject: [PATCH 2/3] Relax detection of github host names during azd pipeline config. Folks can define an alias for a hostname to control the usage of different ssh keys. When this happens, the hostname will not be github.com, but it might be still pointing to github. This change relaxes the validation to allow any valid hostname. The command would fail later if the host is not accessible. --- cli/azd/pkg/pipeline/github_provider.go | 4 ++-- cli/azd/pkg/pipeline/github_provider_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/azd/pkg/pipeline/github_provider.go b/cli/azd/pkg/pipeline/github_provider.go index 0633e3dc5ab..e34e5c1769a 100644 --- a/cli/azd/pkg/pipeline/github_provider.go +++ b/cli/azd/pkg/pipeline/github_provider.go @@ -132,10 +132,10 @@ func (p *GitHubScmProvider) configureGitRemote( } // defines the structure of an ssl git remote -var gitHubRemoteGitUrlRegex = regexp.MustCompile(`^git@github\.com:(.*?)(?:\.git)?$`) +var gitHubRemoteGitUrlRegex = regexp.MustCompile(`^git@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}:(.*?)(?:\.git)?$`) // defines the structure of an HTTPS git remote -var gitHubRemoteHttpsUrlRegex = regexp.MustCompile(`^https://(?:www\.)?github\.com/(.*?)(?:\.git)?$`) +var gitHubRemoteHttpsUrlRegex = regexp.MustCompile(`^https://(?:www\.)?[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/(.*?)(?:\.git)?$`) // ErrRemoteHostIsNotGitHub the error used when a non GitHub remote is found var ErrRemoteHostIsNotGitHub = errors.New("not a github host") diff --git a/cli/azd/pkg/pipeline/github_provider_test.go b/cli/azd/pkg/pipeline/github_provider_test.go index 3eb37c02f59..88d7b2ad8ab 100644 --- a/cli/azd/pkg/pipeline/github_provider_test.go +++ b/cli/azd/pkg/pipeline/github_provider_test.go @@ -40,7 +40,7 @@ func Test_gitHub_provider_getRepoDetails(t *testing.T) { t.Run("error", func(t *testing.T) { provider := &GitHubScmProvider{} ctx := context.Background() - details, e := provider.gitRepoDetails(ctx, "git@other.com:Azure/azure-dev.git") + details, e := provider.gitRepoDetails(ctx, "gt@other.com:Azure/azure-dev.git") require.Error(t, e, ErrRemoteHostIsNotGitHub) require.EqualValues(t, (*gitRepositoryDetails)(nil), details) }) From 772ad0df1c36778f75995abfe7df0f91597f03b1 Mon Sep 17 00:00:00 2001 From: Victor Vazquez Date: Fri, 23 Aug 2024 02:26:50 +0000 Subject: [PATCH 3/3] Relax detection of github host names during azd pipeline config. Folks can define an alias for a hostname to control the usage of different ssh keys. When this happens, the hostname will not be github.com, but it might be still pointing to github. This change relaxes the validation to allow any valid hostname. The command would fail later if the host is not accessible. --- cli/azd/pkg/pipeline/github_provider.go | 4 ++-- cli/azd/pkg/pipeline/github_provider_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/azd/pkg/pipeline/github_provider.go b/cli/azd/pkg/pipeline/github_provider.go index 0633e3dc5ab..e34e5c1769a 100644 --- a/cli/azd/pkg/pipeline/github_provider.go +++ b/cli/azd/pkg/pipeline/github_provider.go @@ -132,10 +132,10 @@ func (p *GitHubScmProvider) configureGitRemote( } // defines the structure of an ssl git remote -var gitHubRemoteGitUrlRegex = regexp.MustCompile(`^git@github\.com:(.*?)(?:\.git)?$`) +var gitHubRemoteGitUrlRegex = regexp.MustCompile(`^git@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}:(.*?)(?:\.git)?$`) // defines the structure of an HTTPS git remote -var gitHubRemoteHttpsUrlRegex = regexp.MustCompile(`^https://(?:www\.)?github\.com/(.*?)(?:\.git)?$`) +var gitHubRemoteHttpsUrlRegex = regexp.MustCompile(`^https://(?:www\.)?[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/(.*?)(?:\.git)?$`) // ErrRemoteHostIsNotGitHub the error used when a non GitHub remote is found var ErrRemoteHostIsNotGitHub = errors.New("not a github host") diff --git a/cli/azd/pkg/pipeline/github_provider_test.go b/cli/azd/pkg/pipeline/github_provider_test.go index 3eb37c02f59..88d7b2ad8ab 100644 --- a/cli/azd/pkg/pipeline/github_provider_test.go +++ b/cli/azd/pkg/pipeline/github_provider_test.go @@ -40,7 +40,7 @@ func Test_gitHub_provider_getRepoDetails(t *testing.T) { t.Run("error", func(t *testing.T) { provider := &GitHubScmProvider{} ctx := context.Background() - details, e := provider.gitRepoDetails(ctx, "git@other.com:Azure/azure-dev.git") + details, e := provider.gitRepoDetails(ctx, "gt@other.com:Azure/azure-dev.git") require.Error(t, e, ErrRemoteHostIsNotGitHub) require.EqualValues(t, (*gitRepositoryDetails)(nil), details) })