CI: Add docs pipeline for main pipelines (#45740)

* Add docs pipeline for main

* Extract trigger docs

* Change trigger for main
This commit is contained in:
Dimitris Sotirakis 2022-02-22 20:06:14 +02:00 committed by GitHub
parent 4a804b57f7
commit ea3e41ea62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 77 additions and 23 deletions

View File

@ -14,7 +14,7 @@ load('scripts/drone/vault.star', 'secrets')
def main(ctx):
edition = 'oss'
return pr_pipelines(edition=edition) + docs_pipelines(edition=edition) + main_pipelines(edition=edition) + release_pipelines() + \
return pr_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

@ -464,6 +464,59 @@ volumes:
---
depends_on: []
kind: pipeline
name: main-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.4/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:
- yarn packages:build
- yarn packages:docsExtract
- yarn packages:docsToMarkdown
- ./scripts/ci-reference-docs-lint.sh ci
depends_on:
- initialize
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:
branch: main
event:
- push
type: docker
volumes:
- host:
path: /var/run/docker.sock
name: docker
---
depends_on: []
kind: pipeline
name: main-test
node:
type: no-parallel
@ -802,15 +855,6 @@ steps:
failure: ignore
image: grafana/build-container:1.4.9
name: publish-frontend-metrics
- commands:
- yarn packages:build
- yarn packages:docsExtract
- yarn packages:docsToMarkdown
- ./scripts/ci-reference-docs-lint.sh ci
depends_on:
- initialize
image: grafana/build-container:1.4.9
name: build-frontend-docs
- commands:
- ls dist/*.tar.gz*
- cp dist/*.tar.gz* packaging/docker/
@ -4261,6 +4305,6 @@ kind: secret
name: gcp_upload_artifacts_key
---
kind: signature
hmac: f209cfff82a4817d7bae67872ce1a34a4a26915451ae35b4f8c9848003b18b91
hmac: db5cfbb53d8385e4eab31a818388c5c3cc57693e4bcd0764dcf058fc2aa93cbe
...

View File

@ -23,9 +23,8 @@ load(
'pipeline',
)
ver_mode = 'pr'
def docs_pipelines(edition):
def docs_pipelines(edition, ver_mode, trigger):
steps = [download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode)
# Insert remaining steps
@ -34,8 +33,14 @@ def docs_pipelines(edition):
build_docs_website_step(),
])
trigger = {
'event': [
return pipeline(
name='{}-docs'.format(ver_mode), edition=edition, trigger=trigger, services=[], steps=steps,
)
def trigger_docs():
return {
'event': [
'pull_request',
],
'paths': {
@ -45,8 +50,3 @@ def docs_pipelines(edition):
],
},
}
return [
pipeline(
name='pr-docs', edition=edition, trigger=trigger, services=[], steps=steps,
),
]

View File

@ -18,7 +18,6 @@ load(
'e2e_tests_step',
'e2e_tests_artifacts',
'build_storybook_step',
'build_frontend_docs_step',
'copy_packages_for_docker_step',
'build_docker_images_step',
'publish_images_step',
@ -55,6 +54,11 @@ load(
'drone_change_template',
)
load(
'scripts/drone/pipelines/docs.star',
'docs_pipelines',
)
ver_mode = 'main'
def get_steps(edition, is_downstream=False):
@ -110,7 +114,6 @@ def get_steps(edition, is_downstream=False):
store_storybook_step(edition=edition, ver_mode=ver_mode),
test_a11y_frontend_step(ver_mode=ver_mode, edition=edition),
frontend_metrics_step(edition=edition),
build_frontend_docs_step(edition=edition),
copy_packages_for_docker_step(),
build_docker_images_step(edition=edition, ver_mode=ver_mode, publish=False),
build_docker_images_step(edition=edition, ver_mode=ver_mode, ubuntu=True, publish=False),
@ -171,6 +174,7 @@ def main_pipelines(edition):
integration_test_steps.append(benchmark_ldap_step())
pipelines = [
docs_pipelines(edition, ver_mode, trigger),
pipeline(
name='main-test', edition=edition, trigger=trigger, services=[],
steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode) + test_steps,

View File

@ -45,6 +45,12 @@ load(
'drone_change_template',
)
load(
'scripts/drone/pipelines/docs.star',
'docs_pipelines',
'trigger_docs',
)
ver_mode = 'pr'
def pr_pipelines(edition):
@ -133,5 +139,5 @@ def pr_pipelines(edition):
name='pr-integration-tests', edition=edition, trigger=trigger, services=services,
steps=[download_grabpl_step()] + integration_test_steps,
volumes=volumes,
),
), docs_pipelines(edition, ver_mode, trigger_docs())
]