Skip to content

Commit ccd48fb

Browse files
authored
Update GitHub Actions workflows. (#4931)
This PR was automatically generated by the update-workflows-ecosystem-providers workflow in the pulumi/ci-mgmt repo, from commit c09ca3824257955e13392d96586b14a0fe49405a.
1 parent 5d78092 commit ccd48fb

File tree

4 files changed

+48
-21
lines changed

4 files changed

+48
-21
lines changed

.github/actions/setup-tools/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ runs:
3232
cache-dependency-path: |
3333
provider/*.sum
3434
upstream/*.sum
35+
sdk/go/*.sum
3536
sdk/*.sum
37+
*.sum
3638
# TODO(https://github.com/actions/setup-go/issues/316): Restore but don't save the cache.
3739
cache: ${{ inputs.cache-go }}
3840

.github/workflows/build_provider.yml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
env:
1616
PROVIDER_VERSION: ${{ inputs.version }}
1717
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18-
AZURE_SIGNING_CONFIGURED: ${{ secrets.AZURE_SIGNING_CLIENT_ID != '' && secrets.AZURE_SIGNING_CLIENT_SECRET != '' && secrets.AZURE_SIGNING_TENANT_ID != '' && secrets.AZURE_SIGNING_KEY_VAULT_URI != '' }}
1918
strategy:
2019
fail-fast: true
2120
matrix:
@@ -63,24 +62,12 @@ jobs:
6362

6463
- name: Build provider
6564
run: make "provider-${{ matrix.platform.os }}-${{ matrix.platform.arch }}"
66-
67-
- name: Sign windows provider
68-
if: matrix.platform.os == 'windows' && env.AZURE_SIGNING_CONFIGURED == 'true'
69-
run: |
70-
az login --service-principal \
71-
-u ${{ secrets.AZURE_SIGNING_CLIENT_ID }} \
72-
-p ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }} \
73-
-t ${{ secrets.AZURE_SIGNING_TENANT_ID }} \
74-
-o none;
75-
76-
wget https://github.com/ebourg/jsign/releases/download/6.0/jsign-6.0.jar;
77-
78-
java -jar jsign-6.0.jar \
79-
--storetype AZUREKEYVAULT \
80-
--keystore "PulumiCodeSigning" \
81-
--url ${{ secrets.AZURE_SIGNING_KEY_VAULT_URI }} \
82-
--storepass "$(az account get-access-token --resource "https://vault.azure.net" | jq -r .accessToken)" \
83-
bin/windows-amd64/pulumi-resource-aws.exe;
65+
env:
66+
AZURE_SIGNING_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }}
67+
AZURE_SIGNING_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }}
68+
AZURE_SIGNING_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }}
69+
AZURE_SIGNING_KEY_VAULT_URI: ${{ secrets.AZURE_SIGNING_KEY_VAULT_URI }}
70+
SKIP_SIGNING: ${{ secrets.AZURE_SIGNING_CLIENT_ID == '' && secrets.AZURE_SIGNING_CLIENT_SECRET == '' && secrets.AZURE_SIGNING_TENANT_ID == '' && secrets.AZURE_SIGNING_KEY_VAULT_URI == '' }}
8471

8572
- name: Package provider
8673
run: make provider_dist-${{ matrix.platform.os }}-${{ matrix.platform.arch }}

.github/workflows/prerequisites.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
- name: Unit-test provider code
8181
run: make test_provider
8282
- name: Upload coverage reports to Codecov
83-
uses: codecov/codecov-action@c2fcb216de2b0348de0100baa3ea2cad9f100a01 # v5.1.0
83+
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1
8484
env:
8585
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
8686
- if: inputs.is_pr

Makefile

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,21 @@ debug_tfgen:
314314

315315
# Provider cross-platform build & packaging
316316

317+
# Set these variables to enable signing of the windows binary
318+
AZURE_SIGNING_CLIENT_ID ?=
319+
AZURE_SIGNING_CLIENT_SECRET ?=
320+
AZURE_SIGNING_TENANT_ID ?=
321+
AZURE_SIGNING_KEY_VAULT_URI ?=
322+
SKIP_SIGNING ?=
323+
317324
# These targets assume that the schema-embed.json exists - it's generated by tfgen.
318325
# We disable CGO to ensure that the binary is statically linked.
319326
bin/linux-amd64/$(PROVIDER): TARGET := linux-amd64
320327
bin/linux-arm64/$(PROVIDER): TARGET := linux-arm64
321328
bin/darwin-amd64/$(PROVIDER): TARGET := darwin-amd64
322329
bin/darwin-arm64/$(PROVIDER): TARGET := darwin-arm64
323330
bin/windows-amd64/$(PROVIDER).exe: TARGET := windows-amd64
324-
bin/%/$(PROVIDER) bin/%/$(PROVIDER).exe:
331+
bin/%/$(PROVIDER) bin/%/$(PROVIDER).exe: bin/jsign-6.0.jar
325332
@# check the TARGET is set
326333
test $(TARGET)
327334
cd provider && \
@@ -330,6 +337,37 @@ bin/%/$(PROVIDER) bin/%/$(PROVIDER).exe:
330337
export CGO_ENABLED=0 && \
331338
go build -o "${WORKING_DIR}/$@" $(PULUMI_PROVIDER_BUILD_PARALLELISM) -ldflags "$(LDFLAGS)" "$(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)"
332339

340+
@# Only sign windows binary if fully configured.
341+
@# Test variables set by joining with | between and looking for || showing at least one variable is empty.
342+
@# Move the binary to a temporary location and sign it there to avoid the target being up-to-date if signing fails.
343+
set -e; \
344+
if [[ "${TARGET}" = "windows-amd64" && ${SKIP_SIGNING} != "true" ]]; then \
345+
if [[ "|${AZURE_SIGNING_CLIENT_ID}|${AZURE_SIGNING_CLIENT_SECRET}|${AZURE_SIGNING_TENANT_ID}|${AZURE_SIGNING_KEY_VAULT_URI}|" == *"||"* ]]; then \
346+
echo "Can't sign windows binaries as required configuration not set: AZURE_SIGNING_CLIENT_ID, AZURE_SIGNING_CLIENT_SECRET, AZURE_SIGNING_TENANT_ID, AZURE_SIGNING_KEY_VAULT_URI"; \
347+
echo "To rebuild with signing delete the unsigned $@ and rebuild with the fixed configuration"; \
348+
if [[ ${CI} == "true" ]]; then exit 1; fi; \
349+
else \
350+
351+
az login --service-principal \
352+
--username "${AZURE_SIGNING_CLIENT_ID}" \
353+
--password "${AZURE_SIGNING_CLIENT_SECRET}" \
354+
--tenant "${AZURE_SIGNING_TENANT_ID}" \
355+
--output none; \
356+
ACCESS_TOKEN=$$(az account get-access-token --resource "https://vault.azure.net" | jq -r .accessToken); \
357+
java -jar bin/jsign-6.0.jar \
358+
--storetype AZUREKEYVAULT \
359+
--keystore "PulumiCodeSigning" \
360+
--url "${AZURE_SIGNING_KEY_VAULT_URI}" \
361+
--storepass "$${ACCESS_TOKEN}" \
362+
363+
364+
az logout; \
365+
fi; \
366+
fi
367+
368+
bin/jsign-6.0.jar:
369+
wget https://github.com/ebourg/jsign/releases/download/6.0/jsign-6.0.jar --output-document=bin/jsign-6.0.jar
370+
333371
provider-linux-amd64: bin/linux-amd64/$(PROVIDER)
334372
provider-linux-arm64: bin/linux-arm64/$(PROVIDER)
335373
provider-darwin-amd64: bin/darwin-amd64/$(PROVIDER)

0 commit comments

Comments
 (0)