Skip to content

feat(actions): Moving datahub-actions into oss datahub #13120

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

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
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
8 changes: 8 additions & 0 deletions .github/actions/ci-optimization/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ outputs:
smoke-test-change:
description: "Smoke test change"
value: ${{ steps.filter.outputs.smoke-test == 'true' }}
actions-change:
description: "Actions code has changed"
value: ${{ steps.filter.outputs.actions == 'true' }}

runs:
using: "composite"
steps:
Expand Down Expand Up @@ -97,3 +101,7 @@ runs:
- "docker/elasticsearch-setup/**"
smoke-test:
- "smoke-test/**"
actions:
- "datahub-actions/**"
- "docker/datahub-actions/**"

68 changes: 68 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: DataHub Actions
on:
push:
branches:
- master
paths:
- ".github/workflows/actions.yml"
- "datahub-actions/**"
- "metadata-ingestion/**"
- "metadata-models/**"
pull_request:
branches:
- "**"
paths:
- ".github/workflows/actions.yml"
- "datahub-actions/**"
- "metadata-ingestion/**"
- "metadata-models/**"
release:
types: [published]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Test packages are correct
run: |
cd datahub-actions;
python -c 'import setuptools; where="./src"; assert setuptools.find_packages(where) == setuptools.find_namespace_packages(where), "you seem to be missing or have extra __init__.py files"'
- name: Gradle build (and test)
run: |
./gradlew :datahub-actions:build

- uses: actions/upload-artifact@v4
if: always()
with:
name: Test Results (build)
path: |
**/build/reports/tests/test/**
**/build/test-results/test/**
**/junit.*.xml
- name: Upload datahub-actions coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
#handle_no_reports_found: true
fail_ci_if_error: false
name: datahub-actions
verbose: true

event-file:
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}
71 changes: 69 additions & 2 deletions .github/workflows/docker-unified.yml

Choose a reason for hiding this comment

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

📝 [actionlint] reported by reviewdog 🐶
shellcheck reported issue in this script: SC2059:info:2:24: Don't use variables in the printf format string. Use printf '..%s..' "$foo" [shellcheck]

Choose a reason for hiding this comment

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

📝 [actionlint] reported by reviewdog 🐶
shellcheck reported issue in this script: SC2059:info:5:25: Don't use variables in the printf format string. Use printf '..%s..' "$foo" [shellcheck]

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ env:
DATAHUB_UPGRADE_IMAGE: "acryldata/datahub-upgrade"
DATAHUB_INGESTION_BASE_IMAGE: "acryldata/datahub-ingestion-base"
DATAHUB_INGESTION_IMAGE: "acryldata/datahub-ingestion"
DATAHUB_ACTIONS_IMAGE: "acryldata/datahub-actions"

DOCKER_CACHE: "DEPOT"
DEPOT_PROJECT_ID: "${{ vars.DEPOT_PROJECT_ID }}"
Expand Down Expand Up @@ -60,6 +61,7 @@ jobs:
branch_name: ${{ steps.tag.outputs.branch_name }}
repository_name: ${{ steps.tag.outputs.repository_name }}
frontend_change: ${{ steps.ci-optimize.outputs.frontend-change == 'true' }}
actions_change: ${{ steps.ci-optimize.outputs.actions-change == 'true' }}
ingestion_change: ${{ steps.ci-optimize.outputs.ingestion-change == 'true' }}
ingestion_base_change: ${{ steps.ci-optimize.outputs.ingestion-base-change == 'true' }}
backend_change: ${{ steps.ci-optimize.outputs.backend-change == 'true' }}
Expand Down Expand Up @@ -1030,6 +1032,72 @@ jobs:
with:
sarif_file: "trivy-results.sarif"

datahub_actions_build:
name: Build and Push DataHub Actions Docker Image
runs-on: depot-ubuntu-24.04
needs: [setup, base_build]
if: ${{ needs.setup.outputs.actions_change == 'true' || needs.setup.outputs.publish == 'true' || needs.setup.outputs.pr-publish == 'true'}}
steps:
- name: Check out the repo
uses: acryldata/sane-checkout-action@v3

- name: Set up Depot CLI
if: ${{ env.DOCKER_CACHE == 'DEPOT' }}
uses: depot/setup-action@v1

- uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/build/dockerBuildContext/
key: ${{ runner.os }}-docker-${{ github.sha }}

- name: Build and push
uses: ./.github/actions/docker-custom-build-and-push
with:
images: |
${{ env.DATAHUB_ACTIONS_IMAGE }}
image_tag: ${{ needs.setup.outputs.tag }}
username: ${{ secrets.ACRYL_DOCKER_USERNAME }}
password: ${{ secrets.ACRYL_DOCKER_PASSWORD }}
publish: ${{ needs.setup.outputs.publish == 'true' || needs.setup.outputs.pr-publish == 'true' }}
context: ./build/dockerBuildContext/datahub-frontend/docker
file: ./docker/datahub-frontend/Dockerfile
platforms: linux/amd64,linux/arm64/v8
datahub_actions_scan:
name: "[Monitoring] Scan Datahub Actions images for vulnerabilities"
runs-on: depot-ubuntu-24.04
needs: [setup, smoke_test_lint,datahub_actions_build]
if: ${{ needs.setup.outputs.actions_change == 'true' || needs.setup.outputs.publish == 'true' }}
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
steps:
- name: Checkout # adding checkout step just to make trivy upload happy
uses: actions/checkout@v4
- name: Download image
uses: ishworkh/[email protected]
if: ${{ needs.setup.outputs.publish != 'true' && needs.setup.outputs.pr-publish != 'true' }}
with:
image: ${{ env.DATAHUB_ACTIONS_IMAGE }}:${{ needs.setup.outputs.unique_tag }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
env:
TRIVY_OFFLINE_SCAN: true
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db:2,ghcr.io/aquasecurity/trivy-db:2
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db:1,ghcr.io/aquasecurity/trivy-java-db:1
with:
image-ref: ${{ env.DATAHUB_ACTIONS_IMAGE }}:${{ needs.setup.outputs.unique_tag }}
format: "template"
template: "@/contrib/sarif.tpl"
output: "trivy-results.sarif"
severity: "CRITICAL,HIGH"
ignore-unfixed: true
vuln-type: "os,library"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "trivy-results.sarif"

smoke_test_matrix:
runs-on: depot-ubuntu-24.04-small
needs: setup
Expand Down Expand Up @@ -1152,8 +1220,7 @@ jobs:
env:
DATAHUB_TELEMETRY_ENABLED: false
DATAHUB_VERSION: ${{ needs.setup.outputs.unique_tag }}
DATAHUB_ACTIONS_IMAGE: ${{ env.DATAHUB_INGESTION_BASE_IMAGE }}
ACTIONS_VERSION: ${{ needs.datahub_ingestion_slim_build.outputs.tag || 'head-slim' }}
DATAHUB_ACTIONS_IMAGE: ${{ env.DATAHUB_ACTIONS_IMAGE }}
ACTIONS_EXTRA_PACKAGES: "acryl-datahub-actions[executor] acryl-datahub-actions"
ACTIONS_CONFIG: "https://raw.githubusercontent.com/acryldata/datahub-actions/main/docker/config/executor.yaml"
run: |
Expand Down
24 changes: 24 additions & 0 deletions datahub-actions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
venv*/
.coverage

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
junit.*xml
Loading
Loading