Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor the github actions has-secrets logic (SIBLING DRAFT PR FOR TESTS) #26806

Closed
wants to merge 5 commits into from
Closed
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
24 changes: 24 additions & 0 deletions .github/workflows/check-secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Check Secrets

on:
workflow_call:
inputs:
secret_name:
required: true
type: string

jobs:
check-secrets:
runs-on: ubuntu-latest
outputs:
has-secrets: ${{ steps.check.outputs.has-secrets }}
steps:
- id: check
run: |
if [[ -n "${{ secrets[inputs.secret_name] }}" ]]; then
echo "has-secrets=true" >> "$GITHUB_OUTPUT"
echo "Secret ${{ inputs.secret_name }} is available"
else
echo "has-secrets=false" >> "$GITHUB_OUTPUT"
echo "Secret ${{ inputs.secret_name }} is NOT available"
fi
21 changes: 6 additions & 15 deletions .github/workflows/chromatic-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,13 @@ on:

# List of jobs
jobs:
config:
runs-on: "ubuntu-latest"
outputs:
has-secrets: ${{ steps.check.outputs.has-secrets }}
steps:
- name: "Check for secrets"
id: check
shell: bash
run: |
if [ -n "${{ (secrets.CHROMATIC_PROJECT_TOKEN != '') || '' }}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
fi

check-secrets:
uses: ./.github/workflows/check-secrets.yml
with:
secret_name: 'CHROMATIC_PROJECT_TOKEN'
chromatic-deployment:
needs: config
if: needs.config.outputs.has-secrets
needs: check-secrets
if: needs.check-secrets.outputs.has-secrets == 'true'
# Operating System
runs-on: ubuntu-latest
# Job steps
Expand Down
21 changes: 6 additions & 15 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,13 @@ on:
release:
types: [published]
jobs:
config:
runs-on: "ubuntu-latest"
outputs:
has-secrets: ${{ steps.check.outputs.has-secrets }}
steps:
- name: "Check for secrets"
id: check
shell: bash
run: |
if [ -n "${{ (secrets.DOCKERHUB_USER != '' && secrets.DOCKERHUB_TOKEN != '') || '' }}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
fi

check-secrets:
uses: ./.github/workflows/check-secrets.yml
with:
secret_name: 'DOCKERHUB_USER'
docker-release:
needs: config
if: needs.config.outputs.has-secrets
needs: check-secrets
if: needs.check-secrets.outputs.has-secrets == 'true'
name: docker-release
runs-on: ubuntu-latest
strategy:
Expand Down
21 changes: 6 additions & 15 deletions .github/workflows/ephemeral-env-pr-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,13 @@ on:
types: [closed]

jobs:
config:
runs-on: "ubuntu-latest"
outputs:
has-secrets: ${{ steps.check.outputs.has-secrets }}
steps:
- name: "Check for secrets"
id: check
shell: bash
run: |
if [ -n "${{ (secrets.AWS_ACCESS_KEY_ID != '' && secrets.AWS_SECRET_ACCESS_KEY != '') || '' }}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
fi

check-secrets:
uses: ./.github/workflows/check-secrets.yml
with:
secret_name: 'AWS_SECRET_ACCESS_KEY'
ephemeral-env-cleanup:
needs: config
if: needs.config.outputs.has-secrets
needs: check-secrets
if: needs.check-secrets.outputs.has-secrets == 'true'
name: Cleanup ephemeral envs
runs-on: ubuntu-latest
permissions:
Expand Down
26 changes: 8 additions & 18 deletions .github/workflows/ephemeral-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,13 @@ on:
types: [created]

jobs:
config:
runs-on: "ubuntu-latest"
if: github.event.issue.pull_request
outputs:
has-secrets: ${{ steps.check.outputs.has-secrets }}
steps:
- name: "Check for secrets"
id: check
shell: bash
run: |
if [ -n "${{ (secrets.AWS_ACCESS_KEY_ID != '' && secrets.AWS_SECRET_ACCESS_KEY != '') || '' }}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
fi

check-secrets:
uses: ./.github/workflows/check-secrets.yml
with:
secret_name: 'AWS_SECRET_ACCESS_KEY'
ephemeral_env_comment:
needs: config
if: needs.config.outputs.has-secrets
needs: check-secrets
if: needs.check-secrets.outputs.has-secrets == 'true'
name: Evaluate ephemeral env comment trigger (/testenv)
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -80,8 +70,8 @@ jobs:
core.setFailed(errMsg)

docker_ephemeral_env:
needs: config
if: needs.config.outputs.has-secrets
needs: check-secrets
if: needs.check-secrets.outputs.has-secrets == 'true'
name: Push ephemeral env Docker image to ECR
runs-on: ubuntu-latest

Expand Down
21 changes: 6 additions & 15 deletions .github/workflows/license-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,13 @@ on:
types: [synchronize, opened, reopened, ready_for_review]

jobs:
config:
runs-on: "ubuntu-latest"
outputs:
has-secrets: ${{ steps.check.outputs.has-secrets }}
steps:
- name: "Check for secrets"
id: check
shell: bash
run: |
if [ -n "${{ (secrets.FOSSA_API_KEY != '' ) || '' }}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
fi

check-secrets:
uses: ./.github/workflows/check-secrets.yml
with:
secret_name: 'FOSSA_API_KEY'
license_check:
needs: config
if: needs.config.outputs.has-secrets
needs: check-secrets
if: needs.check-secrets.outputs.has-secrets == 'true'
name: License Check
runs-on: ubuntu-20.04
steps:
Expand Down
23 changes: 7 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
name: release-workflow
name: npm-release-workflow

on:
push:
branches:
- 'master'

jobs:
config:
runs-on: "ubuntu-latest"
outputs:
has-secrets: ${{ steps.check.outputs.has-secrets }}
steps:
- name: "Check for secrets"
id: check
shell: bash
run: |
if [ -n "${{ (secrets.NPM_TOKEN != '' && secrets.GH_PERSONAL_ACCESS_TOKEN != '') || '' }}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
fi

check-secrets:
uses: ./.github/workflows/check-secrets.yml
with:
secret_name: 'NPM_TOKEN' # also note that GH_PERSONAL_ACCESS_TOKEN is used
build:
needs: config
if: needs.config.outputs.has-secrets
needs: check-secrets
if: needs.check-secrets.outputs.has-secrets == 'true'
name: Bump version and publish package(s)

runs-on: ubuntu-20.04
Expand Down
21 changes: 6 additions & 15 deletions .github/workflows/superset-applitool-cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,13 @@ on:
- cron: "0 1 * * *"

jobs:
config:
runs-on: "ubuntu-latest"
outputs:
has-secrets: ${{ steps.check.outputs.has-secrets }}
steps:
- name: "Check for secrets"
id: check
shell: bash
run: |
if [ -n "${{ (secrets.APPLITOOLS_API_KEY != '' && secrets.APPLITOOLS_API_KEY != '') || '' }}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
fi

check-secrets:
uses: ./.github/workflows/check-secrets.yml
with:
secret_name: 'APPLITOOLS_API_KEY'
cypress-applitools:
needs: config
if: needs.config.outputs.has-secrets
needs: check-secrets
if: needs.check-secrets.outputs.has-secrets == 'true'
runs-on: ubuntu-20.04
strategy:
fail-fast: false
Expand Down
21 changes: 6 additions & 15 deletions .github/workflows/superset-applitools-storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,13 @@ env:
APPLITOOLS_BATCH_NAME: Superset Storybook

jobs:
config:
runs-on: "ubuntu-latest"
outputs:
has-secrets: ${{ steps.check.outputs.has-secrets }}
steps:
- name: "Check for secrets"
id: check
shell: bash
run: |
if [ -n "${{ (secrets.APPLITOOLS_API_KEY != '' && secrets.APPLITOOLS_API_KEY != '') || '' }}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
fi

check-secrets:
uses: ./.github/workflows/check-secrets.yml
with:
secret_name: 'APPLITOOLS_API_KEY'
cron:
needs: config
if: needs.config.outputs.has-secrets
needs: check-secrets
if: needs.check-secrets.outputs.has-secrets == 'true'
runs-on: ubuntu-20.04
strategy:
matrix:
Expand Down
21 changes: 6 additions & 15 deletions .github/workflows/superset-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,13 @@ on:
types: [synchronize, opened, reopened, ready_for_review]

jobs:
config:
runs-on: "ubuntu-latest"
outputs:
has-secrets: ${{ steps.check.outputs.has-secrets }}
steps:
- name: "Check for secrets"
id: check
shell: bash
run: |
if [ -n "${{ (secrets.SUPERSET_SITE_BUILD != '' && secrets.SUPERSET_SITE_BUILD != '') || '' }}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
fi

check-secrets:
uses: ./.github/workflows/check-secrets.yml
with:
secret_name: 'SUPERSET_SITE_BUILD'
build-deploy:
needs: config
if: needs.config.outputs.has-secrets
needs: check-secrets
if: needs.check-secrets.outputs.has-secrets == 'true'
name: Build & Deploy
runs-on: ubuntu-20.04
defaults:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: Translations
name: Frontend Translations

on:
push:
branches:
- 'master'
- "master"
paths:
- "superset-frontend/**"
pull_request:
types: [synchronize, opened, reopened, ready_for_review]
paths:
- "superset-frontend/**"

jobs:
frontend-check:
Expand All @@ -19,7 +23,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: "16"
- name: Install dependencies
uses: ./.github/actions/cached-dependencies
with:
Expand Down
1 change: 0 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

This is the public documentation site for Superset, built using [Docusaurus 2](https://docusaurus.io/). See [CONTRIBUTING.md](../CONTRIBUTING.md#documentation) for documentation on contributing to documentation.
1 change: 1 addition & 0 deletions scripts/docker_build_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ cat<<EOF
- ${REPO_NAME}:${LATEST_TAG}
EOF


if [ -z "${DOCKERHUB_TOKEN}" ]; then
# Skip if secrets aren't populated -- they're only visible for actions running in the repo (not on forks)
echo "Skipping Docker push"
Expand Down
Loading