Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ on:
- "main"

env:
FRONT_DOOR_USERNAME: ${{ secrets.FRONT_DOOR_USERNAME }}
FRONT_DOOR_PASSWORD: ${{ secrets.FRONT_DOOR_PASSWORD }}
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
jobs:
prod-check-branch:
Expand Down Expand Up @@ -85,6 +83,15 @@ jobs:
runs-on: ubuntu-latest
permissions: read-all
steps:
- name: Get secrets
uses: nginx/ci-self-hosted/.github/actions/get-from-vault@refs/heads/main
with:
client-id: ${{secrets.DOCS_OIDC_CLIENT}}
tenant-id: ${{secrets.DOCS_OIDC_TENANT}}
vault-name: ${{secrets.AZURE_KEY_VAULT_DOCS}}
secret-names: "slack_webhook_url_friends_of_docs"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
secret-names: "slack_webhook_url_friends_of_docs"
secret-names: "slackWebhook-friendsOfDocs"

env-names: "SLACK_WEBHOOK_URL"

- name: Send notification
uses: 8398a7/action-slack@77eaa4f1c608a7d68b38af4e3f739dcd8cba273e # v3.19.0
with:
Expand Down Expand Up @@ -120,5 +127,4 @@ jobs:
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_FRIENDS_OF_DOCS }}
PREVIEW_URL: ${{ needs.call-docs-build-push.outputs.PREVIEW_URL }}
PREVIEW_URL: ${{ needs.call-docs-build-push.outputs.PREVIEW_URL }}
44 changes: 20 additions & 24 deletions .github/workflows/coveo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@ jobs:
- name: Install jq
run: sudo apt-get install jq

- name: Get secrets
uses: nginx/ci-self-hosted/.github/actions/get-from-vault@refs/heads/main
with:
client-id: ${{secrets.DOCS_OIDC_CLIENT}}
tenant-id: ${{secrets.DOCS_OIDC_TENANT}}
vault-name: ${{secrets.AZURE_KEY_VAULT_DOCS}}
secret-names: "${{matrix.env_api_key}}, ${{matrix.env_sphinx_api_key}}, slack_webhook_url_docs_incident"
env-names: "COVEO_API_KEY, COVEO_SPHINX_API_KEY, SLACK_WEBHOOK_URL"

Comment on lines +31 to +39

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${{matrix.env_sphinx_api_key}} evaluates to an empty string in environments other than prod. I'm guessing this is liable to cause issues in the reusable's handling.

If we move that specific call to its own conditional step that gets avoided.

      - name: Get secrets (Base)
        uses: nginx/ci-self-hosted/.github/actions/get-from-vault@refs/heads/main
        with:
          client-id: ${{secrets.DOCS_OIDC_CLIENT}}
          tenant-id: ${{secrets.DOCS_OIDC_TENANT}}
          vault-name: ${{secrets.AZURE_KEY_VAULT_DOCS}}
          secret-names: "${{matrix.env_api_key}}, slackWebhook-docsIncident"
          env-names: "COVEO_API_KEY, SLACK_WEBHOOK_URL"
      - name: Get secrets (SPHINX Prod)
        if: ${{ matrix.env_name == "prod" }}
        uses: nginx/ci-self-hosted/.github/actions/get-from-vault@refs/heads/main
        with:
          client-id: ${{secrets.DOCS_OIDC_CLIENT}}
          tenant-id: ${{secrets.DOCS_OIDC_TENANT}}
          vault-name: ${{secrets.AZURE_KEY_VAULT_DOCS}}
          secret-names: "${{matrix.env_sphinx_api_key}}"
          env-names: "COVEO_SPHINX_API_KEY"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you fetch ${{matrix.env_sphinx_api_key}} in the Base?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lamATnginx Haven't explicitly tested but the docs state it'll error out on an env-names argument mismatch or empty secret names.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Probably for the better that way from them. Then we yeah we need another step to pull the sphinx api key.

- name: Generating token for ${{matrix.env_name}} ...
id: generate-token
continue-on-error: true
env:
COVEO_API_KEY: ${{secrets[matrix.env_api_key]}}
COVEO_SPHINX_API_KEY: ${{secrets[matrix.env_sphinx_api_key]}}
COVEO_SEARCH_HUB: "HUB_ES_Nginx_Docs_And_Org"
run: |
RESPONSE=$(curl -w "\nHTTP_CODE: %{http_code}" -s -X POST "https://platform.cloud.coveo.com/rest/search/v2/token?organizationId=${{matrix.env_coveo_org_id}}" \
Expand Down Expand Up @@ -128,8 +135,6 @@ jobs:
}]
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_DOCS_INCIDENT }}


push-tokens-to-azure:
Expand All @@ -143,37 +148,28 @@ jobs:
- name: View files
run: ls -R

- name: Login to Azure
uses: azure/login@v2
with:
creds: ${{secrets.AZURE_CREDENTIALS_DOCS}}

- name: Retrieve secrets from Keyvault
id: keyvault
uses: azure/cli@9f7ce6f37c31b777ec6c6b6d1dfe7db79f497956
- name: Get secrets
uses: nginx/ci-self-hosted/.github/actions/get-from-vault@refs/heads/main
with:
inlineScript: |
secrets_get=(productionHostname previewHostname resourceGroupName cdnProfileName cdnName accountName)
for secret_get in ${secrets_get[@]}
do
value=$(az keyvault secret show --name $secret_get --vault-name ${{ secrets.AZURE_KEY_VAULT_DOCS }} --query value --output tsv)
echo "::add-mask::$value"
echo "$secret_get=$value" >> $GITHUB_OUTPUT
done
client-id: ${{secrets.DOCS_OIDC_CLIENT}}
tenant-id: ${{secrets.DOCS_OIDC_TENANT}}
vault-name: ${{secrets.AZURE_KEY_VAULT_DOCS}}
secret-names: "resourceGroupName, cdnProfileName, cdnName, accountName"
env-names: "resourceGroupName, cdnProfileName, cdnName, accountName"

- name: Push to Azure container storage
run: |
az storage blob upload-batch \
-s ./ \
-d '$web' \
--account-name ${{steps.keyvault.outputs.accountName}} \
--account-name ${{env.accountName}} \
--overwrite \
--content-cache-control "no-store" \
--auth-mode login

az afd endpoint purge \
--resource-group ${{steps.keyvault.outputs.resourceGroupName}} \
--profile-name ${{steps.keyvault.outputs.cdnProfileName}} \
--endpoint-name ${{steps.keyvault.outputs.cdnName}} \
--resource-group ${{env.resourceGroupName}} \
--profile-name ${{env.cdnProfileName}} \
--endpoint-name ${{env.cdnName}} \
--domains docs.nginx.com docs-dev.nginx.com docs-staging.nginx.com \
--content-paths '/.netlify/functions/*'
26 changes: 7 additions & 19 deletions .github/workflows/linkchecker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,31 +75,19 @@ jobs:
echo "isProduction=true" >> $GITHUB_ENV
fi

- name: Login to Azure
if: env.isProduction != 'true'
uses: azure/login@a65d910e8af852a8061c627c456678983e180302 # v2.2.0
- name: Get secrets
uses: nginx/ci-self-hosted/.github/actions/get-from-vault@refs/heads/main
with:
creds: ${{secrets.AZURE_CREDENTIALS_DOCS}}

- name: Retrieve secrets from Keyvault
if: env.isProduction != 'true'
id: keyvault
uses: azure/cli@9f7ce6f37c31b777ec6c6b6d1dfe7db79f497956
with:
inlineScript: |
secrets_get=(frontdoorUsername frontdoorPassword)
for secret_get in ${secrets_get[@]}
do
value=$(az keyvault secret show --name $secret_get --vault-name ${{ secrets.AZURE_KEY_VAULT_DOCS }} --query value --output tsv)
echo "::add-mask::$value"
echo "$secret_get=$value" >> $GITHUB_OUTPUT
done
client-id: ${{secrets.DOCS_OIDC_CLIENT}}
tenant-id: ${{secrets.DOCS_OIDC_TENANT}}
vault-name: ${{secrets.AZURE_KEY_VAULT_DOCS}}
secret-names: "frontdoorPassword,frontdoorUsername"

# Setup linkchecker command with optional password
- name: Setup LinkChecker Command
run: |
if [ "${{env.isProduction}}" != "true" ]; then
echo "cmd=echo '${{steps.keyvault.outputs.frontdoorPassword}}' | linkchecker -u '${{steps.keyvault.outputs.frontdoorUsername}}' ${{ env.basepath }}/${{ matrix.doc_paths }}/ ${{ env.defaults }} ${{ env.ignore }}" >> $GITHUB_ENV
echo "cmd=echo '${{env.FRONTDOORPASSWORD}}' | linkchecker -u '${{env.FRONTDOORUSERNAME}}' ${{ env.basepath }}/${{ matrix.doc_paths }}/ ${{ env.defaults }} ${{ env.ignore }}" >> $GITHUB_ENV
else
echo "cmd=linkchecker ${{ env.basepath }}/${{ matrix.doc_paths }}/ ${{ env.defaults }} ${{ env.ignore }}" >> $GITHUB_ENV
fi
Expand Down
38 changes: 0 additions & 38 deletions .github/workflows/mend.yml

This file was deleted.

10 changes: 8 additions & 2 deletions .github/workflows/notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ jobs:
job_url: check_data.html_url,
commit_message: message_sanitized,
}
- name: Get secrets
uses: nginx/ci-self-hosted/.github/actions/get-from-vault@refs/heads/main
with:
client-id: ${{secrets.DOCS_OIDC_CLIENT}}
tenant-id: ${{secrets.DOCS_OIDC_TENANT}}
vault-name: ${{secrets.AZURE_KEY_VAULT_DOCS}}
secret-names: "slack_webhook_url_docs_incident"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
secret-names: "slack_webhook_url_docs_incident"
secret-names: "slackWebhook-docsIncident"

env-names: "SLACK_WEBHOOK_URL"

- name: Send notification
uses: 8398a7/action-slack@77eaa4f1c608a7d68b38af4e3f739dcd8cba273e # v3.19.0
Expand Down Expand Up @@ -73,5 +81,3 @@ jobs:
}]
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_DOCS_INCIDENT }}
Loading