Skip to content

Commit e31f1f6

Browse files
committed
OIDC ctx testing
1 parent 9523af1 commit e31f1f6

2 files changed

Lines changed: 83 additions & 13 deletions

File tree

.github/workflows/docs-build-push.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Docs Build Push
33
on:
44
workflow_call:
55
secrets:
6-
AZURE_CREDENTIALS:
6+
AZURE_CREDS_DOCS_OIDC:
77
required: true
88
AZURE_KEY_VAULT:
99
required: true
@@ -88,6 +88,10 @@ jobs:
8888
needs: [checks]
8989
if: ${{ needs.checks.outputs.forked_workflow == 'false' }}
9090
runs-on: ubuntu-24.04
91+
permissions:
92+
id-token: write
93+
contents: read
94+
issues: write
9195
outputs:
9296
PREVIEW_URL: ${{ steps.summary.outputs.PREVIEW_URL }}
9397
env:
@@ -164,20 +168,14 @@ jobs:
164168
- name: Azure login
165169
uses: azure/login@a65d910e8af852a8061c627c456678983e180302 # v2.2.0
166170
with:
167-
creds: ${{ secrets.AZURE_CREDENTIALS }}
171+
auth-type: 'IDENTITY'
172+
creds: ${{ secrets.AZURE_CREDS_DOCS_OIDC }}
168173

169-
- name: Retrieve secrets from Keyvault
170-
id: keyvault
171-
uses: azure/cli@089eac9d8cc39f5d003e94f8b65efc51076c9cbd # v2.1.0
174+
- name: Retrieve secrets from keyvault
175+
uses: nginx/ci-self-hosted/.github/actions/get-from-vault@refs/heads/main
172176
with:
173-
inlineScript: |
174-
secrets_get=(resourceGroupName cdnProfileName cdnName accountName)
175-
for secret_get in ${secrets_get[@]}
176-
do
177-
value=$(az keyvault secret show --name $secret_get --vault-name ${{ secrets.AZURE_KEY_VAULT }} --query value --output tsv)
178-
echo "::add-mask::$value"
179-
echo "$secret_get=$value" >> $GITHUB_OUTPUT
180-
done
177+
vault-name: ${{ secrets.AZURE_KEY_VAULT }}
178+
secret-names: resourceGroupName, cdnProfileName, cdnName, accountName
181179

182180
- name: Checkout docs content
183181
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.7.1
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Docs Build & Deploy (Hugo Only)
2+
on:
3+
workflow_call:
4+
secrets:
5+
OIDC_TENANT_ID:
6+
required: true
7+
OIDC_CLIENT_ID:
8+
required: true
9+
inputs:
10+
NODE_DEPS:
11+
type: boolean
12+
BUILD_ROOT:
13+
type: string
14+
description: Root directory to start a build
15+
default: ./
16+
required: false
17+
outputs:
18+
PREVIEW_URL:
19+
description: String
20+
21+
22+
env:
23+
GO_VERISON: "1.21" # Go version used for `hugo mod get`
24+
HUGO_VERSION: "0.147.8" # Hugo version used for building docs
25+
THEME_MODULE: "github.com/nginxinc/nginx-hugo-theme/v2" # Name of source repo for module. For example; github.com/nginxinc/nginx-hugo-theme
26+
27+
28+
jobs:
29+
checks:
30+
name: Checks and variables
31+
runs-on: ubuntu-24.04
32+
permissions:
33+
contents: read
34+
outputs:
35+
forked_workflow: ${{ steps.vars.outputs.forked_workflow }}
36+
steps:
37+
- name: Checkout Repository
38+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39+
40+
- name: Set Variables
41+
id: vars
42+
run: |
43+
echo "forked_workflow=${{ (github.event.pull_request && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) || !(startsWith(github.repository, 'nginx/') || startsWith(github.repository, 'nginxinc/')) }}" >> $GITHUB_OUTPUT
44+
- name: Output variables
45+
run: |
46+
echo forked_workflow: ${{ steps.vars.outputs.forked_workflow }}
47+
build:
48+
runs-on: ubuntu-24.04
49+
concurrency:
50+
group: ${{ github.workflow }}-${{ github.ref }}
51+
outputs:
52+
PREVIEW_URL: ${{ steps.summary.outputs.PREVIEW_URL }}
53+
steps:
54+
- name: Azure login
55+
uses: azure/login@a65d910e8af852a8061c627c456678983e180302
56+
with:
57+
client-id: ${{ secrets.OIDC_CLIENT_ID }}
58+
tenant-id: ${{ secrets.OIDC_TENANT_ID }}
59+
60+
- name: Checkout docs content
61+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.7.1
62+
with:
63+
fetch-depth: 0 # This is required for hugo Lastmod to function properly
64+
65+
- name: Setup Go
66+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
67+
with:
68+
go-version: ${{ env.GO_VERSION }}
69+
cache: false
70+
71+
- name: Setup Hugo
72+
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0

0 commit comments

Comments
 (0)