CI: Introduce docs pipeline (#45454)

* Add docs.star

* Fixes in drone yaml

* Add grabpl

* Remove unnecessary steps

(cherry picked from commit f2e03cdb107eb283416885a73051c1ff86eb8b7f)

* Rename docs pipeline

* Exclude docs related steps from PR pipelines

* Add packages/** trigger

* Remove packages exclusion from pr pipelines
This commit is contained in:
Dimitris Sotirakis 2022-02-21 13:55:16 +02:00 committed by GitHub
parent 0dfde923e3
commit 434697e0fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 137 additions and 21 deletions

View File

@ -6,6 +6,7 @@
load('scripts/drone/pipelines/pr.star', 'pr_pipelines')
load('scripts/drone/pipelines/main.star', 'main_pipelines')
load('scripts/drone/pipelines/docs.star', 'docs_pipelines')
load('scripts/drone/pipelines/release.star', 'release_pipelines', 'publish_image_pipelines', 'publish_artifacts_pipelines', 'publish_npm_pipelines', 'publish_packages_pipeline')
load('scripts/drone/version.star', 'version_branch_pipelines')
load('scripts/drone/pipelines/cron.star', 'cronjobs')
@ -13,7 +14,7 @@ load('scripts/drone/vault.star', 'secrets')
def main(ctx):
edition = 'oss'
return pr_pipelines(edition=edition) + main_pipelines(edition=edition) + release_pipelines() + \
return pr_pipelines(edition=edition) + docs_pipelines(edition=edition) + main_pipelines(edition=edition) + release_pipelines() + \
publish_image_pipelines('public') + publish_image_pipelines('security') + \
publish_artifacts_pipelines('security') + publish_artifacts_pipelines('public') + \
publish_npm_pipelines('public') + publish_packages_pipeline() + \

View File

@ -93,6 +93,9 @@ steps:
trigger:
event:
- pull_request
paths:
exclude:
- docs/**
type: docker
volumes:
- host:
@ -288,20 +291,6 @@ steps:
failure: always
image: grafana/docker-puppeteer:1.0.0
name: test-a11y-frontend
- commands:
- ./scripts/ci-reference-docs-lint.sh ci
depends_on:
- build-frontend
image: grafana/build-container:1.4.9
name: build-frontend-docs
- commands:
- mkdir -p /hugo/content/docs/grafana
- cp -r docs/sources/* /hugo/content/docs/grafana/latest/
- cd /hugo && make prod
depends_on:
- build-frontend-docs
image: grafana/docs-base:latest
name: build-docs-website
- commands:
- ls dist/*.tar.gz*
- cp dist/*.tar.gz* packaging/docker/
@ -324,6 +313,9 @@ steps:
trigger:
event:
- pull_request
paths:
exclude:
- docs/**
type: docker
volumes:
- host:
@ -399,6 +391,9 @@ steps:
trigger:
event:
- pull_request
paths:
exclude:
- docs/**
type: docker
volumes:
- host:
@ -413,6 +408,68 @@ volumes:
---
depends_on: []
kind: pipeline
name: pr-docs
node:
type: no-parallel
platform:
arch: amd64
os: linux
services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.9.3/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- echo $DRONE_RUNNER_NAME
image: alpine:3.15
name: identify-runner
- commands:
- make gen-go
- ./bin/grabpl gen-version --build-id ${DRONE_BUILD_NUMBER}
- yarn install --immutable
image: grafana/build-container:1.4.9
name: initialize
- commands:
- ./bin/grabpl build-frontend --jobs 8 --no-install-deps --edition oss --build-id
${DRONE_BUILD_NUMBER} --no-pull-enterprise
depends_on:
- initialize
environment:
NODE_OPTIONS: --max_old_space_size=8192
image: grafana/build-container:1.4.9
name: build-frontend
- commands:
- ./scripts/ci-reference-docs-lint.sh ci
depends_on:
- build-frontend
image: grafana/build-container:1.4.9
name: build-frontend-docs
- commands:
- mkdir -p /hugo/content/docs/grafana
- cp -r docs/sources/* /hugo/content/docs/grafana/latest/
- cd /hugo && make prod
depends_on:
- build-frontend-docs
image: grafana/docs-base:latest
name: build-docs-website
trigger:
event:
- pull_request
paths:
include:
- docs/**
- packages/**
type: docker
volumes:
- host:
path: /var/run/docker.sock
name: docker
---
depends_on: []
kind: pipeline
name: main-test
node:
type: no-parallel
@ -4209,6 +4266,6 @@ kind: secret
name: gcp_upload_artifacts_key
---
kind: signature
hmac: de49a9ed2dffc5131de65688dc0175fc07029d507d654df360f3e683a138b43c
hmac: 703b9a44a073ab768a774029cee2c3fc7c5fe7b7e01495e18f048bc7d1f007b0
...

View File

@ -0,0 +1,55 @@
load(
'scripts/drone/steps/lib.star',
'initialize_step',
'download_grabpl_step',
'lint_frontend_step',
'codespell_step',
'shellcheck_step',
'build_frontend_step',
'test_frontend_step',
'build_storybook_step',
'build_frontend_docs_step',
'build_docs_website_step',
)
load(
'scripts/drone/services/services.star',
'integration_test_services',
'ldap_service',
)
load(
'scripts/drone/utils/utils.star',
'pipeline',
)
ver_mode = 'pr'
def docs_pipelines(edition):
steps = [download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode)
steps.extend([
build_frontend_step(edition=edition, ver_mode=ver_mode),
])
# Insert remaining steps
steps.extend([
build_frontend_docs_step(edition=edition),
build_docs_website_step(),
])
trigger = {
'event': [
'pull_request',
],
'paths': {
'include': [
'docs/**',
'packages/**',
],
},
}
return [
pipeline(
name='pr-docs', edition=edition, trigger=trigger, services=[], steps=steps,
),
]

View File

@ -18,8 +18,6 @@ load(
'e2e_tests_step',
'e2e_tests_artifacts',
'build_storybook_step',
'build_frontend_docs_step',
'build_docs_website_step',
'copy_packages_for_docker_step',
'build_docker_images_step',
'postgres_integration_tests_step',
@ -100,8 +98,6 @@ def pr_pipelines(edition):
e2e_tests_artifacts(edition=edition),
build_storybook_step(edition=edition, ver_mode=ver_mode),
test_a11y_frontend_step(ver_mode=ver_mode, edition=edition),
build_frontend_docs_step(edition=edition),
build_docs_website_step(),
copy_packages_for_docker_step(),
build_docker_images_step(edition=edition, ver_mode=ver_mode, archs=['amd64',]),
])
@ -116,7 +112,14 @@ def pr_pipelines(edition):
])
trigger = {
'event': ['pull_request',],
'event': [
'pull_request',
],
'paths': {
'exclude': [
'docs/**',
],
},
}
return [