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

Replace Jenkins builds on any branch prefixed with docs/ with github action #3689

Merged
merged 2 commits into from
Mar 27, 2024
Merged
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
38 changes: 38 additions & 0 deletions .github/workflows/test-mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Test mkdocs
on:
push:
branches:
- 'docs/**'
pull_request:
branches:
- 'main'
paths:
- 'docs/**'
- 'mkdocs.yml'
- '.github/workflows/test-mkdocs.yml'

jobs:
mkdocs:
runs-on: ubuntu-latest
steps:
-
name: Checkout PR
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Install mkdocs and dependencies
run: |
pip install --upgrade pip
pip install mkdocs
pip install -r docs/requirements.txt
-
name: Check docs build ok in native mkdocs
run: |
mkdocs -V
mkdocs build -s
-
name: Check docs build ok with amazee.io mkdocs image
run: |
docker run --rm ghcr.io/amazeeio/mkdocs-material -V
docker run --rm -p 8000:8000 -v ${PWD}:/docs ghcr.io/amazeeio/mkdocs-material build -s
63 changes: 62 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
def skipRemainingStages = false

pipeline {
agent { label 'lagoon' }
environment {
Expand All @@ -20,6 +22,20 @@ pipeline {
sh 'env'
}
}
stage ('skip on docs commit') {
when {
anyOf {
changeRequest branch: 'docs\\/.*', comparator: 'REGEXP'
branch pattern: "docs\\/.*", comparator: "REGEXP"
}
}
steps {
script {
skipRemainingStages = true
echo "Docs only update, no build needed."
}
}
}
// in order to have the newest images from upstream (with all the security
// updates) we clean our local docker cache on tag deployments
// we don't do this all the time to still profit from image layer caching
Expand All @@ -28,12 +44,20 @@ pipeline {
stage ('clean docker image cache') {
when {
buildingTag()
expression {
!skipRemainingStages
}
}
steps {
sh script: "docker image prune -af", label: "Pruning images"
}
}
stage ('build and push images') {
when {
expression {
!skipRemainingStages
}
}
environment {
PASSWORD = credentials('amazeeiojenkins-dockerhub-password')
}
Expand All @@ -46,11 +70,21 @@ pipeline {
}
}
stage ('show trivy scan results') {
when {
expression {
!skipRemainingStages
}
}
steps {
sh script: "cat scan.txt", label: "Display scan results"
}
}
stage ('setup test cluster') {
when {
expression {
!skipRemainingStages
}
}
parallel {
stage ('0: setup test cluster') {
steps {
Expand All @@ -72,6 +106,11 @@ pipeline {
}
}
stage ('run first test suite') {
when {
expression {
!skipRemainingStages
}
}
parallel {
stage ('1: run first test suite') {
steps {
Expand Down Expand Up @@ -106,6 +145,11 @@ pipeline {
}
}
stage ('run second test suite') {
when {
expression {
!skipRemainingStages
}
}
parallel {
stage ('2: run second test suite') {
steps {
Expand All @@ -126,6 +170,11 @@ pipeline {
}
}
stage ('run third test suite') {
when {
expression {
!skipRemainingStages
}
}
parallel {
stage ('3: run third test suite') {
steps {
Expand All @@ -146,11 +195,14 @@ pipeline {
}
}
stage ('push images to testlagoon/* with :latest tag') {
when {
when {
branch 'main'
not {
environment name: 'SKIP_IMAGE_PUBLISH', value: 'true'
}
expression {
!skipRemainingStages
}
}
environment {
PASSWORD = credentials('amazeeiojenkins-dockerhub-password')
Expand All @@ -166,6 +218,9 @@ pipeline {
not {
environment name: 'SKIP_IMAGE_PUBLISH', value: 'true'
}
expression {
!skipRemainingStages
}
}
environment {
TOKEN = credentials('git-amazeeio-helmfile-ci-trigger')
Expand All @@ -180,6 +235,9 @@ pipeline {
not {
environment name: 'SKIP_IMAGE_PUBLISH', value: 'true'
}
expression {
!skipRemainingStages
}
}
environment {
PASSWORD = credentials('amazeeiojenkins-dockerhub-password')
Expand All @@ -195,6 +253,9 @@ pipeline {
branch 'testing/scans'
buildingTag()
}
expression {
!skipRemainingStages
}
}
steps {
sh script: 'make scan-images', label: "perform scan routines"
Expand Down