Skip to content

Commit

Permalink
CI: Add docs pipeline for main pipelines (grafana#45740)
Browse files Browse the repository at this point in the history
* Add docs pipeline for main

* Extract trigger docs

* Change trigger for main
  • Loading branch information
dsotirakis committed Feb 22, 2022
1 parent 4a804b5 commit ea3e41e
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -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() + \
Expand Down
64 changes: 54 additions & 10 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/
Expand Down Expand Up @@ -4261,6 +4305,6 @@ kind: secret
name: gcp_upload_artifacts_key
---
kind: signature
hmac: f209cfff82a4817d7bae67872ce1a34a4a26915451ae35b4f8c9848003b18b91
hmac: db5cfbb53d8385e4eab31a818388c5c3cc57693e4bcd0764dcf058fc2aa93cbe

...
18 changes: 9 additions & 9 deletions scripts/drone/pipelines/docs.star
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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': {
Expand All @@ -45,8 +50,3 @@ def docs_pipelines(edition):
],
},
}
return [
pipeline(
name='pr-docs', edition=edition, trigger=trigger, services=[], steps=steps,
),
]
8 changes: 6 additions & 2 deletions scripts/drone/pipelines/main.star
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 7 additions & 1 deletion scripts/drone/pipelines/pr.star
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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())
]

0 comments on commit ea3e41e

Please sign in to comment.