Skip to content

Commit

Permalink
New scheduled workflow to test using the azcore backend nightly (#3591)
Browse files Browse the repository at this point in the history
Since we chose an opt-in approach for the time being, the new azcore
client from #3536 is not tested by regular CI workflows. This PR adds a
nightly workflow that tests it. It's a stripped-down copy of
`master.yaml`.

We can then easily add the opt-in for azidentity auth as well.

[Here's a recent
run.](https://github.com/pulumi/pulumi-azure-native/actions/runs/11052940342/job/30707287412)
The only failures are OIDC tests, which should pass on `master` because
there's an identity defined on our Service Principal for the master
branch.
  • Loading branch information
thomas11 authored Sep 30, 2024
1 parent 8e65c18 commit cf9de59
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/azcore-scheduled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: azcore-scheduled

on:
schedule:
- cron: 15 3 * * 1-6 # 3:15 am UTC, Mon-Sat
workflow_dispatch: {}

jobs:
version:
uses: ./.github/workflows/version.yml
secrets: inherit

build_test:
uses: ./.github/workflows/build-test.yml
secrets: inherit
needs: version
with:
ref: ${{ github.ref }}
version: ${{ needs.version.outputs.version }}
short_test: false
retention_days: 7
use_autorest: false
5 changes: 5 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ on:
type: number
description: The number of days for which we retain assets
default: 90
use_autorest:
type: boolean
description: Whether to use autorest, not azcore
default: true

env:
GITHUB_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }}
Expand All @@ -41,6 +45,7 @@ env:
ARM_SUBSCRIPTION_ID: 0282681f-7a9e-424b-80b2-96babd57a8a1
ARM_TENANT_ID: 706143bc-e1d4-4593-aee2-c9dc60ab9be7
PULUMI_API: https://api.pulumi-staging.io
PULUMI_USE_AUTOREST: ${{ inputs.use_autorest }}

jobs:
prerequisites:
Expand Down
2 changes: 2 additions & 0 deletions provider/pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,10 @@ func (k *azureNativeProvider) Configure(ctx context.Context,

func (k *azureNativeProvider) newAzureClient(armAuth autorest.Authorizer, tokenCred azcore.TokenCredential, userAgent string) (azure.AzureClient, error) {
if os.Getenv("PULUMI_USE_AUTOREST") == "false" {
logging.V(9).Infof("AzureClient: using azCore")
return azure.NewAzCoreClient(tokenCred, userAgent, k.getAzureCloud(), nil)
}
logging.V(9).Infof("AzureClient: using autorest")
return azure.NewAzureClient(k.environment, armAuth, userAgent), nil
}

Expand Down
1 change: 1 addition & 0 deletions provider/pkg/provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ func TestUsesCorrectAzureClient(t *testing.T) {
p := azureNativeProvider{}

t.Run("default", func(t *testing.T) {
t.Setenv("PULUMI_USE_AUTOREST", "")
client, err := p.newAzureClient(nil, &fake.TokenCredential{}, "pulumi")
require.NoError(t, err)
assert.Equal(t, "azureClientImpl", reflect.TypeOf(client).Elem().Name())
Expand Down

0 comments on commit cf9de59

Please sign in to comment.