Compare commits

..

No commits in common. "master" and "v0.7.0" have entirely different histories.

375 changed files with 160550 additions and 24980 deletions

View File

@ -0,0 +1,4 @@
# Configuration for devbots-needs-triage - https://devbots.xyz/documentation/needs-triage/
enabled: true
label: "needs triage"

View File

@ -1,63 +0,0 @@
// For format details, see https://aka.ms/devcontainer.json
{
"name": "Jenkins kubernetes operator devcontainer",
"image": "mcr.microsoft.com/devcontainers/base:bookworm",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"enableNonRootDocker": "true",
"moby": "true"
},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"version": "latest",
"helm": "latest",
"minikube": "none"
},
"ghcr.io/devcontainers/features/go:1": {
"version": "1.22",
"golangciLintVersion": "1.58.2"
},
"ghcr.io/mpriscella/features/kind:1": {
"version": "latest"
},
"ghcr.io/edouard-lopez/devcontainer-features/bats:0": {
"version": "latest"
},
"ghcr.io/brokenpip3/devcontainers-bats/bats-libs:0": {
},
"ghcr.io/devcontainers/features/nix:1": {
"multiUser": "false",
"extraNixConfig": "experimental-features = nix-command flakes"
},
"ghcr.io/devcontainers/features/hugo:1": {
"version": "v0.99.1"
}
},
// "forwardPorts": [],
"postCreateCommand": "go version",
// "postStartCommand": "nohup bash -c 'minikube start &' > minikube.log 2>&1",
// Configure tool-specific properties.
"customizations": {
"codespaces": {
"openFiles": [
"Makefile"
]
},
// install some vscode extensions
"vscode": {
"extensions": [
"golang.Go",
"jetmartin.bats",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"budparr.language-hugo-vscode",
"GitHub.copilot",
"GitHub.copilot-chat"
]
}
},
// "remoteUser": "root"
}

1
.envrc
View File

@ -1 +0,0 @@
has nix && use flake

View File

@ -1,28 +0,0 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
groups:
golang:
patterns:
- "*"
- package-ecosystem: "npm"
directory: "/website"
schedule:
interval: "daily"
groups:
npm:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
groups:
actions:
patterns:
- "*"

View File

@ -15,3 +15,20 @@ review them:
- [ ] Commit messages follow [commit message best practices](https://github.com/jenkinsci/kubernetes-operator/blob/master/CONTRIBUTING.md#commit-messages) - [ ] Commit messages follow [commit message best practices](https://github.com/jenkinsci/kubernetes-operator/blob/master/CONTRIBUTING.md#commit-messages)
_See [the contribution guide](https://github.com/jenkinsci/kubernetes-operator/blob/master/CONTRIBUTING.md) for more details._ _See [the contribution guide](https://github.com/jenkinsci/kubernetes-operator/blob/master/CONTRIBUTING.md) for more details._
## Reviewer Notes
If API changes are included, additive changes must be approved by at least two [OWNERS](https://github.com/jenkinsci/kubernetes-operator/blob/master/OWNERS) and backwards incompatible changes must be approved by [more than 50% of the OWNERS](https://github.com/jenkinsci/kubernetes-operator/blob/master/OWNERS).
# Release Notes
```
Describe any user facing changes here, or delete this block.
Examples of user facing changes:
- API changes
- Bug fixes
- Any changes in behavior
```

47
.github/stale.yml vendored Normal file
View File

@ -0,0 +1,47 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale Issue or Pull Request is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 30
# Issues with these labels will never be considered stale
exemptLabels:
- frozen
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: true
# Label to use when marking an issue as stale
staleLabel: stale
issues:
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had recent activity.
It will be closed if no further activity occurs.
If this issue is still affecting you, just comment with any updates and we'll keep it open.
Thank you for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: >
Closing this issue after a prolonged period of inactivity.
If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!
pulls:
# Comment to post when marking a pull request as stale.
markComment: >
This pull request has been automatically marked as stale because it has not had recent activity.
It will be closed if no further activity occurs.
If this pull request is still relevant, just comment with any updates and we'll keep it open.
Thank you for your contributions.
# Comment to post when closing a stale pull request. Set to `false` to disable
closeComment: >
Closing this pull request after a prolonged period of inactivity.
If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you!
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30

View File

@ -1,99 +1,81 @@
name: Website name: auto-generate-docs
# Run this workflow every time a new commit pushed to your repository
on: on:
push: push:
branches: branches:
- master - master
- main
paths:
- 'website/**'
- 'assets/**'
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
paths:
- 'website/**'
- 'assets/**'
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "website"
cancel-in-progress: false
defaults:
run:
shell: bash
jobs: jobs:
update-date: # Set the job key. The key is displayed as the job name
name: Auto update dates # when a job name is not provided
docs:
# Name the Job
name: auto-generate-docs
# Set the type of machine to run on
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
steps:
- uses: DeterminateSystems/nix-installer-action@e50d5f73bfe71c2dd0aa4218de8f4afa59f8f81d # v16
with:
diagnostic-endpoint: ""
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive # Fetch the Docsy theme
fetch-depth: 0
# Checks if the previous commit introduced any changes to website files
- name: Check for changes - name: Check for changes
run: | run: |
IS_CHANGED=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -Ec "^website*" || :) IS_CHANGED=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -Ec "^website*" || :)
[[ $IS_CHANGED -gt 0 ]] && echo "IS_CHANGED=true" >> $GITHUB_ENV || echo "IS_CHANGED=false" >> $GITHUB_ENV [[ $IS_CHANGED -gt 0 ]] && echo "IS_CHANGED=true" >> $GITHUB_ENV || echo "IS_CHANGED=false" >> $GITHUB_ENV
# Sets up the appropriate version of Hugo
- name: Setup Hugo
if: env.IS_CHANGED == 'true'
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.62.2'
extended: true
# Sets up node - required by Hugo
- name: Setup Node
if: env.IS_CHANGED == 'true'
uses: actions/setup-node@v1
with:
node-version: '12.x'
# Installs dependencies required by docsy theme
- name: Install docsy dependencies
if: env.IS_CHANGED == 'true'
run: |
cd website
npm install
npm build
sudo npm install -D --save autoprefixer
sudo npm install -D --save postcss-cli
cd ../
- name: Update last modified date in modified docs - name: Update last modified date in modified docs
if: env.IS_CHANGED == 'true' if: env.IS_CHANGED == 'true'
run: | run: |
git diff --name-only --diff-filter=d ${{ github.event.before }} ${{ github.sha }} | grep -E "^website*" \ git diff --name-only --diff-filter=d ${{ github.event.before }} ${{ github.sha }} | grep -E "^website*" \
| sed -e 's/\(.*\)/"\1"/' | xargs sed -i "/date:/c\date: $(date +'%Y-%m-%d')" | sed -e 's/\(.*\)/"\1"/' | xargs sed -i "/date:/c\date: $(date +'%Y-%m-%d')"
# Runs makefile goal - checks changes to /website folder and generates docs
- name: Run Makefile goal
if: env.IS_CHANGED == 'true'
env:
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make generate-docs
# Creates pull request with generated docs
- name: Create Pull Request - name: Create Pull Request
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v6 if: env.IS_CHANGED == 'true'
if: env.IS_CHANGED == 'true' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') uses: peter-evans/create-pull-request@v3
with: with:
commit-message: Auto-updated docs commit-message: Auto-updated docs
branch: docs-generator branch: docs-generator
title: Auto-generated docs update title: Auto-generated docs update
body: | body: |
Auto generated docs from master commit ${{ github.sha }} Auto generated docs from master commit ${{ github.sha }}
website-generate:
name: Auto generate website
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
steps:
- uses: DeterminateSystems/nix-installer-action@e50d5f73bfe71c2dd0aa4218de8f4afa59f8f81d # v16
with:
diagnostic-endpoint: ""
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: nix checks
run: nix flake check
- name: nix build
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: nix build .#website
- name: Setup Pages
id: pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
with:
path: ./result
website-deploy:
name: Deploy website
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: website-generate
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4

View File

@ -1,60 +0,0 @@
name: Update k8s manifests
on:
push:
branches:
- master
- main
paths-ignore:
- 'docs/**'
- 'website/**'
- 'assets/**'
- 'backup/**'
- '*.md'
workflow_dispatch:
release:
types: [published]
jobs:
update-manifest:
name: Update k8s manifests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up env vars
run: |
echo "HELM_VERSION=v$(sed -n 's/HELM_VERSION=//p' config.base.env)" >> $GITHUB_ENV
- name: Helm lint
run: make helm-lint
#TODO: add also the webhook part and understand if is necessary
- name: Helm update plain manifests
run: |
helm template --set fullnameOverride=jenkins-operator \
--set jenkins.enabled=false \
--set jenkins.backup.enabled=false \
--set jenkins.backup.pvc.enabled=false \
--set operator.resources.limits.cpu=100m \
--set operator.resources.limits.memory=120Mi \
--set operator.resources.requests.cpu=100m \
--set operator.resources.requests.memory=120Mi \
chart/jenkins-operator/ > deploy/all-in-one-v1alpha2.yaml
sed -i '/namespace: default/d' deploy/all-in-one-v1alpha2.yaml
sed -i 's/# Source: .*//g' deploy/all-in-one-v1alpha2.yaml
sed -i 's/app\.kubernetes\.io\/instance: release-name//g' deploy/all-in-one-v1alpha2.yaml
sed -i 's/app\.kubernetes\.io\/managed-by: Helm//g' deploy/all-in-one-v1alpha2.yaml
sed -i 's/helm\.sh\/chart: [a-zA-Z0-9]+//g' deploy/all-in-one-v1alpha2.yaml
sed -i '/^[[:space:]]*$/d' deploy/all-in-one-v1alpha2.yaml
cp chart/jenkins-operator/crds/jenkins-crd.yaml deploy/crds/jenkins.io_jenkins_crd.yaml
- name: Create Pull Request
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v6
with:
commit-message: Auto-updated Kubernetes Manifests
branch: manifest-deploy-update
title: Auto-updated Kubernetes Manifests
body: |
Auto-updated Kubernetes Manifests from master commit ${{ github.sha }}

View File

@ -1,22 +0,0 @@
name: "Stale issue automation"
on:
workflow_dispatch:
schedule:
- cron: "0 9 * * *"
permissions:
issues: write
pull-requests: write
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
operations-per-run: 200
days-before-issue-stale: 60
days-before-issue-close: 10
exempt-pr-labels: "not-stale"
exempt-issue-labels: "not-stale"

View File

@ -1,67 +0,0 @@
name: Tests BATS
on:
push:
branches:
- master
- main
paths-ignore:
- 'docs/**'
- 'website/**'
- 'assets/**'
- 'backup/**'
- '*.md'
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
paths-ignore:
- 'docs/**'
- 'website/**'
- 'assets/**'
- 'backup/**'
- '*.md'
jobs:
run-tests:
if: github.event.pull_request.draft == false
name: BATS test ${{ matrix.test-file }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test-file: ["1-deploy", "2-deploy-with-more-options", "3-deploy-with-webhook"]
steps:
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up env vars
run: |
echo "GO111MODULE=on" >> $GITHUB_ENV
echo "GO_VERSION=v$(sed -n 's/GO_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "HELM_VERSION=v$(sed -n 's/HELM_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "KIND_CLUSTER_NAME=$(sed -n 's/KIND_CLUSTER_NAME=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "GOPATH=/home/runner/go" >> $GITHUB_ENV
- name: Prepare go environment
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Ensure Golang runtime dependencies
run: make go-dependencies
- name: Setup Bats and libs
uses: bats-core/bats-action@e412797c46257a2dbf3775f6f6010b33ee6cb99f # 3.0.1
with:
support-path: "${{ github.workspace }}/.bats/bats-support"
assert-path: "${{ github.workspace }}/.bats/bats-assert"
detik-path: "${{ github.workspace }}/.bats/bats-detik"
file-path: "${{ github.workspace }}/.bats/bats-file"
- name: Kind setup
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
with:
cluster_name: ${{env.KIND_CLUSTER_NAME}}
- name: Jenkins Operator - bats tests
env:
BATS_LIB_PATH: "${{ github.workspace }}/.bats"
run: BATS_TEST_PATH=${{matrix.test-file}}.bats make bats-tests

View File

@ -1,115 +0,0 @@
name: Tests E2E
on:
push:
branches:
- master
- main
paths-ignore:
- 'docs/**'
- 'website/**'
- 'assets/**'
- 'backup/**'
- '*.md'
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
paths-ignore:
- 'docs/**'
- 'website/**'
- 'assets/**'
- 'backup/**'
- '*.md'
jobs:
create-e2e-list:
name: E2E Create tests list
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- id: matrix
run: |
script=$(./test/make_matrix_ginkgo.sh e2e)
echo "matrix=${script}" >> $GITHUB_OUTPUT
verify-code:
name: E2E Verify code before tests
runs-on: ubuntu-latest
needs: [create-e2e-list]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up env vars
run: |
echo "GO111MODULE=on" >> $GITHUB_ENV
echo "GO_VERSION=v$(sed -n 's/GO_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "GOPATH=/home/runner/go" >> $GITHUB_ENV
- name: Prepare go environment
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Ensure Golang runtime dependencies
run: make go-dependencies
- name: Verify code formatting
run: make verify
run-e2e-tests:
runs-on: ubuntu-latest
needs: [create-e2e-list, verify-code]
if: github.event.pull_request.draft == false
name: E2E ${{ matrix.test }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.create-e2e-list.outputs.matrix) }}
steps:
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up env vars
run: |
echo "GO111MODULE=on" >> $GITHUB_ENV
echo "GO_VERSION=v$(sed -n 's/GO_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "KIND_CLUSTER_NAME=$(sed -n 's/KIND_CLUSTER_NAME=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "GOPATH=/home/runner/go" >> $GITHUB_ENV
- name: Prepare go environment
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Ensure Golang runtime dependencies
run: make go-dependencies
- name: Kind setup
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
with:
cluster_name: ${{env.KIND_CLUSTER_NAME}}
config: kind-cluster.yaml
- name: Prepare environment for e2e
run: |
sudo apt-get update && sudo apt-get install -y socat
sudo mkdir -p $HOME/.kube
sudo chown -R $USER $HOME/.kube
- name: Jenkins Operator - e2e Chart tests
env:
TNAME: ${{ matrix.test }}
TFILE: ${{ matrix.file }}
TLINE: ${{ matrix.line }}
run: |
git reset --hard
printf "\n \n > Running test: %s from file: $s line: %s\n" "${TNAME}" "${TFILE}" "${TLINE}"
make e2e E2E_TEST_ARGS='-ginkgo.v -ginkgo.focus="${TNAME}"'
- name: Debug
if: failure()
shell: bash
continue-on-error: true
run: |
randomns=$(kubectl get ns| grep -i 'ns[0-9]\+' |cut -d ' ' -f 1)
kubectl get pods -n ${randomns}
kubectl get events -n ${randomns}

View File

@ -1,117 +0,0 @@
name: Tests HELM
on:
push:
branches:
- master
- main
paths-ignore:
- 'docs/**'
- 'website/**'
- 'assets/**'
- 'backup/**'
- '*.md'
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
paths-ignore:
- 'docs/**'
- 'website/**'
- 'assets/**'
- 'backup/**'
- '*.md'
jobs:
create-helm-list:
name: HELM Create tests list
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- id: matrix
run: |
script=$(./test/make_matrix_ginkgo.sh helm)
echo "matrix=${script}" >> $GITHUB_OUTPUT
verify-code:
name: HELM Verify code before tests
runs-on: ubuntu-latest
needs: [create-helm-list]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up env vars
run: |
echo "GO111MODULE=on" >> $GITHUB_ENV
echo "GO_VERSION=v$(sed -n 's/GO_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "GOPATH=/home/runner/go" >> $GITHUB_ENV
- name: Prepare go environment
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Ensure Golang runtime dependencies
run: make go-dependencies
- name: Verify code formatting
run: make verify
run-helm-tests:
runs-on: ubuntu-latest
needs: [create-helm-list, verify-code]
if: github.event.pull_request.draft == false
name: HELM ${{ matrix.test }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.create-helm-list.outputs.matrix) }}
steps:
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up env vars
run: |
echo "GO111MODULE=on" >> $GITHUB_ENV
echo "GO_VERSION=v$(sed -n 's/GO_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "HELM_VERSION=v$(sed -n 's/HELM_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "KIND_CLUSTER_NAME=$(sed -n 's/KIND_CLUSTER_NAME=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "GOPATH=/home/runner/go" >> $GITHUB_ENV
- name: Prepare go environment
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Ensure Golang runtime dependencies
run: make go-dependencies
- name: Kind setup
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
with:
cluster_name: ${{env.KIND_CLUSTER_NAME}}
config: kind-cluster.yaml
- name: Prepare environment for e2e
run: |
sudo apt-get update && sudo apt-get install -y socat
sudo mkdir -p $HOME/.kube
sudo chown -R $USER $HOME/.kube
- name: Jenkins Operator - Helm Chart tests
env:
TNAME: ${{ matrix.test }}
TFILE: ${{ matrix.file }}
TLINE: ${{ matrix.line }}
run: |
git reset --hard
make helm-lint
printf "\n \n > Running test: %s from file: $s line: %s\n" "${TNAME}" "${TFILE}" "${TLINE}"
make helm-e2e E2E_TEST_ARGS='-ginkgo.v -ginkgo.focus="${TNAME}"'
- name: Debug
if: failure()
shell: bash
continue-on-error: true
run: |
randomns=$(kubectl get ns| grep -i 'ns[0-9]\+' |cut -d ' ' -f 1)
kubectl get pods -n ${randomns}
kubectl get events -n ${randomns}

58
.github/workflows/auto-tests.yaml vendored Normal file
View File

@ -0,0 +1,58 @@
name: Run tests
on:
push:
branches:
- master
- security-validator
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
branches:
- master
- security-validator
jobs:
run-tests:
if: github.event.pull_request.draft == false
name: Run automated tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up env vars
run: |
echo "GO111MODULE=on" >> $GITHUB_ENV
echo "CHANGE_MINIKUBE_NONE_USER=true" >> $GITHUB_ENV
echo "MINIKUBE_WANTUPDATENOTIFICATION=false" >> $GITHUB_ENV
echo "MINIKUBE_WANTREPORTERRORPROMPT=false" >> $GITHUB_ENV
echo "GO_VERSION=v$(sed -n 's/GO_VERSION=//p' config.base.env)" >> $GITHUB_ENV
echo "HELM_VERSION=v$(sed -n 's/HELM_VERSION=//p' config.base.env)" >> $GITHUB_ENV
echo "GOPATH=/home/runner/go" >> $GITHUB_ENV
- name: Prepare go environment
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Ensure Golang runtime dependencies
run: make go-dependencies
- name: Verify code formatting
run: make verify
- name: Prepare environment for e2e
run: |
sudo apt-get update
sudo apt-get install socat
sudo mkdir -p $HOME/.kube $HOME/.minikube
sudo chown -R $USER $HOME/.kube $HOME/.minikube
make minikube-start MINIKUBE_DRIVER='docker' CPUS_NUMBER=2
- name: Jenkins Operator - e2e
run: make e2e E2E_TEST_ARGS='-ginkgo.v'
- name: Jenkins Operator - Helm Chart tests
run: |
git reset --hard
make helm-lint
eval $(bin/minikube docker-env)
make helm-e2e E2E_TEST_ARGS='-ginkgo.v'

View File

@ -1,72 +0,0 @@
name: auto-update-jenkins-lts
on:
schedule:
- cron: '0 7 * * 0'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
check-and-update-jenkins-lts:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Set up env vars
run: |
echo "GO111MODULE=on" >> $GITHUB_ENV
echo "GO_VERSION=v$(sed -n 's/GO_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "KIND_CLUSTER_NAME=$(sed -n 's/KIND_CLUSTER_NAME=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "GOPATH=/home/runner/go" >> $GITHUB_ENV
- name: Check if update needed
id: check
run: |
CURRENT=$(sed -n 's/LATEST_LTS_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')
LATEST=$(curl -s https://www.jenkins.io/changelog-stable/ | grep -oP 'changelog/\K\d+\.\d+\.\d+' | head -1)
echo "current=$CURRENT" >> $GITHUB_OUTPUT
echo "latest=$LATEST" >> $GITHUB_OUTPUT
if [ "$CURRENT" != "$LATEST" ]; then
echo "needs_update=true" >> $GITHUB_OUTPUT
else
echo "needs_update=false" >> $GITHUB_OUTPUT
fi
- name: Prepare go environment
if: steps.check.outputs.needs_update == 'true'
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6
with:
go-version: ${{ env.GO_VERSION }}
- name: Ensure Golang runtime dependencies
if: steps.check.outputs.needs_update == 'true'
run: make go-dependencies
- name: Update Jenkins lts version
if: steps.check.outputs.needs_update == 'true'
run: make update-jenkins-lts
- name: Update Jenkins base plugins
if: steps.check.outputs.needs_update == 'true'
run: make update-plugins
- name: Run verify
if: steps.check.outputs.needs_update == 'true'
run: make verify
- name: Create Pull Request
if: steps.check.outputs.needs_update == 'true'
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update Jenkins lts version to ${{ steps.check.outputs.latest }}"
title: "chore: update Jenkins lts version to ${{ steps.check.outputs.latest }}"
body: "auto-update Jenkins lts version from ${{ steps.check.outputs.current }} to ${{ steps.check.outputs.latest }}"
branch: auto-update-jenkins-lts-${{ steps.check.outputs.latest }}
delete-branch: true

61
.github/workflows/deploy-nightly.yaml vendored Normal file
View File

@ -0,0 +1,61 @@
name: Publish nightly snapshot
on:
schedule:
- cron: '0 2 * * *'
jobs:
publish-image:
name: Publish nightly snapshot
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up env vars
run: |
echo "GO111MODULE=on" >> $GITHUB_ENV
echo "CHANGE_MINIKUBE_NONE_USER=true" >> $GITHUB_ENV
echo "MINIKUBE_WANTUPDATENOTIFICATION=false" >> $GITHUB_ENV
echo "MINIKUBE_WANTREPORTERRORPROMPT=false" >> $GITHUB_ENV
echo "GO_VERSION=v$(sed -n 's/GO_VERSION=//p' config.base.env)" >> $GITHUB_ENV
echo "HELM_VERSION=v$(sed -n 's/HELM_VERSION=//p' config.base.env)" >> $GITHUB_ENV
echo "GOPATH=/home/runner/go" >> $GITHUB_ENV
- name: Prepare go environment
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Ensure Golang runtime dependencies
run: make go-dependencies
- name: Verify code formatting
run: make verify
- name: Prepare environment for e2e
run: |
sudo apt-get update
sudo apt-get install socat
sudo mkdir -p $HOME/.kube $HOME/.minikube
sudo chown -R $USER $HOME/.kube $HOME/.minikube
make minikube-start MINIKUBE_DRIVER='docker' CPUS_NUMBER=2
- name: Jenkins Operator - e2e
run: make e2e E2E_TEST_ARGS='-ginkgo.v'
- name: Jenkins Operator - Helm Chart tests
run: |
git reset --hard
make helm-lint
eval $(bin/minikube docker-env)
make helm-e2e E2E_TEST_ARGS='-ginkgo.v'
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Release Container Runtime
run: |
git reset --hard
make container-runtime-snapshot-push

View File

@ -1,60 +0,0 @@
name: Release Backup Pvc
on:
workflow_dispatch:
pull_request:
types: [edited, opened, reopened, synchronize]
paths:
- 'backup/pvc/**'
push:
branches:
- master
- main
tags: ["*"]
paths:
- 'backup/pvc/**'
jobs:
build-and-release-backup:
name: Release Backup Pvc, build, bump and push new image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Check envs
run: make -C backup/pvc check-env
- name: Build the e2e image
run: make -C backup/pvc docker-build-e2e
- name: Run the e2e tests
run: make -C backup/pvc docker-e2e
- name: Configure Git
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Bump the version
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
shell: bash
run: |
make -C backup/pvc sembump
make -C backup/pvc bump-version
- name: Login to Quay.io
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
with:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_TOKEN }}
- name: Build and push the image to Quay.io
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
run: |
git reset --hard
make -C backup/pvc docker-build
make -C backup/pvc docker-release

View File

@ -17,21 +17,21 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 uses: actions/checkout@v2
- name: Deploy Helm chart - name: Deploy Helm chart
run: | run: |
sed -i '0,/version:.*/s//version: ${{ github.event.inputs.chartVersion }}/' chart/jenkins-operator/Chart.yaml sed -i "/version:/c\version: ${{ github.event.inputs.chartVersion }}" chart/jenkins-operator/Chart.yaml
if [ ${{ github.event.inputs.appVersion }} ] ; then if [ ${{ github.event.inputs.appVersion }} ] ; then
sed -i '/appVersion:.*/s//appVersion: "${{ github.event.inputs.appVersion }}"/' chart/jenkins-operator/Chart.yaml sed -i "/appVersion:/c\appVersion: \"${{ github.event.inputs.appVersion }}\"" chart/jenkins-operator/Chart.yaml
fi fi
make helm-release-latest make helm-release-latest
# Creates pull request with new chart version # Creates pull request with new chart version
- name: Create Pull Request - name: Create Pull Request
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v6 uses: peter-evans/create-pull-request@v3
with: with:
commit-message: Release Helm chart ${{ github.event.inputs.chartVersion }} commit-message: Release Helm chart ${{ github.event.inputs.chartVersion }}
branch: helm-chart-release-${{ github.event.inputs.chartVersion }} branch: helm-chart-release-${{ github.event.inputs.chartVersion }}

View File

@ -1,89 +0,0 @@
name: Publish nightly snapshot
on:
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
skipTests:
description: "Flag for skipping the tests. If set to true (without quotation marks), the workflow will skip tests and go straight to releasing the nightly build. Use with caution!"
required: false
jobs:
publish-image:
name: Publish nightly snapshot
runs-on: ubuntu-latest
steps:
- name: Prep - check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Prep - Set up env vars
run: |
echo "GO111MODULE=on" >> $GITHUB_ENV
echo "GO_VERSION=v$(sed -n 's/GO_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "HELM_VERSION=v$(sed -n 's/HELM_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "KIND_CLUSTER_NAME=$(sed -n 's/KIND_CLUSTER_NAME=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "GOPATH=/home/runner/go" >> $GITHUB_ENV
- name: Prep - setup Bats and bats libs
if: ${{ github.event.inputs.skipTests != 'true' }}
uses: bats-core/bats-action@472edde1138d59aca53ff162fb8d996666d21e4a # 2.0.0
with:
support-path: "${{ github.workspace }}/.bats/bats-support"
assert-path: "${{ github.workspace }}/.bats/bats-assert"
detik-path: "${{ github.workspace }}/.bats/bats-detik"
file-path: "${{ github.workspace }}/.bats/bats-file"
- name: Prep - go environment
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Prep - Ensure Golang runtime dependencies
run: make go-dependencies
- name: Test - verify code formatting
run: make verify
- name: Prep - Minikube setup
if: ${{ github.event.inputs.skipTests != 'true' }}
run: |
sudo apt-get update
sudo apt-get install socat
sudo mkdir -p $HOME/.kube
sudo chown -R $USER $HOME/.kube
- name: Prep - Kind setup
if: ${{ github.event.inputs.skipTests != 'true' }}
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
with:
cluster_name: ${{env.KIND_CLUSTER_NAME}}
config: kind-cluster.yaml
- name: Test - e2e
if: ${{ github.event.inputs.skipTests != 'true' }}
run: make e2e E2E_TEST_ARGS='-ginkgo.v'
- name: Test - Helm Chart
if: ${{ github.event.inputs.skipTests != 'true' }}
run: |
git reset --hard
make helm-lint
make helm-e2e E2E_TEST_ARGS='-ginkgo.v'
- name: Test - bats
env:
BATS_LIB_PATH: "${{ github.workspace }}/.bats"
if: ${{ github.event.inputs.skipTests != 'true' }}
run: make bats-tests
- name: Post - Login to Quay.io
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
with:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_TOKEN }}
- name: Post - Push image
run: |
git reset --hard
make container-runtime-snapshot-push

View File

@ -1,57 +0,0 @@
name: Release Operator
on:
workflow_dispatch:
jobs:
build-and-release:
name: Release Operator, build and push newest image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: Set up env vars
run: |
echo "GO111MODULE=on" >> $GITHUB_ENV
echo "GO_VERSION=v$(sed -n 's/GO_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
echo "GOPATH=/home/runner/go" >> $GITHUB_ENV
- name: Prepare go environment
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Ensure Golang runtime dependencies
run: make go-dependencies
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Tag the release
run: make tag
- name: Set version for release tag name
run: |
echo "VERSION=$(cat VERSION.txt)" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2
with:
tag_name: ${{ env.VERSION }}
- name: Login to Quay.io
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
with:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_TOKEN }}
- name: Build and push the image to Quay.io
run: |
git reset --hard
make container-runtime-release

View File

@ -1,126 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../" && pwd)"
PLUGINS=(
"configuration-as-code"
"git"
"job-dsl"
"kubernetes"
"kubernetes-credentials-provider"
"workflow-aggregator"
)
version_compare() {
local ver1="$1"
local ver2="$2"
ver1=$(echo "$ver1" | sed 's/\([0-9.]*\).*/\1/')
ver2=$(echo "$ver2" | sed 's/\([0-9.]*\).*/\1/')
if [ "$ver1" = "$ver2" ]; then
return 0
fi
local sorted=$(printf '%s\n%s' "$ver1" "$ver2" | sort -V)
local first=$(echo "$sorted" | head -n1)
if [ "$first" = "$ver1" ]; then
return 1
else
return 2
fi
}
fetch_update_center_data() {
local jenkins_version="$1"
local url="https://updates.jenkins.io/update-center.actual.json?version=${jenkins_version}"
local data=$(curl -s -L -f "$url")
if ! echo "$data" | jq . > /dev/null 2>&1; then
echo "error something happened" >&2
return 1
fi
echo "$data"
}
find_compatible_version() {
local plugin_id="$1"
local jenkins_version="$2"
local update_data="$3"
local plugin_data=$(echo "$update_data" | jq ".plugins[\"$plugin_id\"]")
local plugin_version=$(echo "$plugin_data" | jq -r '.version')
local compatible_since=$(echo "$plugin_data" | jq -r '.compatibleSinceVersion // empty')
if [ -n "$compatible_since" ]; then
version_compare "$jenkins_version" "$compatible_since"
local result=$?
if [ $result -eq 1 ]; then
echo "Error: Plugin '$plugin_id' requires Jenkins $compatible_since or newer" >&2
return 1
fi
fi
echo "$plugin_version"
}
update_go_file() {
local file_path="$1"
local plugin_id="$2"
local new_version="$3"
local dry_run="$4"
local var_name=""
case "$plugin_id" in
"configuration-as-code") var_name="configurationAsCodePlugin" ;;
"git") var_name="gitPlugin" ;;
"job-dsl") var_name="jobDslPlugin" ;;
"kubernetes") var_name="kubernetesPlugin" ;;
"kubernetes-credentials-provider") var_name="kubernetesCredentialsProviderPlugin" ;;
"workflow-aggregator") var_name="workflowAggregatorPlugin" ;;
esac
local relative_path=$(realpath --relative-to="$PROJECT_ROOT" "$file_path")
local new_line=" ${var_name} = \"${plugin_id}:${new_version}\""
if [ "$dry_run" = "true" ]; then
echo "$relative_path: $plugin_id:$new_version"
else
sed -i "s|^[[:space:]]*${var_name}[[:space:]]*=.*|${new_line}|" "$file_path"
echo "$relative_path: $var_name -> $plugin_id:$new_version"
fi
}
main() {
if [ $# -lt 1 ]; then
echo "usage: $0 <jenkins-version> [--dry-run]" >&2
exit 1
fi
local jenkins_version="$1"
local dry_run="false"
if [ $# -gt 1 ] && [ "$2" = "--dry-run" ]; then
dry_run="true"
fi
local update_data
if ! update_data=$(fetch_update_center_data "$jenkins_version"); then
exit 1
fi
for plugin_id in "${PLUGINS[@]}"; do
local compatible_version
if compatible_version=$(find_compatible_version "$plugin_id" "$jenkins_version" "$update_data"); then
#printf "%-35s %-30s\n" "$plugin_id" "$compatible_version"
update_go_file "$PROJECT_ROOT/pkg/plugins/base_plugins.go" "$plugin_id" "$compatible_version" "$dry_run"
update_go_file "$PROJECT_ROOT/test/e2e/configuration_test.go" "$plugin_id" "$compatible_version" "$dry_run"
fi
done
}
main "$@"

11
.gitignore vendored
View File

@ -91,14 +91,3 @@ tags
/bin /bin
testbin/* testbin/*
### Bats
chart/jenkins-operator/deploy.tmp
### Nix
result
### website
website/node_modules
website/public
website/.hugo_build.lock

View File

@ -1,41 +1,29 @@
run: run:
deadline: 5m deadline: 10m
allow-parallel-runners: true linters-settings:
skip-files: errcheck:
- api/v1alpha2/zz_generated.deepcopy.go check-blank: false
issues: ignore: fmt:.*,io/ioutil:^Read.*,Write
exclude-use-default: false
exclude-rules:
- path: "internal/*"
linters: linters:
- dupl enable-all: true
- path: (.+)_test.go disable:
linters: - funlen
- dupl - gocognit
linters: - godox
disable-all: true - gomnd
enable: - gochecknoglobals
- dupl - gochecknoinits
- errcheck - lll
- exportloopref - prealloc
- goconst - wsl
- gocyclo - gocyclo
- gofmt - scopelint
- goimports - dupl
- gosimple - gosec
- govet - maligned
- ineffassign - testpackage
- loggercheck - goerr113
- misspell
- nakedret - nakedret
- staticcheck - nestif
- typecheck - godot
- unconvert
- unparam
- unused
output:
sort-results: true
sort-order:
- file
- severity
- linter

View File

@ -1,26 +0,0 @@
repos:
- repo: https://github.com/sirosen/check-jsonschema
rev: a167de9d5f4e87e1cdb16cb560aa704b79b6f655 # frozen: 0.32.1
hooks:
- id: check-github-workflows
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
hooks:
- id: detect-private-key
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/gruntwork-io/pre-commit
rev: "d9196b3a0a6fbc530f2bacea36c11a3b0214ff13" # frozen: v0.1.28
hooks:
- id: helmlint
- repo: https://github.com/norwoodj/helm-docs
rev: "37d3055fece566105cf8cff7c17b7b2355a01677" # frozen: v1.14.2
hooks:
- id: helm-docs
args:
- --chart-search-root=chart/jenkins-operator
- repo: https://github.com/brokenpip3/pre-commit-hooks
rev: dd7b3821637ba3c3a8628ad487fd84edec8006f2 # frozen: 0.0.1
hooks:
- id: github-actions-hash
files: ^.github/workflows/.*\.(yml|yaml)$ # limit only to github workflows

View File

@ -1 +0,0 @@
* @brokenpip3

View File

@ -3,8 +3,6 @@ ARG GO_VERSION
# Build the manager binary # Build the manager binary
FROM golang:$GO_VERSION as builder FROM golang:$GO_VERSION as builder
ARG CTIMEVAR ARG CTIMEVAR
ARG TARGETOS
ARG TARGETARCH
WORKDIR /workspace WORKDIR /workspace
# Copy the Go Modules manifests # Copy the Go Modules manifests
@ -16,25 +14,18 @@ RUN go mod download
# Copy the go source # Copy the go source
COPY api/ api/ COPY api/ api/
COPY internal/controller/ internal/controller/ COPY controllers/ controllers/
COPY internal/ internal/ COPY internal/ internal/
COPY pkg/ pkg/ COPY pkg/ pkg/
COPY version/ version/ COPY version/ version/
COPY cmd/main.go cmd/main.go COPY main.go main.go
# Build # Build
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags "-w $CTIMEVAR" -o manager main.go
# Use distroless as minimal base image to package the manager binary # Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details # Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot FROM gcr.io/distroless/static:nonroot
LABEL maintainer="Jenkins Kubernetes Operator Community" \
org.opencontainers.image.authors="Jenkins Kubernetes Operator Community" \
org.opencontainers.image.title="jenkins-kubernetes-operator" \
org.opencontainers.image.description="Kubernetes native Jenkins Operator" \
org.opencontainers.image.url="quay.io/jenkins-kubernetes-operator/operator" \
org.opencontainers.image.source="https://github.com/jenkinsci/kubernetes-operator/tree/master" \
org.opencontainers.image.base.name="gcr.io/distroless/static:nonroot"
WORKDIR / WORKDIR /
COPY --from=builder /workspace/manager . COPY --from=builder /workspace/manager .
USER 65532:65532 USER 65532:65532

374
Makefile
View File

@ -70,20 +70,16 @@ HAS_GOLINT := $(shell which $(PROJECT_DIR)/bin/golangci-lint)
lint: ## Verifies `golint` passes lint: ## Verifies `golint` passes
@echo "+ $@" @echo "+ $@"
ifndef HAS_GOLINT ifndef HAS_GOLINT
GOBIN=$(PROJECT_DIR)/bin go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.0 $(call go-get-tool,$(PROJECT_DIR)/bin/golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.26.0)
endif endif
@bin/golangci-lint run @bin/golangci-lint run
.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
@bin/golangci-lint run --fix
.PHONY: goimports .PHONY: goimports
HAS_GOIMPORTS := $(shell which $(PROJECT_DIR)/bin/goimports) HAS_GOIMPORTS := $(shell which $(PROJECT_DIR)/bin/goimports)
goimports: ## Verifies `goimports` passes goimports: ## Verifies `goimports` passes
@echo "+ $@" @echo "+ $@"
ifndef HAS_GOIMPORTS ifndef HAS_GOIMPORTS
$(call GOBIN=$(PROJECT_DIR)/bin go install golang.org/x/tools/cmd/goimports@v0.1.0) $(call go-get-tool,$(PROJECT_DIR)/bin/goimports,golang.org/x/tools/cmd/goimports@v0.1.0)
endif endif
@bin/goimports -l -e $(shell find . -type f -name '*.go' -not -path "./vendor/*") @bin/goimports -l -e $(shell find . -type f -name '*.go' -not -path "./vendor/*")
@ -93,64 +89,18 @@ test: ## Runs the go tests
@RUNNING_TESTS=1 go test -tags "$(BUILDTAGS) cgo" $(PACKAGES_FOR_UNIT_TESTS) @RUNNING_TESTS=1 go test -tags "$(BUILDTAGS) cgo" $(PACKAGES_FOR_UNIT_TESTS)
.PHONY: e2e .PHONY: e2e
e2e: deepcopy-gen manifests backup-kind-load jenkins-kind-load ## Runs e2e tests, you can use EXTRA_ARGS e2e: deepcopy-gen manifests ## Runs e2e tests, you can use EXTRA_ARGS
@echo "+ $@" @echo "+ $@"
RUNNING_TESTS=1 go test -parallel=1 "./test/e2e/" -ginkgo.v -tags "$(BUILDTAGS) cgo" -v -timeout 60m -run "$(E2E_TEST_SELECTOR)" \ RUNNING_TESTS=1 go test -parallel=1 "./test/e2e/" -ginkgo.v -tags "$(BUILDTAGS) cgo" -v -timeout 60m -run "$(E2E_TEST_SELECTOR)" \
-jenkins-api-hostname=$(JENKINS_API_HOSTNAME) -jenkins-api-port=$(JENKINS_API_PORT) -jenkins-api-use-nodeport=$(JENKINS_API_USE_NODEPORT) $(E2E_TEST_ARGS) -jenkins-api-hostname=$(JENKINS_API_HOSTNAME) -jenkins-api-port=$(JENKINS_API_PORT) -jenkins-api-use-nodeport=$(JENKINS_API_USE_NODEPORT) $(E2E_TEST_ARGS)
.PHONY: jenkins-kind-load
jenkins-kind-load: ## Load the jenkins lts version in kind to speed up tests
@echo "+ $@"
docker pull jenkins/jenkins:$(LATEST_LTS_VERSION)
kind load docker-image jenkins/jenkins:$(LATEST_LTS_VERSION) --name $(KIND_CLUSTER_NAME)
## Backup Section
.PHONY: backup-kind-load
backup-kind-load: ## Load latest backup image in the cluster
@echo "+ $@"
make -C backup/pvc backup-kind-load
## HELM Section
.PHONY: helm
HAS_HELM := $(shell command -v helm 2> /dev/null)
helm: ## Download helm if it's not present, otherwise symlink
@echo "+ $@"
ifeq ($(strip $(HAS_HELM)),)
mkdir -p $(PROJECT_DIR)/bin
curl -Lo $(PROJECT_DIR)/bin/helm.tar.gz https://get.helm.sh/helm-v$(HELM_VERSION)-$(PLATFORM)-amd64.tar.gz && tar xzfv $(PROJECT_DIR)/bin/helm.tar.gz -C $(PROJECT_DIR)/bin
mv $(PROJECT_DIR)/bin/$(PLATFORM)-amd64/helm $(PROJECT_DIR)/bin/helm
rm -rf $(PROJECT_DIR)/bin/$(PLATFORM)-amd64
rm -rf $(PROJECT_DIR)/bin/helm.tar.gz
else
mkdir -p $(PROJECT_DIR)/bin
test -L $(PROJECT_DIR)/bin/helm || ln -sf $(shell command -v helm) $(PROJECT_DIR)/bin/helm
endif
.PHONY: helm-lint
helm-lint: helm
bin/helm lint chart/jenkins-operator
.PHONY: helm-release-latest
helm-release-latest: helm
mkdir -p /tmp/jenkins-operator-charts
mv chart/jenkins-operator/*.tgz /tmp/jenkins-operator-charts
cd chart && ../bin/helm package jenkins-operator
mv chart/jenkins-operator-*.tgz chart/jenkins-operator/
bin/helm repo index chart/ --url https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/ --merge chart/index.yaml
mv /tmp/jenkins-operator-charts/*.tgz chart/jenkins-operator/
.PHONY: helm-e2e .PHONY: helm-e2e
IMAGE_NAME := quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY):$(GITCOMMIT)-amd64 IMAGE_NAME := $(DOCKER_REGISTRY):$(GITCOMMIT)
helm-e2e: helm container-runtime-build-amd64 backup-kind-load ## Runs helm e2e tests, you can use EXTRA_ARGS helm-e2e: helm container-runtime-build ## Runs helm e2e tests, you can use EXTRA_ARGS
kind load docker-image ${IMAGE_NAME} --name $(KIND_CLUSTER_NAME)
@echo "+ $@" @echo "+ $@"
RUNNING_TESTS=1 go test -parallel=1 "./test/helm/" -ginkgo.v -tags "$(BUILDTAGS) cgo" -v -timeout 60m -run "$(E2E_TEST_SELECTOR)" -image-name=$(IMAGE_NAME) $(E2E_TEST_ARGS) RUNNING_TESTS=1 go test -parallel=1 "./test/helm/" -ginkgo.v -tags "$(BUILDTAGS) cgo" -v -timeout 60m -run "$(E2E_TEST_SELECTOR)" -image-name=$(IMAGE_NAME) $(E2E_TEST_ARGS)
## CODE CHECKS section
.PHONY: vet .PHONY: vet
vet: ## Verifies `go vet` passes vet: ## Verifies `go vet` passes
@echo "+ $@" @echo "+ $@"
@ -162,7 +112,7 @@ staticcheck: ## Verifies `staticcheck` passes
@echo "+ $@" @echo "+ $@"
ifndef HAS_STATICCHECK ifndef HAS_STATICCHECK
$(eval TMP_DIR := $(shell mktemp -d)) $(eval TMP_DIR := $(shell mktemp -d))
wget -O $(TMP_DIR)/staticcheck_$(PLATFORM)_amd64.tar.gz https://github.com/dominikh/go-tools/releases/download/2023.1.7/staticcheck_$(PLATFORM)_amd64.tar.gz wget -O $(TMP_DIR)/staticcheck_$(PLATFORM)_amd64.tar.gz https://github.com/dominikh/go-tools/releases/download/2020.1.3/staticcheck_$(PLATFORM)_amd64.tar.gz
tar zxvf $(TMP_DIR)/staticcheck_$(PLATFORM)_amd64.tar.gz -C $(TMP_DIR) tar zxvf $(TMP_DIR)/staticcheck_$(PLATFORM)_amd64.tar.gz -C $(TMP_DIR)
mkdir -p $(PROJECT_DIR)/bin mkdir -p $(PROJECT_DIR)/bin
mv $(TMP_DIR)/staticcheck/staticcheck $(PROJECT_DIR)/bin mv $(TMP_DIR)/staticcheck/staticcheck $(PROJECT_DIR)/bin
@ -174,8 +124,7 @@ endif
cover: ## Runs go test with coverage cover: ## Runs go test with coverage
@echo "" > coverage.txt @echo "" > coverage.txt
@for d in $(PACKAGES); do \ @for d in $(PACKAGES); do \
ENVTEST_K8S_VERSION = 1.26 IMG_RUNNING_TESTS=1 go test -race -coverprofile=profile.out -covermode=atomic "$$d"; \
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" IMG_RUNNING_TESTS=1 go test -race -coverprofile=profile.out -covermode=atomic "$$d"; \
if [ -f profile.out ]; then \ if [ -f profile.out ]; then \
cat profile.out >> coverage.txt; \ cat profile.out >> coverage.txt; \
rm profile.out; \ rm profile.out; \
@ -191,55 +140,12 @@ install: ## Installs the executable
@echo "+ $@" @echo "+ $@"
go install -tags "$(BUILDTAGS)" ${GO_LDFLAGS} $(BUILD_PATH) go install -tags "$(BUILDTAGS)" ${GO_LDFLAGS} $(BUILD_PATH)
.PHONY: update-plugins
update-plugins: ## Update jenkins base plugins
@echo "+ $@"
@JENKINS_VERSION=$$(sed -n 's/LATEST_LTS_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"'); \
echo "updating plugins for Jenkins $$JENKINS_VERSION"; \
./.github/workflows/update-plugins.sh "$$JENKINS_VERSION"
.PHONY: update-plugins-dry-run
update-plugins-dry-run: ## Update jenkins base plugin -- dry run
@echo "+ $@"
@JENKINS_VERSION=$$(sed -n 's/LATEST_LTS_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"'); \
echo "checking plugins for Jenkins $$JENKINS_VERSION -- dry run"; \
./.github/workflows/update-plugins.sh "$$JENKINS_VERSION" --dry-run
.PHONY: update-jenkins-lts
update-jenkins-lts: ## Fetch latest Jenkins lts version and update if necessary
@echo "+ $@"
@LATEST_VERSION=$$(curl -s https://www.jenkins.io/changelog-stable/ | grep -oP 'changelog/\K\d+\.\d+\.\d+' | head -1); \
CURRENT_VERSION=$$(sed -n 's/LATEST_LTS_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"'); \
echo "current version: $$CURRENT_VERSION"; \
echo "latest version: $$LATEST_VERSION"; \
if [ "$$CURRENT_VERSION" != "$$LATEST_VERSION" ]; then \
echo "updating Jenkins lts version from $$CURRENT_VERSION to $$LATEST_VERSION"; \
sed -i "s/LATEST_LTS_VERSION=\".*\"/LATEST_LTS_VERSION=\"$$LATEST_VERSION\"/" config.base.env; \
$(MAKE) update-lts-version LATEST_LTS_VERSION=$$LATEST_VERSION; \
echo "updated Jenkins LTS version to $$LATEST_VERSION"; \
else \
echo "up to date"; \
fi
.PHONY: update-lts-version
update-lts-version: ## Update the latest lts version
@echo "+ $@"
echo $(LATEST_LTS_VERSION)
sed -i 's|jenkins/jenkins:[0-9]\+.[0-9]\+.[0-9]\+|jenkins/jenkins:$(LATEST_LTS_VERSION)|g' chart/jenkins-operator/values.yaml
sed -i 's|jenkins/jenkins:[0-9]\+.[0-9]\+.[0-9]\+|jenkins/jenkins:$(LATEST_LTS_VERSION)|g' test/e2e/test_utility.go
sed -i 's|jenkins/jenkins:[0-9]\+.[0-9]\+.[0-9]\+|jenkins/jenkins:$(LATEST_LTS_VERSION)|g' test/helm/helm_test.go
sed -i 's|jenkins/jenkins:[0-9]\+.[0-9]\+.[0-9]\+|jenkins/jenkins:$(LATEST_LTS_VERSION)|g' pkg/constants/constants.go
#TODO: source the version from config.base.env for bats test, no need of hardcoded version
sed -i 's|jenkins/jenkins:[0-9]\+.[0-9]\+.[0-9]\+|jenkins/jenkins:$(LATEST_LTS_VERSION)|g' test/bats/1-deploy.bats
sed -i 's|jenkins/jenkins:[0-9]\+.[0-9]\+.[0-9]\+|jenkins/jenkins:$(LATEST_LTS_VERSION)|g' test/bats/2-deploy-with-more-options.bats
sed -i 's|jenkins/jenkins:[0-9]\+.[0-9]\+.[0-9]\+|jenkins/jenkins:$(LATEST_LTS_VERSION)|g' test/bats/3-deploy-with-webhook.bats
.PHONY: run .PHONY: run
run: export WATCH_NAMESPACE = $(NAMESPACE) run: export WATCH_NAMESPACE = $(NAMESPACE)
run: export OPERATOR_NAME = $(NAME) run: export OPERATOR_NAME = $(NAME)
run: fmt vet install-crds build ## Run the executable, you can use EXTRA_ARGS run: fmt vet install-crds build ## Run the executable, you can use EXTRA_ARGS
@echo "+ $@" @echo "+ $@"
ifeq ($(KUBERNETES_PROVIDER),kind) ifeq ($(KUBERNETES_PROVIDER),minikube)
kubectl config use-context $(KUBECTL_CONTEXT) kubectl config use-context $(KUBECTL_CONTEXT)
endif endif
ifeq ($(KUBERNETES_PROVIDER),crc) ifeq ($(KUBERNETES_PROVIDER),crc)
@ -301,66 +207,46 @@ endif
container-runtime-login: ## Log in into the Docker repository container-runtime-login: ## Log in into the Docker repository
@echo "+ $@" @echo "+ $@"
.PHONY: container-runtime-build-% .PHONY: container-runtime-build
container-runtime-build-%: ## Build the container container-runtime-build: check-env deepcopy-gen ## Build the container
@echo "+ $@" @echo "+ $@"
$(CONTAINER_RUNTIME_COMMAND) buildx build \ $(CONTAINER_RUNTIME_COMMAND) build \
--output=type=docker --platform linux/$* \
--build-arg GO_VERSION=$(GO_VERSION) \ --build-arg GO_VERSION=$(GO_VERSION) \
--build-arg CTIMEVAR="$(CTIMEVAR)" \ --build-arg CTIMEVAR="$(CTIMEVAR)" \
--tag quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY):$(GITCOMMIT)-$* . \ -t $(DOCKER_REGISTRY):$(GITCOMMIT) . \
--file Dockerfile $(CONTAINER_RUNTIME_EXTRA_ARGS) --file Dockerfile $(CONTAINER_RUNTIME_EXTRA_ARGS)
.PHONY: container-runtime-build
container-runtime-build: check-env deepcopy-gen container-runtime-build-amd64 container-runtime-build-arm64
.PHONY: container-runtime-images .PHONY: container-runtime-images
container-runtime-images: ## List all local containers container-runtime-images: ## List all local containers
@echo "+ $@" @echo "+ $@"
$(CONTAINER_RUNTIME_COMMAND) images $(CONTAINER_RUNTIME_EXTRA_ARGS) $(CONTAINER_RUNTIME_COMMAND) images $(CONTAINER_RUNTIME_EXTRA_ARGS)
define buildx-create-command
$(CONTAINER_RUNTIME_COMMAND) buildx create \
--driver=docker-container \
--use
endef
## Parameter is version
define container-runtime-push-command
$(CONTAINER_RUNTIME_COMMAND) buildx build \
--output=type=registry --platform linux/amd64,linux/arm64 \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg CTIMEVAR="$(CTIMEVAR)" \
--tag quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY):$(1) . \
--file Dockerfile $(CONTAINER_RUNTIME_EXTRA_ARGS)
endef
.PHONY: container-runtime-push .PHONY: container-runtime-push
container-runtime-push: check-env deepcopy-gen ## Push the container container-runtime-push: ## Push the container
@echo "+ $@" @echo "+ $@"
$(call buildx-create-command) $(CONTAINER_RUNTIME_COMMAND) tag $(DOCKER_REGISTRY):$(GITCOMMIT) $(DOCKER_ORGANIZATION)/$(DOCKER_REGISTRY):$(BUILD_TAG) $(CONTAINER_RUNTIME_EXTRA_ARGS)
$(call container-runtime-push-command,$(BUILD_TAG)) $(CONTAINER_RUNTIME_COMMAND) push $(DOCKER_ORGANIZATION)/$(DOCKER_REGISTRY):$(BUILD_TAG) $(CONTAINER_RUNTIME_EXTRA_ARGS)
.PHONY: container-runtime-snapshot-push .PHONY: container-runtime-snapshot-push
container-runtime-snapshot-push: check-env deepcopy-gen container-runtime-snapshot-push: container-runtime-build
@echo "+ $@" @echo "+ $@"
$(call buildx-create-command) $(CONTAINER_RUNTIME_COMMAND) tag $(DOCKER_REGISTRY):$(GITCOMMIT) $(DOCKER_ORGANIZATION)/$(DOCKER_REGISTRY):$(GITCOMMIT) $(CONTAINER_RUNTIME_EXTRA_ARGS)
$(call container-runtime-push-command,$(GITCOMMIT)) $(CONTAINER_RUNTIME_COMMAND) push $(DOCKER_ORGANIZATION)/$(DOCKER_REGISTRY):$(GITCOMMIT) $(CONTAINER_RUNTIME_EXTRA_ARGS)
.PHONY: container-runtime-release-version .PHONY: container-runtime-release-version
container-runtime-release-version: check-env deepcopy-gen ## Release image with version tag (in addition to build tag) container-runtime-release-version: ## Release image with version tag (in addition to build tag)
@echo "+ $@" @echo "+ $@"
$(call buildx-create-command) $(CONTAINER_RUNTIME_COMMAND) tag $(DOCKER_REGISTRY):$(GITCOMMIT) $(DOCKER_ORGANIZATION)/$(DOCKER_REGISTRY):$(VERSION_TAG) $(CONTAINER_RUNTIME_EXTRA_ARGS)
$(call container-runtime-push-command,$(VERSION_TAG)) $(CONTAINER_RUNTIME_COMMAND) push $(DOCKER_ORGANIZATION)/$(DOCKER_REGISTRY):$(VERSION_TAG) $(CONTAINER_RUNTIME_EXTRA_ARGS)
.PHONY: container-runtime-release-latest .PHONY: container-runtime-release-latest
container-runtime-release-latest: check-env deepcopy-gen ## Release image with latest tags (in addition to build tag) container-runtime-release-latest: ## Release image with latest tags (in addition to build tag)
@echo "+ $@" @echo "+ $@"
$(call buildx-create-command) $(CONTAINER_RUNTIME_COMMAND) tag $(DOCKER_REGISTRY):$(GITCOMMIT) $(DOCKER_ORGANIZATION)/$(DOCKER_REGISTRY):$(LATEST_TAG) $(CONTAINER_RUNTIME_EXTRA_ARGS)
$(call container-runtime-push-command,$(LATEST_TAG)) $(CONTAINER_RUNTIME_COMMAND) push $(DOCKER_ORGANIZATION)/$(DOCKER_REGISTRY):$(LATEST_TAG) $(CONTAINER_RUNTIME_EXTRA_ARGS)
.PHONY: container-runtime-release .PHONY: container-runtime-release
container-runtime-release: container-runtime-release-version container-runtime-release-latest ## Release image with version and latest tags (in addition to build tag) container-runtime-release: container-runtime-build container-runtime-release-version container-runtime-release-latest ## Release image with version and latest tags (in addition to build tag)
@echo "+ $@" @echo "+ $@"
# if this session isn't interactive, then we don't want to allocate a # if this session isn't interactive, then we don't want to allocate a
@ -376,7 +262,13 @@ container-runtime-run: ## Run the container in docker, you can use EXTRA_ARGS
@echo "+ $@" @echo "+ $@"
$(CONTAINER_RUNTIME_COMMAND) run $(CONTAINER_RUNTIME_EXTRA_ARGS) --rm -i $(DOCKER_FLAGS) \ $(CONTAINER_RUNTIME_COMMAND) run $(CONTAINER_RUNTIME_EXTRA_ARGS) --rm -i $(DOCKER_FLAGS) \
--volume $(HOME)/.kube/config:/home/jenkins-operator/.kube/config \ --volume $(HOME)/.kube/config:/home/jenkins-operator/.kube/config \
quay.io/${QUAY_ORGANIZATION}/$(QUAY_REGISTRY):$(GITCOMMIT) /usr/bin/jenkins-operator $(OPERATOR_ARGS) $(DOCKER_REGISTRY):$(GITCOMMIT) /usr/bin/jenkins-operator $(OPERATOR_ARGS)
.PHONY: minikube-run
minikube-run: export WATCH_NAMESPACE = $(NAMESPACE)
minikube-run: export OPERATOR_NAME = $(NAME)
minikube-run: minikube-start run ## Run the operator locally and use minikube as Kubernetes cluster, you can use OPERATOR_ARGS
@echo "+ $@"
.PHONY: crc-run .PHONY: crc-run
crc-run: export WATCH_NAMESPACE = $(NAMESPACE) crc-run: export WATCH_NAMESPACE = $(NAMESPACE)
@ -400,6 +292,14 @@ ifndef HAS_GEN_CRD_API_REFERENCE_DOCS
endif endif
$(GEN_CRD_API)/$(GEN_CRD_API) -config gen-crd-api-config.json -api-dir $(PKG)/api/$(API_VERSION) -template-dir $(GEN_CRD_API)/template -out-file documentation/$(VERSION)/jenkins-$(API_VERSION)-scheme.md $(GEN_CRD_API)/$(GEN_CRD_API) -config gen-crd-api-config.json -api-dir $(PKG)/api/$(API_VERSION) -template-dir $(GEN_CRD_API)/template -out-file documentation/$(VERSION)/jenkins-$(API_VERSION)-scheme.md
.PHONY: check-minikube
check-minikube: ## Checks if KUBERNETES_PROVIDER is set to minikube
@echo "+ $@"
@echo "KUBERNETES_PROVIDER '$(KUBERNETES_PROVIDER)'"
ifneq ($(KUBERNETES_PROVIDER),minikube)
$(error KUBERNETES_PROVIDER not set to 'minikube')
endif
.PHONY: check-crc .PHONY: check-crc
check-crc: ## Checks if KUBERNETES_PROVIDER is set to crc check-crc: ## Checks if KUBERNETES_PROVIDER is set to crc
@echo "+ $@" @echo "+ $@"
@ -408,34 +308,34 @@ ifneq ($(KUBERNETES_PROVIDER),crc)
$(error KUBERNETES_PROVIDER not set to 'crc') $(error KUBERNETES_PROVIDER not set to 'crc')
endif endif
.PHONY: kind-setup .PHONY: helm
kind-setup: ## Setup kind cluster HAS_HELM := $(shell which $(PROJECT_DIR)/bin/helm)
helm: ## Download helm if it's not present
@echo "+ $@" @echo "+ $@"
kind create cluster --config kind-cluster.yaml --name $(KIND_CLUSTER_NAME) ifndef HAS_HELM
mkdir -p $(PROJECT_DIR)/bin
.PHONY: kind-clean curl -Lo bin/helm.tar.gz https://get.helm.sh/helm-v$(HELM_VERSION)-$(PLATFORM)-amd64.tar.gz && tar xzfv bin/helm.tar.gz -C $(PROJECT_DIR)/bin
kind-clean: ## Delete kind cluster mv $(PROJECT_DIR)/bin/$(PLATFORM)-amd64/helm $(PROJECT_DIR)/bin/helm
@echo "+ $@" rm -rf $(PROJECT_DIR)/bin/$(PLATFORM)-amd64
kind delete cluster --name $(KIND_CLUSTER_NAME) rm -rf $(PROJECT_DIR)/bin/helm.tar.gz
.PHONY: kind-revamp
kind-revamp: kind-clean kind-setup ## Delete and recreate kind cluster
@echo "+ $@"
.PHONY: bats-tests ## Run bats tests
IMAGE_NAME := quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY):$(GITCOMMIT)-amd64
BUILD_PRESENT := $(shell docker images |grep -q ${IMAGE_NAME})
ifndef BUILD_PRESENT
bats-tests: backup-kind-load container-runtime-build-amd64 ## Run bats tests
@echo "+ $@"
kind load docker-image ${IMAGE_NAME} --name $(KIND_CLUSTER_NAME)
OPERATOR_IMAGE="${IMAGE_NAME}" TERM=xterm bats -T -p test/bats$(if $(BATS_TEST_PATH),/${BATS_TEST_PATH})
else
bats-tests: backup-kind-load
@echo "+ $@"
OPERATOR_IMAGE="${IMAGE_NAME}" TERM=xterm bats -T -p test/bats$(if $(BATS_TEST_PATH),/${BATS_TEST_PATH})
endif endif
.PHONY: minikube
HAS_MINIKUBE := $(shell which $(PROJECT_DIR)/bin/minikube)
minikube: ## Download minikube if it's not present
@echo "+ $@"
ifndef HAS_MINIKUBE
mkdir -p $(PROJECT_DIR)/bin
wget -O $(PROJECT_DIR)/bin/minikube https://github.com/kubernetes/minikube/releases/download/v$(MINIKUBE_VERSION)/minikube-$(PLATFORM)-amd64
chmod +x $(PROJECT_DIR)/bin/minikube
endif
.PHONY: minikube-start
minikube-start: minikube check-minikube ## Start minikube
@echo "+ $@"
bin/minikube status && exit 0 || \
bin/minikube start --kubernetes-version $(MINIKUBE_KUBERNETES_VERSION) --dns-domain=$(CLUSTER_DOMAIN) --extra-config=kubelet.cluster-domain=$(CLUSTER_DOMAIN) --driver=$(MINIKUBE_DRIVER) --memory 4096 --cpus $(CPUS_NUMBER)
.PHONY: crc-start .PHONY: crc-start
crc-start: check-crc ## Start CodeReady Containers Kubernetes cluster crc-start: check-crc ## Start CodeReady Containers Kubernetes cluster
@echo "+ $@" @echo "+ $@"
@ -478,7 +378,7 @@ bump-version: sembump ## Bump the version in the version file. Set BUMP to [ pat
.PHONY: tag .PHONY: tag
tag: ## Create a new git tag to prepare to build a release tag: ## Create a new git tag to prepare to build a release
@echo "+ $@" @echo "+ $@"
git tag -a $(VERSION) -m "$(VERSION)" git tag -s -a $(VERSION) -m "$(VERSION)"
git push origin $(VERSION) git push origin $(VERSION)
.PHONY: help .PHONY: help
@ -497,19 +397,32 @@ ifneq ($(GITUNTRACKEDCHANGES),)
endif endif
ifneq ($(GITIGNOREDBUTTRACKEDCHANGES),) ifneq ($(GITIGNOREDBUTTRACKEDCHANGES),)
@echo "Ignored but tracked files:" @echo "Ignored but tracked files:"
@git ls-files -i -o --exclude-standard @git ls-files -i --exclude-standard
@echo @echo
endif endif
@echo "Dependencies:" @echo "Dependencies:"
go mod vendor -v go mod vendor -v
@echo @echo
.PHONY: helm-lint
helm-lint: helm
@echo "+ $@"
bin/helm lint chart/jenkins-operator
.PHONY: helm-release-latest
helm-release-latest: helm
@echo "+ $@"
mkdir -p /tmp/jenkins-operator-charts
mv chart/jenkins-operator/*.tgz /tmp/jenkins-operator-charts
cd chart && ../bin/helm package jenkins-operator
mv chart/jenkins-operator-*.tgz chart/jenkins-operator/
bin/helm repo index chart/ --url https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/ --merge chart/index.yaml
mv /tmp/jenkins-operator-charts/*.tgz chart/jenkins-operator/
# Download and build hugo extended locally if necessary # Download and build hugo extended locally if necessary
HUGO_PATH = $(shell pwd)/bin/hugo HUGO_PATH = $(shell pwd)/bin/hugo
HUGO_VERSION = v0.99.1 HUGO_VERSION = v0.62.2
HAS_HUGO := $(shell $(HUGO_PATH)/hugo version 2>&- | grep $(HUGO_VERSION)) HAS_HUGO := $(shell $(HUGO_PATH)/hugo version 2>&- | grep $(HUGO_VERSION))
.PHONY: hugo
hugo: hugo:
ifeq ($(HAS_HUGO), ) ifeq ($(HAS_HUGO), )
@echo "Installing Hugo $(HUGO_VERSION)" @echo "Installing Hugo $(HUGO_VERSION)"
@ -532,77 +445,59 @@ run-docs: hugo
##################### FROM OPERATOR SDK ######################## ##################### FROM OPERATOR SDK ########################
# Install CRDs into a cluster # Install CRDs into a cluster
.PHONY: install-crds
install-crds: manifests kustomize install-crds: manifests kustomize
$(KUSTOMIZE) build config/crd | kubectl apply -f - $(KUSTOMIZE) build config/crd | kubectl apply -f -
# Uninstall CRDs from a cluster # Uninstall CRDs from a cluster
ifndef ignore-not-found
ignore-not-found = false
endif
.PHONY: uninstall-crds
uninstall-crds: manifests kustomize uninstall-crds: manifests kustomize
$(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f - $(KUSTOMIZE) build config/crd | kubectl delete -f -
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config # Deploy controller in the configured Kubernetes cluster in ~/.kube/config
.PHONY: deploy
deploy: manifests kustomize deploy: manifests kustomize
cd config/manager && $(KUSTOMIZE) edit set image controller=quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY):$(GITCOMMIT) cd config/manager && $(KUSTOMIZE) edit set image controller=$(DOCKER_REGISTRY):$(GITCOMMIT)
$(KUSTOMIZE) build config/default | kubectl apply -f - $(KUSTOMIZE) build config/default | kubectl apply -f -
# UnDeploy controller from the configured Kubernetes cluster in ~/.kube/config # UnDeploy controller from the configured Kubernetes cluster in ~/.kube/config
.PHONY: undeploy
undeploy: undeploy:
$(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f - $(KUSTOMIZE) build config/default | kubectl delete -f -
# Generate manifests e.g. CRD, RBAC etc. # Generate manifests e.g. CRD, RBAC etc.
.PHONY: manifests
manifests: controller-gen manifests: controller-gen
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
# Generate code # Generate code
.PHONY: generate
generate: controller-gen generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
##@ Build Dependencies # Download controller-gen locally if necessary
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen:
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1)
## Location to install dependencies to # Download kustomize locally if necessary
LOCALBIN ?= $(shell pwd)/bin KUSTOMIZE = $(shell pwd)/bin/kustomize
$(LOCALBIN): kustomize:
mkdir -p $(LOCALBIN) $(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v3@v3.8.7)
## Tool Binaries # go-get-tool will 'go get' any package $2 and install it to $1.
KUSTOMIZE ?= $(LOCALBIN)/kustomize define go-get-tool
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen @[ -f $(1) ] || { \
ENVTEST ?= $(LOCALBIN)/setup-envtest set -e ;\
TMP_DIR=$$(mktemp -d) ;\
## Tool Versions cd $$TMP_DIR ;\
KUSTOMIZE_VERSION ?= v5.3.0 go mod init tmp ;\
CONTROLLER_TOOLS_VERSION ?= v0.14.0 echo "Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" rm -rf $$TMP_DIR ;\
.PHONY: kustomize }
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. endef
$(KUSTOMIZE): $(LOCALBIN)
test -s $(LOCALBIN)/kustomize || { curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); }
.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@release-0.17
.PHONY: operator-sdk .PHONY: operator-sdk
HAS_OPERATOR_SDK := $(shell which $(PROJECT_DIR)/bin/operator-sdk) HAS_OPERATOR_SDK := $(shell which $(PROJECT_DIR)/bin/operator-sdk)
operator-sdk: # Download operator-sdk locally if necessary operator-sdk: # Download operator-sdk locally if necessary
@echo "+ $@" @echo "+ $@"
ifndef HAS_OPERATOR_SDK ifndef HAS_OPERATOR_SDK
wget -O $(PROJECT_DIR)/bin/operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/v${OPERATOR_SDK_VERSION}/operator-sdk_$(PLATFORM)_amd64 wget -O $(PROJECT_DIR)/bin/operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/v1.3.0/operator-sdk_$(PLATFORM)_amd64
chmod +x $(PROJECT_DIR)/bin/operator-sdk chmod +x $(PROJECT_DIR)/bin/operator-sdk
endif endif
@ -610,8 +505,8 @@ endif
.PHONY: bundle .PHONY: bundle
bundle: manifests operator-sdk kustomize bundle: manifests operator-sdk kustomize
bin/operator-sdk generate kustomize manifests -q bin/operator-sdk generate kustomize manifests -q
cd config/manager && $(KUSTOMIZE) edit set image controller=quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY):$(VERSION_TAG) cd config/manager && $(KUSTOMIZE) edit set image controller=$(DOCKER_ORGANIZATION)/$(DOCKER_REGISTRY):$(VERSION_TAG)
$(KUSTOMIZE) build config/manifests | bin/operator-sdk generate bundle $(BUNDLE_GEN_FLAGS) $(KUSTOMIZE) build config/manifests | bin/operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
bin/operator-sdk bundle validate ./bundle bin/operator-sdk bundle validate ./bundle
# Build the bundle image. # Build the bundle image.
@ -620,64 +515,19 @@ bundle-build:
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) . docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
# Download kubebuilder # Download kubebuilder
.PHONY: kubebuilder
kubebuilder: kubebuilder:
mkdir -p ${ENVTEST_ASSETS_DIR} mkdir -p ${ENVTEST_ASSETS_DIR}
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.0/hack/setup-envtest.sh test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.0/hack/setup-envtest.sh
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR);
# install cert-manager v1.5.1 # install cert-manager v1.5.1
install-cert-manager: kind-setup install-cert-manager: minikube-start
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.5.1/cert-manager.yaml kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.5.1/cert-manager.yaml
uninstall-cert-manager: kind-setup uninstall-cert-manager: minikube-start
kubectl delete -f https://github.com/jetstack/cert-manager/releases/download/v1.5.1/cert-manager.yaml kubectl delete -f https://github.com/jetstack/cert-manager/releases/download/v1.5.1/cert-manager.yaml
# Deploy the operator locally along with webhook using helm charts # Deploy the operator locally along with webhook using helm charts
.PHONY: deploy-webhook deploy-webhook: container-runtime-build
deploy-webhook: container-runtime-build-amd64
@echo "+ $@" @echo "+ $@"
bin/helm upgrade jenkins chart/jenkins-operator --install --set-string operator.image=${IMAGE_NAME} --set webhook.enabled=true --set jenkins.enabled=false bin/helm upgrade jenkins chart/jenkins-operator --install --set-string operator.image=${IMAGE_NAME} --set webhook.enabled=true --set jenkins.enabled=false
# https://sdk.operatorframework.io/docs/upgrading-sdk-version/v1.6.1/#gov2-gov3-ansiblev1-helmv1-add-opm-and-catalog-build-makefile-targets
.PHONY: opm
OPM = ./bin/opm
opm:
ifeq (,$(wildcard $(OPM)))
ifeq (,$(shell which opm 2>/dev/null))
@{ \
set -e ;\
mkdir -p $(dir $(OPM)) ;\
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.0/$${OS}-$${ARCH}-opm ;\
chmod +x $(OPM) ;\
}
else
OPM = $(shell which opm)
endif
endif
BUNDLE_IMGS ?= $(BUNDLE_IMG)
CATALOG_IMG ?= $(IMAGE_TAG_BASE)-catalog:v$(VERSION) ifneq ($(origin CATALOG_BASE_IMG), undefined) FROM_INDEX_OPT := --from-index $(CATALOG_BASE_IMG) endif
.PHONY: catalog-build
catalog-build: opm
$(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
.PHONY: catalog-push
catalog-push: ## Push the catalog image.
$(MAKE) docker-push IMG=$(CATALOG_IMG)
# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
# - able to use docker buildx . More info: https://docs.docker.com/build/buildx/
# - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/
# - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=<myregistry/image:<tag>> than the export will fail)
# To properly provided solutions that supports more than one platform you should use this option.
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
.PHONY: docker-buildx
docker-buildx: test ## Build and push docker image for the manager for cross-platform support
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- docker buildx create --name project-v3-builder
docker buildx use project-v3-builder
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross
- docker buildx rm project-v3-builder
rm Dockerfile.cross

13
PROJECT
View File

@ -1,21 +1,14 @@
domain: jenkins.io domain: jenkins.io
layout: go.kubebuilder.io/v4 layout: go.kubebuilder.io/v3
projectName: jenkins-operator projectName: jenkins-operator
repo: github.com/jenkinsci/kubernetes-operator repo: github.com/jenkinsci/kubernetes-operator
resources: resources:
- api: - crdVersion: v1
crdVersion: v1
namespaced: true
# TODO(user): Uncomment the below line if this resource implements a controller, else delete it.
# controller: true
domain: jenkins.io
group: jenkins.io group: jenkins.io
kind: Jenkins kind: Jenkins
path: github.com/jenkinsci/kubernetes-operator/api/v1alpha2
version: v1alpha2 version: v1alpha2
webhooks:
webhookVersion: v1 webhookVersion: v1
version: "3" version: 3-alpha
plugins: plugins:
manifests.sdk.operatorframework.io/v2: {} manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {} scorecard.sdk.operatorframework.io/v2: {}

View File

@ -1,16 +1,11 @@
# Jenkins Operator # Jenkins Operator
[![Version](https://img.shields.io/badge/version-v0.8.0-brightgreen.svg)](https://github.com/jenkinsci/kubernetes-operator/releases/tag/v0.8.0) [![Version](https://img.shields.io/badge/version-v0.7.0-brightgreen.svg)](https://github.com/jenkinsci/kubernetes-operator/releases/tag/v0.7.0)
[![Build status](https://github.com/jenkinsci/kubernetes-operator/actions/workflows/auto-tests-e2e.yaml/badge.svg)](https://github.com/jenkinsci/kubernetes-operator/actions/workflows/auto-tests-e2e.yaml) [![Build status](https://github.com/jenkinsci/kubernetes-operator/actions/workflows/auto-tests.yaml/badge.svg)](https://github.com/jenkinsci/kubernetes-operator/actions/workflows/auto-tests.yaml)
[![Go Report Card](https://goreportcard.com/badge/github.com/jenkinsci/kubernetes-operator "Go Report Card")](https://goreportcard.com/report/github.com/jenkinsci/kubernetes-operator) [![Go Report Card](https://goreportcard.com/badge/github.com/jenkinsci/kubernetes-operator "Go Report Card")](https://goreportcard.com/report/github.com/jenkinsci/kubernetes-operator)
[![Gitter chat](https://badges.gitter.im/jenkinsci/kubernetes-operator.png)](https://gitter.im/jenkinsci/kubernetes-operator) [![Docker Pulls](https://img.shields.io/docker/pulls/virtuslab/jenkins-operator.svg)](https://hub.docker.com/r/virtuslab/jenkins-operator/tags)
<a href=""> ![logo](/assets/jenkins_gopher_wide.png)
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/assets/jenkins_gopher_wide_exp_dark.png">
<img src="https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/assets/jenkins_gopher_wide_exp.png">
</picture>
</a>
## What's the Jenkins Operator? ## What's the Jenkins Operator?
@ -33,7 +28,7 @@ Jenkins uses [plugins](https://plugins.jenkins.io/) like CasC to extend it's sol
- Integration with Kubernetes ([Jenkins kubernetes-plugin](https://github.com/jenkinsci/kubernetes-plugin)) - Integration with Kubernetes ([Jenkins kubernetes-plugin](https://github.com/jenkinsci/kubernetes-plugin))
- Pipelines as Code ([Jenkins pipelines](https://jenkins.io/doc/book/pipeline/)) - Pipelines as Code ([Jenkins pipelines](https://jenkins.io/doc/book/pipeline/))
- Extensibility via Groovy Scripts (similar to [Jenkins script console](https://wiki.jenkins.io/display/JENKINS/Jenkins+Script+Console)) or ([configuration as code plugin](https://github.com/jenkinsci/configuration-as-code-plugin)) - Extensibility via Groovy Scripts (similar to [Jenkins script console](https://wiki.jenkins.io/display/JENKINS/Jenkins+Script+Console)) or ([configuration as code plugin](https://github.com/jenkinsci/configuration-as-code-plugin))
- Secure Defaults and Hardening (see [the security section](https://jenkinsci.github.io/kubernetes-operator/docs/security/) of the documentation) - Secure Defaults and Hardening (see [the security section](https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/security/) of the documentation)
## Problem statement and goals ## Problem statement and goals
@ -43,7 +38,7 @@ We want to make Jenkins more robust, suitable for dynamic and multi-tenant envir
Some of the problems we want to solve: Some of the problems we want to solve:
- [installing plugins with incompatible versions or security vulnerabilities](https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/customizing-jenkins/#install-plugins/) - [installing plugins with incompatible versions or security vulnerabilities](https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/customizing-jenkins/#install-plugins/)
- [better configuration as code](https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/customizing-jenkins/) - [better configuration as code](https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/customizing-jenkins/)
- [security and hardening out of the box](https://jenkinsci.github.io/kubernetes-operator/docs/security/) - [security and hardening out of the box](https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/security/)
- [make errors more visible for end users](https://jenkinsci.github.io/kubernetes-operator/docs/troubleshooting/) - [make errors more visible for end users](https://jenkinsci.github.io/kubernetes-operator/docs/troubleshooting/)
- orphaned jobs with no JNLP connection - orphaned jobs with no JNLP connection
- handle graceful shutdown properly - handle graceful shutdown properly
@ -56,7 +51,7 @@ Go to [**our documentation website**](https://jenkinsci.github.io/kubernetes-ope
Selected content: Selected content:
1. [How it works](https://jenkinsci.github.io/kubernetes-operator/docs/how-it-works/) 1. [How it works](https://jenkinsci.github.io/kubernetes-operator/docs/how-it-works/)
2. [Getting Started](https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/) 2. [Getting Started](https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/)
3. [Security](https://jenkinsci.github.io/kubernetes-operator/docs/security/) 3. [Security](https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/security/)
4. [Troubleshooting](https://jenkinsci.github.io/kubernetes-operator/docs/troubleshooting/) 4. [Troubleshooting](https://jenkinsci.github.io/kubernetes-operator/docs/troubleshooting/)
5. [Developer Guide](https://jenkinsci.github.io/kubernetes-operator/docs/developer-guide/) 5. [Developer Guide](https://jenkinsci.github.io/kubernetes-operator/docs/developer-guide/)
6. [FAQ](https://jenkinsci.github.io/kubernetes-operator/docs/faq/) 6. [FAQ](https://jenkinsci.github.io/kubernetes-operator/docs/faq/)
@ -71,14 +66,15 @@ Main channel of communication on topics related to Jenkins Operator is [Jenkins
Here you can ask questions about the project, discuss best practices on using it, and talk to other users of the Operator, contributors and project's maintainers. Here you can ask questions about the project, discuss best practices on using it, and talk to other users of the Operator, contributors and project's maintainers.
We also have a [gitter](https://gitter.im/jenkinsci/kubernetes-operator)/[matrix](https://matrix.to/#/#jenkinsci_kubernetes-operator:gitter.im) channel, come to say hi! We also have a dedicated channel called `#jenkins-operator` on [virtuslab-oss.slack.com](https://virtuslab-oss.slack.com).
Fill out ([Invite form](https://forms.gle/X3X8qA1XMirdBuEH7)) and come say hi!
## Snapshots between releases ## Snapshots between releases
We are trying our best to resolve issues quickly, but they have to wait to be released. If you can't wait for an official We are trying our best to resolve issues quickly, but they have to wait to be released. If you can't wait for an official
docker image release and acknowledge the risk, you can use our unofficial images, which are built nightly. docker image release and acknowledge the risk, you can use our unofficial images, which are built nightly.
You can find the project's Quay.io repository [here](https://quay.io/organization/jenkins-kubernetes-operator). You can find the project's Docker Hub repository [here](https://hub.docker.com/r/virtuslab/jenkins-operator).
Look for the images with tag "{git-hash}", where {git-hash} is the hash of the master commit that interests you. Look for the images with tag "{git-hash}", where {git-hash} is the hash of the master commit that interests you.

19
SECURITY.md Normal file
View File

@ -0,0 +1,19 @@
# Security Policy
The Jenkins project takes security seriously.
We make every possible effort to ensure users can adequately secure their automation infrastructure.
To that end, we work with Jenkins core and plugin developers, as well as security researchers, to fix security vulnerabilities in Jenkins in a timely manner, and to improve the security of Jenkins in general.
## Reporting Security Vulnerabilities
Please report security vulnerabilities in the Jenkins issue tracker under the [SECURITY project](https://issues.jenkins-ci.org/browse/SECURITY).
This project is configured in such a way that only the reporter and the security team can see the details.
By restricting access to this potentially sensitive information, we can work on a fix and deliver it before the method of attack becomes well-known.
If you are unable to report using our issue tracker, you can also send your report to the private Jenkins security team mailing list: `jenkinsci-cert@googlegroups.com`
The Jenkins security team will then file an issue on your behalf, and will work with the maintainers of the affected component(s) to get the issue resolved.
## Learn More
For further details about our scope, issue handling process, or disclosure process, see [Reporting Security Vulnerabilities on jenkins.io](https://jenkins.io/security/reporting/).

View File

@ -1 +1 @@
v0.9.0-beta1 v0.7.0

View File

@ -14,14 +14,10 @@ type JenkinsSpec struct {
Master JenkinsMaster `json:"master"` Master JenkinsMaster `json:"master"`
// SeedJobs defines list of Jenkins Seed Job configurations // SeedJobs defines list of Jenkins Seed Job configurations
// More info: https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuring-seed-jobs-and-pipelines/ // More info: https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuration#configure-seed-jobs-and-pipelines
// +optional // +optional
SeedJobs []SeedJob `json:"seedJobs,omitempty"` SeedJobs []SeedJob `json:"seedJobs,omitempty"`
// SeedJobAgentImage defines the image that will be used by the seed job agent. If not defined jenkins/inbound-agent:4.9-1 will be used.
// +optional
SeedJobAgentImage string `json:"seedJobAgentImage,omitempty"`
// ValidateSecurityWarnings enables or disables validating potential security warnings in Jenkins plugins via admission webhooks. // ValidateSecurityWarnings enables or disables validating potential security warnings in Jenkins plugins via admission webhooks.
//+optional //+optional
ValidateSecurityWarnings bool `json:"validateSecurityWarnings,omitempty"` ValidateSecurityWarnings bool `json:"validateSecurityWarnings,omitempty"`
@ -46,12 +42,12 @@ type JenkinsSpec struct {
SlaveService Service `json:"slaveService,omitempty"` SlaveService Service `json:"slaveService,omitempty"`
// Backup defines configuration of Jenkins backup // Backup defines configuration of Jenkins backup
// More info: https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuring-backup-and-restore/ // More info: https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configure-backup-and-restore/
// +optional // +optional
Backup Backup `json:"backup,omitempty"` Backup Backup `json:"backup,omitempty"`
// Backup defines configuration of Jenkins backup restore // Backup defines configuration of Jenkins backup restore
// More info: https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuring-backup-and-restore/ // More info: https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configure-backup-and-restore/
// +optional // +optional
Restore Restore `json:"restore,omitempty"` Restore Restore `json:"restore,omitempty"`
@ -311,7 +307,6 @@ type JenkinsMaster struct {
// periodSeconds: 10 // periodSeconds: 10
// successThreshold: 1 // successThreshold: 1
// timeoutSeconds: 5 // timeoutSeconds: 5
// lifecycle: {}
// name: jenkins-master // name: jenkins-master
// readinessProbe: // readinessProbe:
// failureThreshold: 3 // failureThreshold: 3
@ -351,38 +346,26 @@ type JenkinsMaster struct {
// BasePlugins contains plugins required by operator // BasePlugins contains plugins required by operator
// +optional // +optional
// Defaults to : // Defaults to :
// - name: configuration-as-code
// version: "1625.v27444588cc3d"
// - name: git
// version: "5.0.0"
// - name: job-dsl
// version: "1.83"
// - name: kubernetes // - name: kubernetes
// version: "3909.v1f2c633e8590" // version: "1.30.11"
// - name: kubernetes-credentials-provider
// version: "1.211.vc236a_f5a_2f3c"
// - name: workflow-aggregator
// version: "596.v8c21c963d92d"
// - name: workflow-job // - name: workflow-job
// version: "1289.vd1c337fd5354" // version: "2.42"
// - name: workflow-aggregator
// version: "2.6"
// - name: git
// version: "4.10.0"
// - name: job-dsl
// version: "1.78.1"
// - name: configuration-as-code
// version: "1.55"
// - name: kubernetes-credentials-provider
// version: "0.20"
BasePlugins []Plugin `json:"basePlugins,omitempty"` BasePlugins []Plugin `json:"basePlugins,omitempty"`
// Plugins contains plugins required by user // Plugins contains plugins required by user
// +optional // +optional
Plugins []Plugin `json:"plugins,omitempty"` Plugins []Plugin `json:"plugins,omitempty"`
// Allow to override jenkins-plugin-cli default behavior
// while downloading the plugin and dependencies
// see: https://github.com/jenkinsci/plugin-installation-manager-tool#cli-options
// +optional
LatestPlugins *bool `json:"latestPlugins,omitempty"`
// Allow to skip installation of both BasePlugins and Plugins.
// Requires using a custom image which includes the BasePlugins.
// Defaults to false.
// +optional
SkipPlugins *bool `json:"skipPlugins,omitempty"`
// DisableCSRFProtection allows you to toggle CSRF Protection on Jenkins // DisableCSRFProtection allows you to toggle CSRF Protection on Jenkins
DisableCSRFProtection bool `json:"disableCSRFProtection"` DisableCSRFProtection bool `json:"disableCSRFProtection"`
@ -393,13 +376,6 @@ type JenkinsMaster struct {
// HostAliases for Jenkins master pod and SeedJob agent // HostAliases for Jenkins master pod and SeedJob agent
// +optional // +optional
HostAliases []corev1.HostAlias `json:"hostAliases,omitempty"` HostAliases []corev1.HostAlias `json:"hostAliases,omitempty"`
// The grace period is the duration in seconds after the processes running in the pod are sent
// a termination signal and the time when the processes are forcibly halted with a kill signal.
// Set this value longer than the expected cleanup time for your process.
// Defaults to 30 seconds.
// +optional
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
} }
// Service defines Kubernetes service attributes // Service defines Kubernetes service attributes
@ -551,7 +527,6 @@ const (
BasicSSHCredentialType JenkinsCredentialType = "basicSSHUserPrivateKey" BasicSSHCredentialType JenkinsCredentialType = "basicSSHUserPrivateKey"
// UsernamePasswordCredentialType define username & password Jenkins credential type // UsernamePasswordCredentialType define username & password Jenkins credential type
UsernamePasswordCredentialType JenkinsCredentialType = "usernamePassword" UsernamePasswordCredentialType JenkinsCredentialType = "usernamePassword"
GithubAppCredentialType JenkinsCredentialType = "githubApp"
// ExternalCredentialType defines other credential type // ExternalCredentialType defines other credential type
ExternalCredentialType JenkinsCredentialType = "external" ExternalCredentialType JenkinsCredentialType = "external"
) )
@ -561,7 +536,6 @@ var AllowedJenkinsCredentialMap = map[string]string{
string(NoJenkinsCredentialCredentialType): "", string(NoJenkinsCredentialCredentialType): "",
string(BasicSSHCredentialType): "", string(BasicSSHCredentialType): "",
string(UsernamePasswordCredentialType): "", string(UsernamePasswordCredentialType): "",
string(GithubAppCredentialType): "",
string(ExternalCredentialType): "", string(ExternalCredentialType): "",
} }

View File

@ -21,6 +21,7 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"io" "io"
"io/ioutil"
"net/http" "net/http"
"os" "os"
"time" "time"
@ -33,7 +34,6 @@ import (
ctrl "sigs.k8s.io/controller-runtime" ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log" logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook" "sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
) )
var ( var (
@ -45,7 +45,7 @@ var (
const ( const (
Hosturl = "https://ci.jenkins.io/job/Infra/job/plugin-site-api/job/generate-data/lastSuccessfulBuild/artifact/plugins.json.gzip" Hosturl = "https://ci.jenkins.io/job/Infra/job/plugin-site-api/job/generate-data/lastSuccessfulBuild/artifact/plugins.json.gzip"
PluginDataFileCompressedPath = "/tmp/plugins.json.gzip" CompressedFilePath = "/tmp/plugins.json.gzip"
PluginDataFile = "/tmp/plugins.json" PluginDataFile = "/tmp/plugins.json"
shortenedCheckingPeriod = 1 * time.Hour shortenedCheckingPeriod = 1 * time.Hour
defaultCheckingPeriod = 12 * time.Minute defaultCheckingPeriod = 12 * time.Minute
@ -58,31 +58,30 @@ func (in *Jenkins) SetupWebhookWithManager(mgr ctrl.Manager) error {
} }
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation. // TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
// +kubebuilder:webhook:path=/validate-jenkins-io-jenkins-io-v1alpha2-jenkins,mutating=false,failurePolicy=fail,sideEffects=None,groups=jenkins.io.jenkins.io,resources=jenkins,verbs=create;update,versions=v1alpha2,name=vjenkins.kb.io,admissionReviewVersions={v1} // +kubebuilder:webhook:path=/validate-jenkins-io-jenkins-io-v1alpha2-jenkins,mutating=false,failurePolicy=fail,sideEffects=None,groups=jenkins.io.jenkins.io,resources=jenkins,verbs=create;update,versions=v1alpha2,name=vjenkins.kb.io,admissionReviewVersions={v1,v1beta1}
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type // ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (in *Jenkins) ValidateCreate() (admission.Warnings, error) { func (in *Jenkins) ValidateCreate() error {
if in.Spec.ValidateSecurityWarnings { if in.Spec.ValidateSecurityWarnings {
jenkinslog.Info("validate create", "name", in.Name) jenkinslog.Info("validate create", "name", in.Name)
err := Validate(*in) return Validate(*in)
return nil, err
} }
return nil, nil return nil
} }
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type // ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (in *Jenkins) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { func (in *Jenkins) ValidateUpdate(old runtime.Object) error {
if in.Spec.ValidateSecurityWarnings { if in.Spec.ValidateSecurityWarnings {
jenkinslog.Info("validate update", "name", in.Name) jenkinslog.Info("validate update", "name", in.Name)
return nil, Validate(*in) return Validate(*in)
} }
return nil, nil return nil
} }
func (in *Jenkins) ValidateDelete() (admission.Warnings, error) { func (in *Jenkins) ValidateDelete() error {
return nil, nil return nil
} }
type SecurityValidator struct { type SecurityValidator struct {
@ -264,17 +263,11 @@ func (in *SecurityValidator) fetchPluginData() error {
} }
func (in *SecurityValidator) download() error { func (in *SecurityValidator) download() error {
pluginDataFileCompressed, err := os.Create(PluginDataFileCompressedPath) out, err := os.Create(CompressedFilePath)
if err != nil { if err != nil {
return err return err
} }
defer out.Close()
// ensure pluginDataFileCompressed is closed
defer func() {
if err := pluginDataFileCompressed.Close(); err != nil {
jenkinslog.V(log.VDebug).Info("Failed to close SecurityValidator.download io", "error", err)
}
}()
req, err := http.NewRequest(http.MethodGet, Hosturl, nil) req, err := http.NewRequest(http.MethodGet, Hosturl, nil)
if err != nil { if err != nil {
@ -291,45 +284,30 @@ func (in *SecurityValidator) download() error {
return err return err
} }
defer httpResponseCloser(response) defer response.Body.Close()
_, err = io.Copy(pluginDataFileCompressed, response.Body)
_, err = io.Copy(out, response.Body)
return err return err
} }
func (in *SecurityValidator) extract() error { func (in *SecurityValidator) extract() error {
reader, err := os.Open(PluginDataFileCompressedPath) reader, err := os.Open(CompressedFilePath)
if err != nil { if err != nil {
return err return err
} }
defer func() { defer reader.Close()
if err := reader.Close(); err != nil {
log.Log.Error(err, "failed to close SecurityValidator.extract.reader ")
}
}()
archive, err := gzip.NewReader(reader) archive, err := gzip.NewReader(reader)
if err != nil { if err != nil {
return err return err
} }
defer func() { defer archive.Close()
if err := archive.Close(); err != nil {
log.Log.Error(err, "failed to close SecurityValidator.extract.archive ")
}
}()
writer, err := os.Create(PluginDataFile) writer, err := os.Create(PluginDataFile)
if err != nil { if err != nil {
return err return err
} }
defer writer.Close()
defer func() {
if err := writer.Close(); err != nil {
log.Log.Error(err, "failed to close SecurityValidator.extract.writer")
}
}()
_, err = io.Copy(writer, archive) _, err = io.Copy(writer, archive)
return err return err
@ -341,12 +319,8 @@ func (in *SecurityValidator) cache() error {
if err != nil { if err != nil {
return err return err
} }
defer func() { defer jsonFile.Close()
if err := jsonFile.Close(); err != nil { byteValue, err := ioutil.ReadAll(jsonFile)
log.Log.Error(err, "failed to close SecurityValidator.cache.jsonFile")
}
}()
byteValue, err := io.ReadAll(jsonFile)
if err != nil { if err != nil {
return err return err
} }
@ -372,9 +346,3 @@ func compareVersions(firstVersion string, lastVersion string, pluginVersion stri
} }
return true return true
} }
func httpResponseCloser(response *http.Response) {
if err := response.Body.Close(); err != nil {
log.Log.Error(err, "failed to close http response body")
}
}

View File

@ -79,7 +79,7 @@ func TestValidate(t *testing.T) {
t.Run("Validating when plugins data file is not fetched", func(t *testing.T) { t.Run("Validating when plugins data file is not fetched", func(t *testing.T) {
userplugins := []Plugin{{Name: "script-security", Version: "1.77"}, {Name: "git-client", Version: "3.9"}, {Name: "git", Version: "4.8.1"}, {Name: "plain-credentials", Version: "1.7"}} userplugins := []Plugin{{Name: "script-security", Version: "1.77"}, {Name: "git-client", Version: "3.9"}, {Name: "git", Version: "4.8.1"}, {Name: "plain-credentials", Version: "1.7"}}
jenkinscr := *createJenkinsCR(userplugins, true) jenkinscr := *createJenkinsCR(userplugins, true)
_, got := jenkinscr.ValidateCreate() got := jenkinscr.ValidateCreate()
assert.Equal(t, got, errors.New("plugins data has not been fetched")) assert.Equal(t, got, errors.New("plugins data has not been fetched"))
}) })
@ -95,7 +95,7 @@ func TestValidate(t *testing.T) {
{Name: "plain-credentials"}}} {Name: "plain-credentials"}}}
userplugins := []Plugin{{Name: "script-security", Version: "1.77"}, {Name: "git-client", Version: "3.9"}, {Name: "git", Version: "4.8.1"}, {Name: "plain-credentials", Version: "1.7"}} userplugins := []Plugin{{Name: "script-security", Version: "1.77"}, {Name: "git-client", Version: "3.9"}, {Name: "git", Version: "4.8.1"}, {Name: "plain-credentials", Version: "1.7"}}
jenkinscr := *createJenkinsCR(userplugins, true) jenkinscr := *createJenkinsCR(userplugins, true)
_, got := jenkinscr.ValidateCreate() got := jenkinscr.ValidateCreate()
assert.Nil(t, got) assert.Nil(t, got)
}) })
@ -113,7 +113,7 @@ func TestValidate(t *testing.T) {
}} }}
userplugins := []Plugin{{Name: "google-login", Version: "1.2"}, {Name: "mailer", Version: "1.1"}, {Name: "git", Version: "4.8.1"}, {Name: "command-launcher", Version: "1.6"}, {Name: "workflow-cps", Version: "2.59"}} userplugins := []Plugin{{Name: "google-login", Version: "1.2"}, {Name: "mailer", Version: "1.1"}, {Name: "git", Version: "4.8.1"}, {Name: "command-launcher", Version: "1.6"}, {Name: "workflow-cps", Version: "2.59"}}
jenkinscr := *createJenkinsCR(userplugins, true) jenkinscr := *createJenkinsCR(userplugins, true)
_, got := jenkinscr.ValidateCreate() got := jenkinscr.ValidateCreate()
assert.Equal(t, got, errors.New("security vulnerabilities detected in the following user-defined plugins: \nworkflow-cps:2.59\ngoogle-login:1.2\nmailer:1.1")) assert.Equal(t, got, errors.New("security vulnerabilities detected in the following user-defined plugins: \nworkflow-cps:2.59\ngoogle-login:1.2\nmailer:1.1"))
}) })
@ -136,19 +136,19 @@ func TestValidate(t *testing.T) {
userplugins = []Plugin{{Name: "handy-uri-templates-2-api", Version: "2.1.8-1.0"}, {Name: "resource-disposer", Version: "0.8"}, {Name: "jjwt-api", Version: "0.11.2-9.c8b45b8bb173"}, {Name: "blueocean-github-pipeline", Version: "1.2.0-beta-3"}, {Name: "ghprb", Version: "1.39"}} userplugins = []Plugin{{Name: "handy-uri-templates-2-api", Version: "2.1.8-1.0"}, {Name: "resource-disposer", Version: "0.8"}, {Name: "jjwt-api", Version: "0.11.2-9.c8b45b8bb173"}, {Name: "blueocean-github-pipeline", Version: "1.2.0-beta-3"}, {Name: "ghprb", Version: "1.39"}}
newjenkinscr := *createJenkinsCR(userplugins, true) newjenkinscr := *createJenkinsCR(userplugins, true)
_, got := newjenkinscr.ValidateUpdate(&oldjenkinscr) got := newjenkinscr.ValidateUpdate(&oldjenkinscr)
assert.Equal(t, got, errors.New("security vulnerabilities detected in the following user-defined plugins: \nhandy-uri-templates-2-api:2.1.8-1.0\nresource-disposer:0.8\nblueocean-github-pipeline:1.2.0-beta-3\nghprb:1.39")) assert.Equal(t, got, errors.New("security vulnerabilities detected in the following user-defined plugins: \nhandy-uri-templates-2-api:2.1.8-1.0\nresource-disposer:0.8\nblueocean-github-pipeline:1.2.0-beta-3\nghprb:1.39"))
}) })
t.Run("Validation is turned off", func(t *testing.T) { t.Run("Validation is turned off", func(t *testing.T) {
userplugins := []Plugin{{Name: "google-login", Version: "1.2"}, {Name: "mailer", Version: "1.1"}, {Name: "git", Version: "4.8.1"}, {Name: "command-launcher", Version: "1.6"}, {Name: "workflow-cps", Version: "2.59"}} userplugins := []Plugin{{Name: "google-login", Version: "1.2"}, {Name: "mailer", Version: "1.1"}, {Name: "git", Version: "4.8.1"}, {Name: "command-launcher", Version: "1.6"}, {Name: "workflow-cps", Version: "2.59"}}
jenkinscr := *createJenkinsCR(userplugins, false) jenkinscr := *createJenkinsCR(userplugins, false)
_, got := jenkinscr.ValidateCreate() got := jenkinscr.ValidateCreate()
assert.Nil(t, got) assert.Nil(t, got)
userplugins = []Plugin{{Name: "google-login", Version: "1.2"}, {Name: "mailer", Version: "1.1"}, {Name: "git", Version: "4.8.1"}, {Name: "command-launcher", Version: "1.6"}, {Name: "workflow-cps", Version: "2.59"}} userplugins = []Plugin{{Name: "google-login", Version: "1.2"}, {Name: "mailer", Version: "1.1"}, {Name: "git", Version: "4.8.1"}, {Name: "command-launcher", Version: "1.6"}, {Name: "workflow-cps", Version: "2.59"}}
newjenkinscr := *createJenkinsCR(userplugins, false) newjenkinscr := *createJenkinsCR(userplugins, false)
_, got = newjenkinscr.ValidateUpdate(&jenkinscr) got = newjenkinscr.ValidateUpdate(&jenkinscr)
assert.Nil(t, got) assert.Nil(t, got)
}) })
} }

View File

@ -1,4 +1,4 @@
//go:build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2021. Copyright 2021.
@ -22,7 +22,7 @@ package v1alpha2
import ( import (
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
"k8s.io/api/rbac/v1" rbacv1 "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
) )
@ -356,16 +356,6 @@ func (in *JenkinsMaster) DeepCopyInto(out *JenkinsMaster) {
*out = make([]Plugin, len(*in)) *out = make([]Plugin, len(*in))
copy(*out, *in) copy(*out, *in)
} }
if in.LatestPlugins != nil {
in, out := &in.LatestPlugins, &out.LatestPlugins
*out = new(bool)
**out = **in
}
if in.SkipPlugins != nil {
in, out := &in.SkipPlugins, &out.SkipPlugins
*out = new(bool)
**out = **in
}
if in.HostAliases != nil { if in.HostAliases != nil {
in, out := &in.HostAliases, &out.HostAliases in, out := &in.HostAliases, &out.HostAliases
*out = make([]corev1.HostAlias, len(*in)) *out = make([]corev1.HostAlias, len(*in))
@ -373,11 +363,6 @@ func (in *JenkinsMaster) DeepCopyInto(out *JenkinsMaster) {
(*in)[i].DeepCopyInto(&(*out)[i]) (*in)[i].DeepCopyInto(&(*out)[i])
} }
} }
if in.TerminationGracePeriodSeconds != nil {
in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds
*out = new(int64)
**out = **in
}
} }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JenkinsMaster. // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JenkinsMaster.
@ -414,7 +399,7 @@ func (in *JenkinsSpec) DeepCopyInto(out *JenkinsSpec) {
in.ConfigurationAsCode.DeepCopyInto(&out.ConfigurationAsCode) in.ConfigurationAsCode.DeepCopyInto(&out.ConfigurationAsCode)
if in.Roles != nil { if in.Roles != nil {
in, out := &in.Roles, &out.Roles in, out := &in.Roles, &out.Roles
*out = make([]v1.RoleRef, len(*in)) *out = make([]rbacv1.RoleRef, len(*in))
copy(*out, *in) copy(*out, *in)
} }
in.ServiceAccount.DeepCopyInto(&out.ServiceAccount) in.ServiceAccount.DeepCopyInto(&out.ServiceAccount)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 KiB

View File

@ -1,22 +1,11 @@
FROM debian:bookworm-slim FROM debian:buster-slim
LABEL maintainer="Jenkins Kubernetes Operator Community" \
org.opencontainers.image.authors="Jenkins Kubernetes Operator Community" \
org.opencontainers.image.title="backup-pvc" \
org.opencontainers.image.description="Jenkins Operator Backup img via pvc volume" \
org.opencontainers.image.url="quay.io/jenkins-kubernetes-operator/backup-pvc" \
org.opencontainers.image.source="https://github.com/jenkinsci/kubernetes-operator/tree/master/backup/pvc" \
org.opencontainers.image.base.name="debian:bookworm-slim"
ARG UID ARG UID
ARG GID ARG GID
ENV USER=user ENV USER=user
RUN apt update \ RUN addgroup --gid "$GID" "$USER" && \
&& apt install -y procps zstd \
&& rm -rf /var/lib/apt/lists/* \
&& addgroup --gid "$GID" "$USER" && \
adduser \ adduser \
--disabled-password \ --disabled-password \
--gecos "" \ --gecos "" \
@ -24,9 +13,9 @@ RUN apt update \
--uid "$UID" \ --uid "$UID" \
"$USER" "$USER"
COPY bin/*.sh /home/user/bin/
RUN chmod -R a+rx /home/user
WORKDIR /home/user/bin WORKDIR /home/user/bin
COPY bin .
RUN chmod +x *.sh
USER user USER user
CMD ./run.sh CMD ./run.sh

View File

@ -15,7 +15,7 @@ PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
GITCOMMIT := $(shell git rev-parse --short HEAD) GITCOMMIT := $(shell git rev-parse --short HEAD)
GITBRANCH := $(shell git rev-parse --abbrev-ref HEAD) GITBRANCH := $(shell git rev-parse --abbrev-ref HEAD)
GITUNTRACKEDCHANGES := $(shell git status --porcelain --untracked-files=no) GITUNTRACKEDCHANGES := $(shell git status --porcelain --untracked-files=no)
GITIGNOREDBUTTRACKEDCHANGES := $(shell git ls-files -i -o --exclude-standard) GITIGNOREDBUTTRACKEDCHANGES := $(shell git ls-files -i --exclude-standard)
ifneq ($(GITUNTRACKEDCHANGES),) ifneq ($(GITUNTRACKEDCHANGES),)
GITCOMMIT := $(GITCOMMIT)-dirty GITCOMMIT := $(GITCOMMIT)-dirty
endif endif
@ -58,7 +58,7 @@ spring-clean: ## Cleanup git ignored files (interactive)
git clean -Xdi git clean -Xdi
.PHONY: checkmake .PHONY: checkmake
HAS_CHECKMAKE := $(shell command -v checkmake) HAS_CHECKMAKE := $(shell which checkmake)
checkmake: ## Check this Makefile checkmake: ## Check this Makefile
@echo "+ $@" @echo "+ $@"
ifndef HAS_CHECKMAKE ifndef HAS_CHECKMAKE
@ -68,12 +68,12 @@ endif
define e2e define e2e
echo "\nRunning $(1) e2e test"; echo "\nRunning $(1) e2e test";
@e2e/$(1)/test.sh quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY)-$(NAME):$(GITCOMMIT) @e2e/$(1)/test.sh $(DOCKER_REGISTRY)-$(NAME):$(GITCOMMIT)
endef endef
.PHONY: docker-e2e .PHONY: docker-e2e
E2E_TESTS := $(shell ls e2e) E2E_TESTS := $(shell ls e2e)
docker-e2e: docker-build-e2e ## Make e2e tests for docker image docker-e2e: docker-build ## Make e2e tests for docker image
@echo "+ $@" @echo "+ $@"
$(foreach TEST_NAME,$(E2E_TESTS), $(call e2e,$(TEST_NAME))) $(foreach TEST_NAME,$(E2E_TESTS), $(call e2e,$(TEST_NAME)))
@ -81,15 +81,10 @@ docker-e2e: docker-build-e2e ## Make e2e tests for docker image
docker-login: ## Log in into the Docker repository docker-login: ## Log in into the Docker repository
@echo "+ $@" @echo "+ $@"
.PHONY: docker-build-e2e
docker-build-e2e: UID=1001
docker-build-e2e: GID=1001
docker-build-e2e: docker-build
.PHONY: docker-build .PHONY: docker-build
docker-build: check-env ## Build the container docker-build: check-env ## Build the container
@echo "+ $@" @echo "+ $@"
docker build . --build-arg UID=$(UID) --build-arg GID=$(GID) -t quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY)-$(NAME):$(GITCOMMIT) --file Dockerfile docker build . --build-arg UID=$(UID) --build-arg GID=$(GID) -t $(DOCKER_REGISTRY)-$(NAME):$(GITCOMMIT) --file Dockerfile
.PHONY: docker-images .PHONY: docker-images
docker-images: ## List all local containers docker-images: ## List all local containers
@ -99,31 +94,25 @@ docker-images: ## List all local containers
.PHONY: docker-push .PHONY: docker-push
docker-push: docker-build ## Push the container docker-push: docker-build ## Push the container
@echo "+ $@" @echo "+ $@"
docker tag quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY)-$(NAME):$(GITCOMMIT) quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY)-$(NAME):$(BUILD_TAG) docker tag $(DOCKER_REGISTRY)-$(NAME):$(GITCOMMIT) $(DOCKER_ORGANIZATION)/$(DOCKER_REGISTRY)-$(NAME):$(BUILD_TAG)
docker push quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY)-$(NAME):$(BUILD_TAG) docker push $(DOCKER_ORGANIZATION)/$(DOCKER_REGISTRY)-$(NAME):$(BUILD_TAG)
.PHONY: docker-release-version .PHONY: docker-release-version
docker-release-version: docker-build ## Release image with version tag (in addition to build tag) docker-release-version: docker-build ## Release image with version tag (in addition to build tag)
@echo "+ $@" @echo "+ $@"
docker tag quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY)-$(NAME):$(GITCOMMIT) quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY)-$(NAME):$(VERSION_TAG) docker tag $(DOCKER_REGISTRY)-$(NAME):$(GITCOMMIT) $(DOCKER_ORGANIZATION)/$(DOCKER_REGISTRY)-$(NAME):$(VERSION_TAG)
docker push quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY)-$(NAME):$(VERSION_TAG) docker push $(DOCKER_ORGANIZATION)/$(DOCKER_REGISTRY)-$(NAME):$(VERSION_TAG)
.PHONY: docker-release-latest .PHONY: docker-release-latest
docker-release-latest: docker-build ## Release image with latest tags (in addition to build tag) docker-release-latest: docker-build ## Release image with latest tags (in addition to build tag)
@echo "+ $@" @echo "+ $@"
docker tag quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY)-$(NAME):$(GITCOMMIT) quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY)-$(NAME):$(LATEST_TAG) docker tag $(DOCKER_REGISTRY)-$(NAME):$(GITCOMMIT) $(DOCKER_ORGANIZATION)/$(DOCKER_REGISTRY)-$(NAME):$(LATEST_TAG)
docker push quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY)-$(NAME):$(LATEST_TAG) docker push $(DOCKER_ORGANIZATION)/$(DOCKER_REGISTRY)-$(NAME):$(LATEST_TAG)
.PHONY: docker-release .PHONY: docker-release
docker-release: docker-release-version docker-release-latest ## Release image with version and latest tags (in addition to build tag) docker-release: docker-release-version docker-release-latest ## Release image with version and latest tags (in addition to build tag)
@echo "+ $@" @echo "+ $@"
.PHONY: backup-kind-load
backup-kind-load: docker-build ## Build and load backup img in kind with e2e-test tag
@echo "+ $@"
docker tag quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY)-$(NAME):$(GITCOMMIT) quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY)-$(NAME):e2e-test
kind load docker-image quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY)-$(NAME):e2e-test --name $(KIND_CLUSTER_NAME)
# if this session isn't interactive, then we don't want to allocate a # if this session isn't interactive, then we don't want to allocate a
# TTY, which would fail, but if it is interactive, we do want to attach # TTY, which would fail, but if it is interactive, we do want to attach
# so that the user can send e.g. ^C through. # so that the user can send e.g. ^C through.
@ -133,30 +122,20 @@ ifeq ($(INTERACTIVE), 1)
endif endif
.PHONY: docker-run .PHONY: docker-run
docker-run: docker-build docker-run: docker-build ## Run the container in docker, you can use EXTRA_ARGS
@echo "+ $@" @echo "+ $@"
docker run --rm -i $(DOCKER_FLAGS) \ docker run --rm -i $(DOCKER_FLAGS) \
quay.io/$(QUAY_ORGANIZATION)/$(QUAY_REGISTRY)-$(NAME):$(GITCOMMIT) $(ARGS) $(DOCKER_REGISTRY)-$(NAME):$(GITCOMMIT) $(ARGS)
.PHONY: sembump
HAS_SEMBUMP := $(shell which $(PROJECT_DIR)/bin/sembump)
sembump: # Download sembump locally if necessary
@echo "+ $@"
ifndef HAS_SEMBUMP
mkdir -p $(PROJECT_DIR)/bin
wget -O $(PROJECT_DIR)/bin/sembump https://github.com/justintout/sembump/releases/download/v0.1.0/sembump-linux-amd64
chmod +x $(PROJECT_DIR)/bin/sembump
endif
.PHONY: bump-version .PHONY: bump-version
BUMP := patch BUMP := patch
bump-version: sembump ## Bump the version in the version file. Set BUMP to [ patch | major | minor ] bump-version: ## Bump the version in the version file. Set BUMP to [ patch | major | minor ]
@echo "+ $@" @echo "+ $@"
$(eval NEW_VERSION=$(shell $(PROJECT_DIR)/bin/sembump --kind $(BUMP) $(VERSION))) $(eval NEW_VERSION=$(shell $(PROJECT_DIR)/../../bin/sembump --kind $(BUMP) $(VERSION)))
@echo "Bumping VERSION.txt from $(VERSION) to $(NEW_VERSION)" @echo "Bumping VERSION.txt from $(VERSION) to $(NEW_VERSION)"
echo $(NEW_VERSION) > VERSION.txt echo $(NEW_VERSION) > VERSION.txt
git add VERSION.txt git add VERSION.txt
git commit -avm "Bump backup PVC version to $(NEW_VERSION)" git commit -vaem "Bump backup PVC version to $(NEW_VERSION)"
.PHONY: tag .PHONY: tag
tag: ## Create a new git tag to prepare to build a release tag: ## Create a new git tag to prepare to build a release
@ -180,7 +159,7 @@ ifneq ($(GITUNTRACKEDCHANGES),)
endif endif
ifneq ($(GITIGNOREDBUTTRACKEDCHANGES),) ifneq ($(GITIGNOREDBUTTRACKEDCHANGES),)
@echo "Ignored but tracked files:" @echo "Ignored but tracked files:"
@git ls-files -i -c --exclude-standard @git ls-files -i --exclude-standard
@echo @echo
endif endif
@echo "Dependencies:" @echo "Dependencies:"

View File

@ -1 +1 @@
v0.4.3 v0.1.1

68
backup/pvc/bin/backup.sh Executable file → Normal file
View File

@ -1,67 +1,25 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail set -eo pipefail
source "$(dirname "$0")/utils.sh"
[[ ! $# -eq 1 ]] && _log "ERROR" "Usage: $0 BACKUP_NUMBER" && exit 1 [[ ! $# -eq 1 ]] && echo "Usage: $0 backup_number" && exit 1;
[[ -z "${BACKUP_DIR}" ]] && _log "ERROR" "Required 'BACKUP_DIR' env not set" && exit 1 [[ -z "${BACKUP_DIR}" ]] && echo "Required 'BACKUP_DIR' env not set" && exit 1;
[[ -z "${JENKINS_HOME}" ]] && _log "ERROR" "Required 'JENKINS_HOME' env not set" && exit 1 [[ -z "${JENKINS_HOME}" ]] && echo "Required 'JENKINS_HOME' env not set" && exit 1;
BACKUP_RETRY_COUNT=${BACKUP_RETRY_COUNT:-3} BACKUP_TMP_DIR=$(mktemp -d)
BACKUP_RETRY_INTERVAL=${BACKUP_RETRY_INTERVAL:-60}
BACKUP_NUMBER=$1
TRAP_FILE="/tmp/_backup_${BACKUP_NUMBER}_is_running"
# --> Check if another backup process is running (operator restart/crash) backup_number=$1
for ((i=0; i<BACKUP_RETRY_COUNT; i++)); do echo "Running backup"
[[ ! -f "${TRAP_FILE}" ]] && _log "INFO" "[backup] no other backup process are running" && break
_log "INFO" "[backup] backup is already running. Waiting for ${BACKUP_RETRY_INTERVAL} seconds..."
sleep "${BACKUP_RETRY_INTERVAL}"
done
[[ -f "${TRAP_FILE}" ]] && { _log "ERROR" "[backup] backup is still running after waiting ${BACKUP_RETRY_COUNT} time ${BACKUP_RETRY_INTERVAL}s. Exiting."; exit 1; }
# --< Done
_log "INFO" "[backup] running backup ${BACKUP_NUMBER}" # config.xml in a job directory is a config file that shouldnt be backed up
touch "${TRAP_FILE}" # config.xml in child directores is state that should. For example-
# create temp dir on the same filesystem with a BACKUP_DIR to be able use atomic mv enstead of copy
BACKUP_TMP_DIR=$(mktemp -d --tmpdir="${BACKUP_DIR}")
_clean(){
test -d "${BACKUP_TMP_DIR}" && rm -fr "${BACKUP_TMP_DIR}"
test -f "${TRAP_FILE}" && rm -f "${TRAP_FILE}"
}
_trap(){
_clean
_log "ERROR" "[backup] something wrong happened, check the logs"
}
trap '_trap' SIGQUIT SIGINT SIGTERM
# config.xml in a job directory is a config file that shouldn't be backed up
# config.xml in child directories is state that should. For example-
# branches/myorg/branches/myrepo/branches/master/config.xml should be retained while # branches/myorg/branches/myrepo/branches/master/config.xml should be retained while
# branches/myorg/config.xml should not # branches/myorg/config.xml should not
tar --zstd -C "${JENKINS_HOME}" -cf "${BACKUP_TMP_DIR}/${BACKUP_NUMBER}.tar.zstd" \ tar -C ${JENKINS_HOME} -czf "${BACKUP_TMP_DIR}/${backup_number}.tar.gz" --exclude jobs/*/workspace* --no-wildcards-match-slash --anchored --exclude jobs/*/config.xml -c jobs && \
--exclude jobs/*/workspace* \ mv ${BACKUP_TMP_DIR}/${backup_number}.tar.gz ${BACKUP_DIR}/${backup_number}.tar.gz
--no-wildcards-match-slash --anchored \
--ignore-failed-read \
--exclude jobs/*/config.xml -c jobs || ret=$?
if [[ "$ret" -eq 0 ]]; then rm -r ${BACKUP_TMP_DIR}
_log "INFO" "[backup] backup ${BACKUP_NUMBER} was completed without warnings"
elif [[ "$ret" -eq 1 ]]; then
_log "INFO" "[backup] backup ${BACKUP_NUMBER} was completed with some warnings"
else
_log "ERROR" "[backup] backup ${BACKUP_NUMBER} failed with error code: $ret"
_clean
exit "$ret"
fi
mv "${BACKUP_TMP_DIR}/${BACKUP_NUMBER}.tar.zstd" "${BACKUP_DIR}/${BACKUP_NUMBER}.tar.zstd" [[ ! -s ${BACKUP_DIR}/${backup_number}.tar.gz ]] && echo "backup file '${BACKUP_DIR}/${backup_number}.tar.gz' is empty" && exit 1;
_log "INFO" "[backup] cleaning ${BACKUP_TMP_DIR} and trap file ${TRAP_FILE}" echo Done
_clean
[[ ! -s ${BACKUP_DIR}/${BACKUP_NUMBER}.tar.zstd ]] && _log "ERROR" "[backup] file '${BACKUP_DIR}/${BACKUP_NUMBER}.tar.zstd' is empty" && exit 1
_log "INFO" "[backup] ${BACKUP_NUMBER} done"
exit 0 exit 0

31
backup/pvc/bin/get-latest.sh Executable file → Normal file
View File

@ -1,39 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail set -eo pipefail
source "$(dirname "$0")/utils.sh"
is_backup_not_exist() { [[ -z "${BACKUP_DIR}" ]] && echo "Required 'BACKUP_DIR' env not set" && exit 1
local backup_dir="$1"
# Save the current value of 'set -e'
local previous_e
previous_e=$(set +e; :; echo $?)
# Temporarily turn off 'set -e'
set +e
# Run ls command to check if any files matching the pattern exist
ls "${backup_dir}"/*.tar.* 1> /dev/null 2>&1
# Store the exit status of the ls command
local ls_exit_status=$?
# Restore the previous value of 'set -e'
[ "$previous_e" = "0" ] && set -e
# Return true if ls command succeeded (no files found), otherwise return false
[ $ls_exit_status -ne 0 ]
}
[[ -z "${BACKUP_DIR}" ]] && { _log "ERROR" "Required 'BACKUP_DIR' env not set"; exit 1; } latest=$(find ${BACKUP_DIR} -name '*.tar.gz' -exec basename {} \; | sort -g | tail -n 1)
# Check if we have any backup
if is_backup_not_exist "${BACKUP_DIR}"; then
_log "No backups exist in ${BACKUP_DIR}"
echo "-1"
exit 0
fi
# Search for all the tar.* inside the backup dir to support the migration between gzip vs zstd
latest=$(find "${BACKUP_DIR}"/*.tar.* -maxdepth 0 -exec basename {} \; | sort -g | tail -n 1)
if [[ "${latest}" == "" ]]; then if [[ "${latest}" == "" ]]; then
_log "Could not get the latest backup."
echo "-1" echo "-1"
else else
echo "${latest%%.*}" echo "${latest%%.*}"

56
backup/pvc/bin/restore.sh Executable file → Normal file
View File

@ -1,57 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail set -eo pipefail
source "$(dirname "$0")/utils.sh"
[[ ! $# -eq 1 ]] && _log "ERROR" "Usage: $0 <backup number>" && exit 1 [[ ! $# -eq 1 ]] && echo "Usage: $0 backup_number" && exit 1
[[ -z "${BACKUP_DIR}" ]] && _log "ERROR" "Required 'BACKUP_DIR' env not set" && exit 1 [[ -z "${BACKUP_DIR}" ]] && echo "Required 'BACKUP_DIR' env not set" && exit 1;
[[ -z "${JENKINS_HOME}" ]] && _log "ERROR" "Required 'JENKINS_HOME' env not set" && exit 1 [[ -z "${JENKINS_HOME}" ]] && echo "Required 'JENKINS_HOME' env not set" && exit 1;
BACKUP_NUMBER=$1
RESTORE_RETRY_COUNT=${RESTORE_RETRY_COUNT:-10}
RESTORE_RETRY_INTERVAL=${RESTORE_RETRY_INTERVAL:-10}
# --> Check if another restore process is running (operator restart/crash) backup_number=$1
TRAP_FILE="/tmp/_restore_${BACKUP_NUMBER}_is_running" echo "Running restore backup"
trap "rm -f ${TRAP_FILE}" SIGINT SIGTERM
for ((i=0; i<RESTORE_RETRY_COUNT; i++)); do tar -C ${JENKINS_HOME} -zxf "${BACKUP_DIR}/${backup_number}.tar.gz"
[[ ! -f "${TRAP_FILE}" ]] && _log "INFO" "[restore] no other process are running, restoring" && break
_log "INFO" "[restore] is already running. Waiting for ${RESTORE_RETRY_INTERVAL} seconds..."
sleep "${RESTORE_RETRY_INTERVAL}"
done
[[ -f "${TRAP_FILE}" ]] && { _log "ERROR" "[restore] is still running after waiting ${RESTORE_RETRY_COUNT} time ${RESTORE_RETRY_INTERVAL}s. Exiting."; exit 1; }
# --< Done
_log "INFO" "[restore] restore backup with backup number #${BACKUP_NUMBER}" echo Done
touch "${TRAP_FILE}"
BACKUP_FILE="${BACKUP_DIR}/${BACKUP_NUMBER}"
if [[ -f "$BACKUP_FILE.tar.gz" ]]; then
_log "INFO" "[restore] old format tar.gz found, restoring it"
OPTS=""
EXT="tar.gz"
elif [[ -f "$BACKUP_FILE.tar.zstd" ]]; then
_log "INFO" "[restore] Backup file found, proceeding"
OPTS="--zstd"
EXT="tar.zstd"
else
_log "ERROR" "[restore] backup file not found: $BACKUP_FILE"
exit 1
fi
tar $OPTS -C "${JENKINS_HOME}" -xf "${BACKUP_DIR}/${BACKUP_NUMBER}.${EXT}" || ret=$?
if [[ "$ret" -eq 0 ]]; then
_log "INFO" "[restore] restore ${BACKUP_NUMBER} was completed without warnings"
elif [[ "$ret" -eq 1 ]]; then
_log "INFO" "[restore] restore ${BACKUP_NUMBER} was completed with some warnings"
else
_log "ERROR" "[restore] restore ${BACKUP_NUMBER} failed with error code: $ret"
exit "$ret"
fi
_log "INFO" "[restore] deleting lock file ${TRAP_FILE}"
test -f "${TRAP_FILE}" && rm -f "${TRAP_FILE}"
_log "INFO" "[restore] restoring ${BACKUP_NUMBER} Done"
exit 0 exit 0

69
backup/pvc/bin/run.sh Executable file → Normal file
View File

@ -1,72 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail set -eo pipefail
source "$(dirname "$0")/utils.sh"
# Use 60 as default in case BACKUP_CLEANUP_INTERVAL did not set [[ -z "${BACKUP_DIR}" ]] && echo "Required 'BACKUP_DIR' env not set" && exit 1;
BACKUP_CLEANUP_INTERVAL=${BACKUP_CLEANUP_INTERVAL:=60} [[ -z "${JENKINS_HOME}" ]] && echo "Required 'JENKINS_HOME' env not set" && exit 1;
# Ensure required environment variables are set
check_env_var() {
if [[ -z "${!1}" ]]; then
_log "ERROR" "Required '$1' environment variable is not set"
exit 1
fi
}
is_backup_not_exist() {
local backup_dir="$1"
# Save the current value of 'set -e'
local previous_e
previous_e=$(set +e; :; echo $?)
# Temporarily turn off 'set -e'
set +e
# Run ls command to check if any files matching the pattern exist
ls "${backup_dir}"/*.tar.* 1> /dev/null 2>&1
# Store the exit status of the ls command
local ls_exit_status=$?
# Restore the previous value of 'set -e'
[ "$previous_e" = "0" ] && set -e
# Return true if ls command succeeded (no files found), otherwise return false
[ $ls_exit_status -ne 0 ]
}
# Function to find exceeding backups
find_exceeding_backups() {
local backup_dir="$1"
local backup_count="$2"
# Check if we have any backup
if is_backup_not_exist "${backup_dir}"; then
_log "ERROR" "[run] backups not found in ${backup_dir}"
return
fi
find "${backup_dir}"/*.tar.zstd -maxdepth 0 -exec basename {} \; | sort -gr | tail -n +$((backup_count +1))
}
check_env_var "BACKUP_DIR"
check_env_var "JENKINS_HOME"
if [[ -z "${BACKUP_COUNT}" ]]; then
_log "WARNING" "[run] no BACKUP_COUNT set, it means you MUST delete old backups manually or by custom script"
else
_log "INFO" "[run] retaining only the ${BACKUP_COUNT} most recent backups, cleanup occurs every ${BACKUP_CLEANUP_INTERVAL} seconds"
fi
while true; while true;
do do
sleep "$BACKUP_CLEANUP_INTERVAL" sleep 10
if [[ -n "${BACKUP_COUNT}" ]]; then if [[ ! -z "${BACKUP_COUNT}" ]]; then
exceeding_backups=$(find_exceeding_backups "${BACKUP_DIR}" "${BACKUP_COUNT}") echo "Trimming to only ${BACKUP_COUNT} recent backups in preparation for new backup"
if [[ -n "$exceeding_backups" ]]; then find ${BACKUP_DIR} -name '*.tar.gz' -exec basename {} \; | sort -gr | tail -n +$((BACKUP_COUNT +1)) | xargs -I '{}' rm ${BACKUP_DIR}/'{}'
_log "INFO" "[run] removing backups: $(echo "$exceeding_backups" | tr '\n' ', ' | sed 's/,$//')"
echo "$exceeding_backups" | while read -r file; do
rm "${BACKUP_DIR}/${file}"
done
fi
fi fi
done done

View File

@ -1,14 +0,0 @@
#!/usr/bin/env bash
# Common utils
_log() {
local level="$1"
local message="$2"
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
if [[ "$level" =~ ^(ERROR|ERR|error|err)$ ]]; then
echo "${timestamp} - ${level} - ${message}" > /proc/1/fd/2
else
echo "${timestamp} - ${level} - ${message}" > /proc/1/fd/1
echo "${timestamp} - ${level} - ${message}" >&2
fi
}

View File

@ -1,7 +1,6 @@
# Setup variables for the Makefile # Setup variables for the Makefile
NAME=pvc NAME=pvc
QUAY_ORGANIZATION=jenkins-kubernetes-operator DOCKER_ORGANIZATION=virtuslab
QUAY_REGISTRY=backup DOCKER_REGISTRY=jenkins-operator-backup
UID=1000 UID=1000
GID=1000 GID=1000
KIND_CLUSTER_NAME=jenkins

View File

@ -30,7 +30,7 @@ trap "docker rm -vf $cid > /dev/null;rm -rf ${BACKUP_DIR};rm -rf ${RESTORE_FOLDE
backup_number=1 backup_number=1
docker exec ${cid} /home/user/bin/backup.sh ${backup_number} docker exec ${cid} /home/user/bin/backup.sh ${backup_number}
backup_file="${BACKUP_DIR}/${backup_number}.tar.zstd" backup_file="${BACKUP_DIR}/${backup_number}.tar.gz"
[[ ! -f ${backup_file} ]] && echo "Backup file ${backup_file} not found" && exit 1; [[ ! -f ${backup_file} ]] && echo "Backup file ${backup_file} not found" && exit 1;
docker exec ${cid} /bin/bash -c "JENKINS_HOME=${RESTORE_FOLDER};/home/user/bin/restore.sh ${backup_number}" docker exec ${cid} /bin/bash -c "JENKINS_HOME=${RESTORE_FOLDER};/home/user/bin/restore.sh ${backup_number}"

View File

@ -19,20 +19,17 @@ mkdir -p ${BACKUP_DIR}
mkdir -p ${JENKINS_HOME} mkdir -p ${JENKINS_HOME}
mkdir -p ${BACKUP_DIR}/lost+found mkdir -p ${BACKUP_DIR}/lost+found
touch ${BACKUP_DIR}/1.tar.zstd touch ${BACKUP_DIR}/1.tar.gz
touch ${BACKUP_DIR}/2.tar.zstd touch ${BACKUP_DIR}/2.tar.gz
touch ${BACKUP_DIR}/3.tar.zstd touch ${BACKUP_DIR}/3.tar.gz
touch ${BACKUP_DIR}/4.tar.zstd touch ${BACKUP_DIR}/4.tar.gz
touch ${BACKUP_DIR}/5.tar.zstd touch ${BACKUP_DIR}/5.tar.gz
touch ${BACKUP_DIR}/6.tar.zstd touch ${BACKUP_DIR}/6.tar.gz
touch ${BACKUP_DIR}/7.tar.zstd touch ${BACKUP_DIR}/7.tar.gz
touch ${BACKUP_DIR}/8.tar.zstd touch ${BACKUP_DIR}/8.tar.gz
touch ${BACKUP_DIR}/9.tar.zstd touch ${BACKUP_DIR}/9.tar.gz
touch ${BACKUP_DIR}/10.tar.zstd touch ${BACKUP_DIR}/10.tar.gz
touch ${BACKUP_DIR}/11.tar.zstd touch ${BACKUP_DIR}/11.tar.gz
# Emulate backup creation
BACKUP_TMP_DIR=$(mktemp -d --tmpdir="${BACKUP_DIR}")
touch ${BACKUP_TMP_DIR}/12.tar.zstd
# Create an instance of the container under testing # Create an instance of the container under testing
cid="$(docker run -e JENKINS_HOME=${JENKINS_HOME} -v ${JENKINS_HOME}:${JENKINS_HOME}:ro -e BACKUP_DIR=${BACKUP_DIR} -v ${BACKUP_DIR}:${BACKUP_DIR}:rw -d ${docker_image})" cid="$(docker run -e JENKINS_HOME=${JENKINS_HOME} -v ${JENKINS_HOME}:${JENKINS_HOME}:ro -e BACKUP_DIR=${BACKUP_DIR} -v ${BACKUP_DIR}:${BACKUP_DIR}:rw -d ${docker_image})"
@ -41,20 +38,10 @@ echo "Docker container ID '${cid}'"
# Remove test directory and container afterwards # Remove test directory and container afterwards
trap "docker rm -vf $cid > /dev/null;rm -rf ${BACKUP_DIR};rm -rf ${JENKINS_HOME}" EXIT trap "docker rm -vf $cid > /dev/null;rm -rf ${BACKUP_DIR};rm -rf ${JENKINS_HOME}" EXIT
echo "Try to get latest against 11 backups and one in progress"
latest=$(docker exec ${cid} /bin/bash -c "JENKINS_HOME=${RESTORE_FOLDER};/home/user/bin/get-latest.sh") latest=$(docker exec ${cid} /bin/bash -c "JENKINS_HOME=${RESTORE_FOLDER};/home/user/bin/get-latest.sh")
rm ${BACKUP_DIR}/*.tar.gz
rm ${BACKUP_DIR}/*.tar.zstd
echo "Try to get latest against one in progress"
empty_latest=$(docker exec ${cid} /bin/bash -c "JENKINS_HOME=${RESTORE_FOLDER};/home/user/bin/get-latest.sh") empty_latest=$(docker exec ${cid} /bin/bash -c "JENKINS_HOME=${RESTORE_FOLDER};/home/user/bin/get-latest.sh")
rmdir ${BACKUP_DIR}/lost+found
rm ${BACKUP_TMP_DIR}/*.tar.zstd
rmdir ${BACKUP_TMP_DIR}
echo "Try to get latest against empty dir"
empty_dir_latest=$(docker exec ${cid} /bin/bash -c "JENKINS_HOME=${RESTORE_FOLDER};/home/user/bin/get-latest.sh")
if [[ "${DEBUG}" ]]; then if [[ "${DEBUG}" ]]; then
docker logs ${cid} docker logs ${cid}
ls -la ${BACKUP_DIR} ls -la ${BACKUP_DIR}
@ -68,9 +55,5 @@ if [[ ! "${empty_latest}" == "-1" ]]; then
echo "Latest backup number should be '-1' but is '${empty_latest}'" echo "Latest backup number should be '-1' but is '${empty_latest}'"
exit 1 exit 1
fi fi
if [[ ! "${empty_dir_latest}" == "-1" ]]; then
echo "Latest backup number should be '-1' but is '${empty_dir_latest}'"
exit 1
fi
echo PASS echo PASS

View File

@ -1,8 +1,6 @@
#!/bin/bash #!/bin/bash
set -eo pipefail set -eo pipefail
echo "Running limit_backup_count e2e test..."
[[ "${DEBUG}" ]] && set -x [[ "${DEBUG}" ]] && set -x
# set current working directory to the directory of the script # set current working directory to the directory of the script
@ -21,31 +19,28 @@ mkdir -p ${BACKUP_DIR}
mkdir -p ${JENKINS_HOME} mkdir -p ${JENKINS_HOME}
mkdir -p ${BACKUP_DIR}/lost+found mkdir -p ${BACKUP_DIR}/lost+found
touch ${BACKUP_DIR}/1.tar.zstd touch ${BACKUP_DIR}/1.tar.gz
touch ${BACKUP_DIR}/2.tar.zstd touch ${BACKUP_DIR}/2.tar.gz
touch ${BACKUP_DIR}/3.tar.zstd touch ${BACKUP_DIR}/3.tar.gz
touch ${BACKUP_DIR}/4.tar.zstd touch ${BACKUP_DIR}/4.tar.gz
touch ${BACKUP_DIR}/5.tar.zstd touch ${BACKUP_DIR}/5.tar.gz
touch ${BACKUP_DIR}/6.tar.zstd touch ${BACKUP_DIR}/6.tar.gz
touch ${BACKUP_DIR}/7.tar.zstd touch ${BACKUP_DIR}/7.tar.gz
touch ${BACKUP_DIR}/8.tar.zstd touch ${BACKUP_DIR}/8.tar.gz
touch ${BACKUP_DIR}/9.tar.zstd touch ${BACKUP_DIR}/9.tar.gz
touch ${BACKUP_DIR}/10.tar.zstd touch ${BACKUP_DIR}/10.tar.gz
touch ${BACKUP_DIR}/11.tar.zstd touch ${BACKUP_DIR}/11.tar.gz
# Emulate backup creation
BACKUP_TMP_DIR=$(mktemp -d --tmpdir="${BACKUP_DIR}")
touch ${BACKUP_TMP_DIR}/12.tar.zstd
# Create an instance of the container under testing # Create an instance of the container under testing
cid="$(docker run -e BACKUP_CLEANUP_INTERVAL=1 -e BACKUP_COUNT=2 -e JENKINS_HOME=${JENKINS_HOME} -v ${JENKINS_HOME}:${JENKINS_HOME}:ro -e BACKUP_DIR=${BACKUP_DIR} -v ${BACKUP_DIR}:${BACKUP_DIR}:rw -d ${docker_image})" cid="$(docker run -e BACKUP_COUNT=2 -e JENKINS_HOME=${JENKINS_HOME} -v ${JENKINS_HOME}:${JENKINS_HOME}:ro -e BACKUP_DIR=${BACKUP_DIR} -v ${BACKUP_DIR}:${BACKUP_DIR}:rw -d ${docker_image})"
echo "Docker container ID '${cid}'" echo "Docker container ID '${cid}'"
# Remove test directory and container afterwards # Remove test directory and container afterwards
trap "docker rm -vf $cid > /dev/null;rm -rf ${BACKUP_DIR};rm -rf ${JENKINS_HOME}" EXIT trap "docker rm -vf $cid > /dev/null;rm -rf ${BACKUP_DIR};rm -rf ${JENKINS_HOME}" EXIT
sleep 2 sleep 11
mv ${BACKUP_TMP_DIR}/12.tar.zstd ${BACKUP_DIR}/ touch ${BACKUP_DIR}/12.tar.gz
sleep 2 sleep 11
if [[ "${DEBUG}" ]]; then if [[ "${DEBUG}" ]]; then
docker logs ${cid} docker logs ${cid}
@ -53,7 +48,7 @@ if [[ "${DEBUG}" ]]; then
fi fi
# only two latest backup should exists # only two latest backup should exists
[[ $(ls -1 ${BACKUP_DIR} | grep 'tar.zstd' | wc -l) -eq 2 ]] || exit 1 [[ $(ls -1 ${BACKUP_DIR} | grep 'tar.gz' | wc -l) -eq 2 ]] || exit 1
[[ -f ${BACKUP_DIR}/11.tar.zstd ]] || exit 2 [[ -f ${BACKUP_DIR}/11.tar.gz ]] || exit 2
[[ -f ${BACKUP_DIR}/12.tar.zstd ]] || exit 3 [[ -f ${BACKUP_DIR}/12.tar.gz ]] || exit 3
echo PASS echo PASS

View File

@ -1,8 +1,6 @@
#!/bin/bash #!/bin/bash
set -eo pipefail set -eo pipefail
echo "Running limit_backup_count_no_backups e2e test..."
[[ "${DEBUG}" ]] && set -x [[ "${DEBUG}" ]] && set -x
# set current working directory to the directory of the script # set current working directory to the directory of the script
@ -21,7 +19,7 @@ mkdir -p ${BACKUP_DIR}
mkdir -p ${JENKINS_HOME} mkdir -p ${JENKINS_HOME}
# Create an instance of the container under testing # Create an instance of the container under testing
cid="$(docker run -e BACKUP_CLEANUP_INTERVAL=1 -e BACKUP_COUNT=2 -e JENKINS_HOME=${JENKINS_HOME} -v ${JENKINS_HOME}:${JENKINS_HOME}:ro -e BACKUP_DIR=${BACKUP_DIR} -v ${BACKUP_DIR}:${BACKUP_DIR}:rw -d ${docker_image})" cid="$(docker run -e BACKUP_COUNT=2 -e JENKINS_HOME=${JENKINS_HOME} -v ${JENKINS_HOME}:${JENKINS_HOME}:ro -e BACKUP_DIR=${BACKUP_DIR} -v ${BACKUP_DIR}:${BACKUP_DIR}:rw -d ${docker_image})"
echo "Docker container ID '${cid}'" echo "Docker container ID '${cid}'"
# Remove test directory and container afterwards # Remove test directory and container afterwards
@ -29,16 +27,8 @@ trap "docker rm -vf $cid > /dev/null;rm -rf ${BACKUP_DIR};rm -rf ${JENKINS_HOME}
# container should be running # container should be running
echo 'Checking if container is running' echo 'Checking if container is running'
sleep 3 sleep 11
set +e
docker exec ${cid} echo docker exec ${cid} echo
exit_code=$?
set -e
if [ $exit_code -ne 0 ]; then
echo "container terminated with following logs:"
docker logs "${cid}"
exit 1
fi
echo 'Container is running' echo 'Container is running'
echo PASS echo PASS

View File

@ -1,8 +1,6 @@
#!/bin/bash #!/bin/bash
set -eo pipefail set -eo pipefail
echo "Running tmp_dir_clean_after_backup_creation e2e test..."
[[ "${DEBUG}" ]] && set -x [[ "${DEBUG}" ]] && set -x
# set current working directory to the directory of the script # set current working directory to the directory of the script
@ -20,7 +18,7 @@ BACKUP_DIR="$(pwd)/backup"
mkdir -p ${BACKUP_DIR} mkdir -p ${BACKUP_DIR}
# Create an instance of the container under testing # Create an instance of the container under testing
cid="$(docker run -e BACKUP_CLEANUP_INTERVAL=1 -e JENKINS_HOME=${JENKINS_HOME} -v ${JENKINS_HOME}:${JENKINS_HOME}:ro -e BACKUP_DIR=${BACKUP_DIR} -v ${BACKUP_DIR}:${BACKUP_DIR}:rw -d ${docker_image})" cid="$(docker run -e JENKINS_HOME=${JENKINS_HOME} -v ${JENKINS_HOME}:${JENKINS_HOME}:ro -e BACKUP_DIR=${BACKUP_DIR} -v ${BACKUP_DIR}:${BACKUP_DIR}:rw -d ${docker_image})"
echo "Docker container ID '${cid}'" echo "Docker container ID '${cid}'"
# Remove test directory and container afterwards # Remove test directory and container afterwards
@ -30,10 +28,8 @@ backup_number=1
docker exec ${cid} /home/user/bin/backup.sh ${backup_number} docker exec ${cid} /home/user/bin/backup.sh ${backup_number}
[ "$(docker exec ${cid} ls /tmp | grep 'tmp')" ] && echo "tmp directory not empty" && exit 1; [ "$(docker exec ${cid} ls /tmp | grep 'tmp')" ] && echo "tmp directory not empty" && exit 1;
# We should also check backup directory, since after #1000 we create temp directory at backup filesystem
[ "$(docker exec ${cid} ls ${BACKUP_DIR} | grep 'tmp')" ] && echo "backup dir consists temp directory" && exit 1;
backup_file="${BACKUP_DIR}/${backup_number}.tar.zstd" backup_file="${BACKUP_DIR}/${backup_number}.tar.gz"
[[ ! -f ${backup_file} ]] && echo "Backup file ${backup_file} not found" && exit 1; [[ ! -f ${backup_file} ]] && echo "Backup file ${backup_file} not found" && exit 1;
echo "tmp directory empty, backup in backup directory present" echo "tmp directory empty, backup in backup directory present"

View File

@ -1,134 +1,6 @@
apiVersion: v1 apiVersion: v1
entries: entries:
jenkins-operator: jenkins-operator:
- apiVersion: v2
appVersion: 0.9.0-beta1
created: "2025-04-06T21:25:18.36969916Z"
dependencies:
- condition: cert-manager.enabled
name: cert-manager
repository: https://charts.jetstack.io
version: 1.14.2
- condition: cert-manager.enabled
name: cert-manager-crds
repository: ""
version: 1.14.2
description: Kubernetes native operator which fully manages Jenkins on Kubernetes
digest: 78b0756202efbf6a05d5016a4358053a07c89c0f4a3f3f1fb447eaf7323df078
icon: https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/assets/jenkins-operator-icon.png
name: jenkins-operator
urls:
- https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/jenkins-operator/jenkins-operator-0.9.0-beta1.tgz
version: 0.9.0-beta1
- apiVersion: v2
appVersion: 0.8.1
created: "2024-07-05T15:26:01.708923805Z"
dependencies:
- condition: cert-manager.enabled
name: cert-manager
repository: https://charts.jetstack.io
version: 1.14.2
- condition: cert-manager.enabled
name: cert-manager-crds
repository: ""
version: 1.14.2
description: Kubernetes native operator which fully manages Jenkins on Kubernetes
digest: 82c061ff42bbf2dbcf942939ffbd5b63508c9d8490fc06672a474af1cad14a5d
icon: https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/assets/jenkins-operator-icon.png
name: jenkins-operator
urls:
- https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/jenkins-operator/jenkins-operator-0.8.1.tgz
version: 0.8.1
- apiVersion: v2
appVersion: 0.8.0
created: "2023-09-13T06:54:41.369295961Z"
dependencies:
- condition: webhook.enabled
name: cert-manager
repository: https://charts.jetstack.io
version: 1.5.1
description: Kubernetes native operator which fully manages Jenkins on Kubernetes
digest: da8ae04166cb1b64a9dd3d741c6a50d63846ebe8e2e92f09313ad3c6a0dd9ca4
icon: https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/assets/jenkins-operator-icon.png
name: jenkins-operator
urls:
- https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/jenkins-operator/jenkins-operator-0.8.0.tgz
version: 0.8.0
- apiVersion: v2
appVersion: 0.8.0-beta.2
created: "2023-06-30T21:22:53.308590035Z"
dependencies:
- condition: webhook.enabled
name: cert-manager
repository: https://charts.jetstack.io
version: 1.5.1
description: Kubernetes native operator which fully manages Jenkins on Kubernetes
digest: b2502f91dffa1136190a8a98d73ac997c70387e100d79200b7403039ca98411e
icon: https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/assets/jenkins-operator-icon.png
name: jenkins-operator
urls:
- https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/jenkins-operator/jenkins-operator-0.8.0-beta.2.tgz
version: 0.8.0-beta.2
- apiVersion: v2
appVersion: v0.8.0-beta
created: "2023-04-17T22:11:04.706959723Z"
dependencies:
- condition: webhook.enabled
name: cert-manager
repository: https://charts.jetstack.io
version: 1.5.1
description: Kubernetes native operator which fully manages Jenkins on Kubernetes
digest: 4855dc0c673a1b3b4cd7ee502029c3d995f243a9a7051ad03d29def7c48a7c11
icon: https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/assets/jenkins-operator-icon.png
name: jenkins-operator
urls:
- https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/jenkins-operator/jenkins-operator-v0.8.0-beta.tgz
version: v0.8.0-beta
- apiVersion: v2
appVersion: 0.7.1
created: "2022-06-22T15:47:45.014723169Z"
dependencies:
- condition: webhook.enabled
name: cert-manager
repository: https://charts.jetstack.io
version: 1.5.1
description: Kubernetes native operator which fully manages Jenkins on Kubernetes
digest: e4f72051328b0feae90f5445c58a8776941ffb900a5849de14780ec0e2ce6081
icon: https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/assets/jenkins-operator-icon.png
name: jenkins-operator
urls:
- https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/jenkins-operator/jenkins-operator-0.6.2.tgz
version: 0.6.2
- apiVersion: v2
appVersion: 0.7.1
created: "2022-06-22T11:26:06.518430865Z"
dependencies:
- condition: webhook.enabled
name: cert-manager
repository: https://charts.jetstack.io
version: 1.5.1
description: Kubernetes native operator which fully manages Jenkins on Kubernetes
digest: a52262394e66a1274cc9508f5013c4da13182317f12bf949a7c28e8916be3fb8
icon: https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/assets/jenkins-operator-icon.png
name: jenkins-operator
urls:
- https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/jenkins-operator/jenkins-operator-0.6.1.tgz
version: 0.6.1
- apiVersion: v2
appVersion: 0.7.0
created: "2021-12-08T14:21:18.243261+01:00"
dependencies:
- condition: webhook.enabled
name: cert-manager
repository: https://charts.jetstack.io
version: 1.5.1
description: Kubernetes native operator which fully manages Jenkins on Kubernetes
digest: 6b36f47d6647231bd21581bea6b23c3660acb11073ebde2cb47f9a700101c462
icon: https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/assets/jenkins-operator-icon.png
name: jenkins-operator
urls:
- https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/jenkins-operator/jenkins-operator-0.6.0.tgz
version: 0.6.0
- apiVersion: v2 - apiVersion: v2
appVersion: 0.6.0 appVersion: 0.6.0
created: "2021-08-11T15:40:10.659538+02:00" created: "2021-08-11T15:40:10.659538+02:00"
@ -416,4 +288,4 @@ entries:
urls: urls:
- https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/jenkins-operator/jenkins-operator-0.0.1.tgz - https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/jenkins-operator/jenkins-operator-0.0.1.tgz
version: 0.0.1 version: 0.0.1
generated: "2025-04-06T21:25:18.363088324Z" generated: "2021-08-11T15:40:10.654972+02:00"

View File

@ -20,7 +20,3 @@
.idea/ .idea/
*.tmproj *.tmproj
.vscode/ .vscode/
# Ignore packaged charts
jenkins-operator-*.tgz

View File

@ -1,6 +1,6 @@
dependencies: dependencies:
- name: cert-manager - name: cert-manager
repository: https://charts.jetstack.io repository: https://charts.jetstack.io
version: v1.14.2 version: v1.5.1
digest: sha256:5f6f7c115d7b96e8c8e85515e087a9379473fd3d5262198a9e25c1a84d4ff9bd digest: sha256:3220f5584bd04a8c8d4b2a076d49cc046211a463bb9a12ebbbae752be9b70bb1
generated: "2024-02-15T23:08:28.352007672+01:00" generated: "2021-08-18T01:07:49.505353718+05:30"

View File

@ -1,14 +1,11 @@
apiVersion: v2 apiVersion: v2
appVersion: "0.9.0-beta1" appVersion: "0.6.0"
description: Kubernetes native operator which fully manages Jenkins on Kubernetes description: Kubernetes native operator which fully manages Jenkins on Kubernetes
name: jenkins-operator name: jenkins-operator
version: 0.9.0-beta1 version: 0.5.3
icon: https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/assets/jenkins-operator-icon.png icon: https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/assets/jenkins-operator-icon.png
dependencies: dependencies:
- name: cert-manager - name: cert-manager
version: "1.14.2" version: "1.5.1"
condition: cert-manager.enabled condition: webhook.enabled
repository: https://charts.jetstack.io repository: https://charts.jetstack.io
- name: cert-manager-crds
version: "1.14.2"
condition: cert-manager.enabled

View File

@ -1,117 +0,0 @@
# jenkins-operator
![Version: 0.8.1](https://img.shields.io/badge/Version-0.8.1-informational?style=flat-square) ![AppVersion: 0.8.1](https://img.shields.io/badge/AppVersion-0.8.1-informational?style=flat-square)
Kubernetes native operator which fully manages Jenkins on Kubernetes
## Requirements
| Repository | Name | Version |
|------------|------|---------|
| | cert-manager-crds | 1.14.2 |
| https://charts.jetstack.io | cert-manager | 1.14.2 |
## Values
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| cert-manager.enabled | bool | `false` | |
| cert-manager.startupapicheck.enabled | bool | `false` | |
| jenkins.annotations | object | `{}` | |
| jenkins.apiVersion | string | `"jenkins.io/v1alpha2"` | |
| jenkins.authorizationStrategy | string | `"createUser"` | |
| jenkins.backup.backupCommand[0] | string | `"/home/user/bin/backup.sh"` | |
| jenkins.backup.containerName | string | `"backup"` | |
| jenkins.backup.enabled | bool | `true` | |
| jenkins.backup.env[0].name | string | `"BACKUP_DIR"` | |
| jenkins.backup.env[0].value | string | `"/backup"` | |
| jenkins.backup.env[1].name | string | `"JENKINS_HOME"` | |
| jenkins.backup.env[1].value | string | `"/jenkins-home"` | |
| jenkins.backup.env[2].name | string | `"BACKUP_COUNT"` | |
| jenkins.backup.env[2].value | string | `"3"` | |
| jenkins.backup.getLatestAction[0] | string | `"/home/user/bin/get-latest.sh"` | |
| jenkins.backup.image | string | `"quay.io/jenkins-kubernetes-operator/backup-pvc:v0.4.3"` | |
| jenkins.backup.interval | int | `30` | |
| jenkins.backup.makeBackupBeforePodDeletion | bool | `true` | |
| jenkins.backup.pvc.className | string | `""` | |
| jenkins.backup.pvc.enabled | bool | `true` | |
| jenkins.backup.pvc.size | string | `"5Gi"` | |
| jenkins.backup.resources.limits.cpu | string | `"1000m"` | |
| jenkins.backup.resources.limits.memory | string | `"2Gi"` | |
| jenkins.backup.resources.requests.cpu | string | `"100m"` | |
| jenkins.backup.resources.requests.memory | string | `"500Mi"` | |
| jenkins.backup.restoreCommand[0] | string | `"/home/user/bin/restore.sh"` | |
| jenkins.backup.volumeMounts[0].mountPath | string | `"/jenkins-home"` | |
| jenkins.backup.volumeMounts[0].name | string | `"jenkins-home"` | |
| jenkins.backup.volumeMounts[1].mountPath | string | `"/backup"` | |
| jenkins.backup.volumeMounts[1].name | string | `"backup"` | |
| jenkins.basePlugins | list | `[]` | |
| jenkins.configuration.configurationAsCode | list | `[]` | |
| jenkins.configuration.groovyScripts | list | `[]` | |
| jenkins.configuration.secretData | object | `{}` | |
| jenkins.configuration.secretRefName | string | `""` | |
| jenkins.disableCSRFProtection | bool | `false` | |
| jenkins.enabled | bool | `true` | |
| jenkins.env | list | `[]` | |
| jenkins.hostAliases | object | `{}` | |
| jenkins.image | string | `"jenkins/jenkins:2.492.3-lts"` | |
| jenkins.imagePullPolicy | string | `"Always"` | |
| jenkins.imagePullSecrets | list | `[]` | |
| jenkins.labels | object | `{}` | |
| jenkins.latestPlugins | bool | `true` | |
| jenkins.lifecycle | object | `{}` | |
| jenkins.livenessProbe.failureThreshold | int | `20` | |
| jenkins.livenessProbe.httpGet.path | string | `"/login"` | |
| jenkins.livenessProbe.httpGet.port | string | `"http"` | |
| jenkins.livenessProbe.httpGet.scheme | string | `"HTTP"` | |
| jenkins.livenessProbe.initialDelaySeconds | int | `100` | |
| jenkins.livenessProbe.periodSeconds | int | `10` | |
| jenkins.livenessProbe.successThreshold | int | `1` | |
| jenkins.livenessProbe.timeoutSeconds | int | `8` | |
| jenkins.name | string | `"jenkins"` | |
| jenkins.namespace | string | `"default"` | |
| jenkins.nodeSelector | object | `{}` | |
| jenkins.notifications | list | `[]` | |
| jenkins.plugins | list | `[]` | |
| jenkins.priorityClassName | string | `""` | |
| jenkins.readinessProbe.failureThreshold | int | `60` | |
| jenkins.readinessProbe.httpGet.path | string | `"/login"` | |
| jenkins.readinessProbe.httpGet.port | string | `"http"` | |
| jenkins.readinessProbe.httpGet.scheme | string | `"HTTP"` | |
| jenkins.readinessProbe.initialDelaySeconds | int | `120` | |
| jenkins.readinessProbe.periodSeconds | int | `10` | |
| jenkins.readinessProbe.successThreshold | int | `1` | |
| jenkins.readinessProbe.timeoutSeconds | int | `8` | |
| jenkins.resources.limits.cpu | string | `"1000m"` | |
| jenkins.resources.limits.memory | string | `"3Gi"` | |
| jenkins.resources.requests.cpu | string | `"250m"` | |
| jenkins.resources.requests.memory | string | `"500Mi"` | |
| jenkins.securityContext.fsGroup | int | `1000` | |
| jenkins.securityContext.runAsUser | int | `1000` | |
| jenkins.seedJobAgentImage | string | `""` | |
| jenkins.seedJobs | list | `[]` | |
| jenkins.serviceAccount.annotations | object | `{}` | |
| jenkins.skipPlugins | bool | `false` | |
| jenkins.terminationGracePeriodSeconds | int | `30` | |
| jenkins.tolerations | list | `[]` | |
| jenkins.validateSecurityWarnings | bool | `false` | |
| jenkins.volumeMounts | list | `[]` | |
| jenkins.volumes[0].name | string | `"backup"` | |
| jenkins.volumes[0].persistentVolumeClaim.claimName | string | `"jenkins-backup"` | |
| operator.affinity | object | `{}` | |
| operator.fullnameOverride | string | `""` | |
| operator.image | string | `"quay.io/jenkins-kubernetes-operator/operator:v0.9.0-beta1"` | |
| operator.imagePullPolicy | string | `"IfNotPresent"` | |
| operator.imagePullSecrets | list | `[]` | |
| operator.nameOverride | string | `""` | |
| operator.nodeSelector | object | `{}` | |
| operator.replicaCount | int | `1` | |
| operator.resources | object | `{}` | |
| operator.tolerations | list | `[]` | |
| webhook.certificate.duration | string | `"2160h"` | |
| webhook.certificate.name | string | `"webhook-certificate"` | |
| webhook.certificate.renewbefore | string | `"360h"` | |
| webhook.enabled | bool | `false` | |
----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)

View File

@ -1,3 +0,0 @@
apiVersion: v2
name: cert-manager-crds
version: "1.14.2"

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -157,11 +157,11 @@ spec:
type: object type: object
basePlugins: basePlugins:
description: 'BasePlugins contains plugins required by operator description: 'BasePlugins contains plugins required by operator
Defaults to : - name: configuration-as-code version: "1625.v27444588cc3d" Defaults to : - name: kubernetes version: "1.29.6" - name: workflow-job
- name: git version: "5.0.0" - name: job-dsl version: "1.83" version: "2.41" - name: workflow-aggregator version: "2.6" -
- name: kubernetes version: "3909.v1f2c633e8590" - name: kubernetes-credentials-provider name: git version: "4.7.2" - name: job-dsl version: "1.77" -
version: "1.211.vc236a_f5a_2f3c" - name: workflow-aggregator name: configuration-as-code version: "1.51" - name: kubernetes-credentials-provider
version: "596.v8c21c963d92d" - name: workflow-job version: "1289.vd1c337fd5354"' version: "0.18-1"'
items: items:
description: Plugin defines Jenkins plugin. description: Plugin defines Jenkins plugin.
properties: properties:
@ -1145,10 +1145,6 @@ spec:
selectors of replication controllers and services. More info: selectors of replication controllers and services. More info:
http://kubernetes.io/docs/user-guide/labels' http://kubernetes.io/docs/user-guide/labels'
type: object type: object
latestPlugins:
description: 'Allow to override jenkins-plugin-cli default behavior
while downloading the plugin and dependencies see: https://github.com/jenkinsci/plugin-installation-manager-tool#cli-options'
type: boolean
nodeSelector: nodeSelector:
additionalProperties: additionalProperties:
type: string type: string
@ -1330,15 +1326,6 @@ spec:
type: string type: string
type: object type: object
type: object type: object
skipPlugins:
description: 'Allow to skip installation of both BasePlugins and
Plugins. Requires using a custom image which includes the
BasePlugins. Defaults to false.'
type: boolean
terminationGracePeriodSeconds:
description: 'Optional duration in seconds the pod needs to terminate gracefully.'
type: integer
default: 30
tolerations: tolerations:
description: If specified, the pod's tolerations. description: If specified, the pod's tolerations.
items: items:
@ -3131,11 +3118,6 @@ spec:
- name - name
type: object type: object
type: array type: array
seedJobAgentImage:
description: SeedJobAgentImage defines the image that will be used
by the seed job agent. If not defined jenkins/inbound-agent:4.9-1
will be used.
type: string
seedJobs: seedJobs:
description: 'SeedJobs defines list of Jenkins Seed Job configurations description: 'SeedJobs defines list of Jenkins Seed Job configurations
More info: https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuration#configure-seed-jobs-and-pipelines' More info: https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuration#configure-seed-jobs-and-pipelines'

View File

@ -85,19 +85,10 @@ spec:
{{- with .Values.jenkins.notifications }} {{- with .Values.jenkins.notifications }}
notifications: {{ toYaml . | nindent 4 }} notifications: {{ toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- with .Values.jenkins.serviceAccount }}
serviceAccount: {{ toYaml . | nindent 4 }}
{{- end }}
master: master:
{{- with .Values.jenkins.labels }} {{- with .Values.jenkins.labels }}
labels: {{ toYaml . | nindent 6 }} labels: {{ toYaml . | nindent 6 }}
{{- end }} {{- end }}
{{- with .Values.jenkins.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.jenkins.tolerations }}
tolerations: {{ toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.jenkins.annotations }} {{- with .Values.jenkins.annotations }}
annotations: {{ toYaml . | nindent 6 }} annotations: {{ toYaml . | nindent 6 }}
{{- end }} {{- end }}
@ -107,18 +98,10 @@ spec:
{{- with .Values.jenkins.plugins }} {{- with .Values.jenkins.plugins }}
plugins: {{ toYaml . | nindent 4 }} plugins: {{ toYaml . | nindent 4 }}
{{- end }} {{- end }}
latestPlugins: {{ .Values.jenkins.latestPlugins }}
{{- if .Values.jenkins.priorityClassName }} {{- if .Values.jenkins.priorityClassName }}
priorityClassName: {{ .Values.jenkins.priorityClassName }} priorityClassName: {{- .Values.jenkins.priorityClassName }}
{{- end }} {{- end }}
disableCSRFProtection: {{ .Values.jenkins.disableCSRFProtection }} disableCSRFProtection: {{ .Values.jenkins.disableCSRFProtection }}
{{- with .Values.jenkins.hostAliases }}
hostAliases: {{ toYaml . | nindent 4 }}
{{- end }}
skipPlugins: {{ .Values.jenkins.skipPlugins }}
{{- if .Values.jenkins.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.jenkins.terminationGracePeriodSeconds }}
{{- end }}
containers: containers:
- name: jenkins-master - name: jenkins-master
image: {{ .Values.jenkins.image }} image: {{ .Values.jenkins.image }}
@ -135,16 +118,13 @@ spec:
{{- with .Values.jenkins.env }} {{- with .Values.jenkins.env }}
env: {{- toYaml . | nindent 8 }} env: {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.jenkins.lifecycle}}
lifecycle: {{ toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.jenkins.volumeMounts }} {{- with .Values.jenkins.volumeMounts }}
volumeMounts: {{- toYaml . | nindent 8 }} volumeMounts: {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- if .Values.jenkins.backup.enabled }} {{- if .Values.jenkins.backup.enabled }}
- name: {{ .Values.jenkins.backup.containerName }} - name: {{ .Values.jenkins.backup.containerName }}
image: {{ .Values.jenkins.backup.image }} image: {{ .Values.jenkins.backup.image }}
imagePullPolicy: {{ .Values.jenkins.imagePullPolicy }} imagePullPolicy: IfNotPresent
{{- with .Values.jenkins.backup.resources }} {{- with .Values.jenkins.backup.resources }}
resources: {{ toYaml . | nindent 10 }} resources: {{ toYaml . | nindent 10 }}
{{- end }} {{- end }}
@ -169,7 +149,4 @@ spec:
{{- with .Values.jenkins.seedJobs }} {{- with .Values.jenkins.seedJobs }}
seedJobs: {{- toYaml . | nindent 4 }} seedJobs: {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- if .Values.jenkins.seedJobAgentImage }}
seedJobAgentImage: {{ .Values.jenkins.seedJobAgentImage }}
{{- end }}
{{- end }} {{- end }}

View File

@ -41,29 +41,9 @@ spec:
name: webhook-certs name: webhook-certs
readOnly: true readOnly: true
{{- end }} {{- end }}
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
env: env:
- name: WATCH_NAMESPACE - name: WATCH_NAMESPACE
{{- if .Values.jenkins.enabled }}
value: {{ .Values.jenkins.namespace }} value: {{ .Values.jenkins.namespace }}
{{- else if .Values.operator.watchNamespace }}
value: {{ .Values.operator.watchNamespace }}
{{- else }}
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- end }}
- name: POD_NAME - name: POD_NAME
valueFrom: valueFrom:
fieldRef: fieldRef:

View File

@ -24,19 +24,13 @@ jenkins:
# labels are injected into metadata labels field # labels are injected into metadata labels field
labels: {} labels: {}
# nodeSelector are injected into metadata nodeSelector field
nodeSelector: {}
# tolerations are injected into metadata tolerations field
tolerations: []
# annotations are injected into metadata annotations field # annotations are injected into metadata annotations field
annotations: {} annotations: {}
# image is the name (and tag) of the Jenkins instance # image is the name (and tag) of the Jenkins instance
# Default: jenkins/jenkins:lts # Default: jenkins/jenkins:lts
# It's recommended to use LTS (tag: "lts") version # It's recommended to use LTS (tag: "lts") version
image: jenkins/jenkins:2.528.1-lts image: jenkins/jenkins:2.303.2-lts-alpine
# env contains jenkins container environment variables # env contains jenkins container environment variables
env: [] env: []
@ -44,9 +38,6 @@ jenkins:
# imagePullPolicy defines policy for pulling images # imagePullPolicy defines policy for pulling images
imagePullPolicy: Always imagePullPolicy: Always
# lifecycle is used if you want to specify lifecycle hooks for the master container
lifecycle: {}
# priorityClassName indicates the importance of a Pod relative to other Pods # priorityClassName indicates the importance of a Pod relative to other Pods
# See: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ # See: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
priorityClassName: "" priorityClassName: ""
@ -56,21 +47,6 @@ jenkins:
# See https://github.com/jenkinsci/kubernetes-operator/pull/193 for more info # See https://github.com/jenkinsci/kubernetes-operator/pull/193 for more info
disableCSRFProtection: false disableCSRFProtection: false
# adding entries to a pod's /etc/hosts file provides pod-level override of hostname
# resolution when DNS and other options are not applicable.
hostAliases: {}
# - ip: "127.0.0.1"
# hostnames:
# - "foo.local"
# - "bar.local"
# - ip: "10.1.2.3"
# hostnames:
# - "foo.remote"
# - "bar.remote"
# Optional duration in seconds the pod needs to terminate gracefully.
# Default 30sec
terminationGracePeriodSeconds: 30
# validateSecurityWarnings enables or disables validating potential security warnings in Jenkins plugins via admission webhooks. # validateSecurityWarnings enables or disables validating potential security warnings in Jenkins plugins via admission webhooks.
validateSecurityWarnings: false validateSecurityWarnings: false
@ -79,15 +55,10 @@ jenkins:
# See https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuration/#pulling-docker-images-from-private-repositories for more info # See https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuration/#pulling-docker-images-from-private-repositories for more info
imagePullSecrets: [] imagePullSecrets: []
# notifications is feature that notify user about Jenkins reconciliation status # notifications is feature that notify user about Jenkins reconcilation status
# See https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/notifications/ for more info # See https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/notifications/ for more info
notifications: [] notifications: []
# Enables customization of the Service Account attached to the master Jenkins instance via annotations
# https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/schema/#github.com/jenkinsci/kubernetes-operator/api/v1alpha2.ServiceAccount
serviceAccount:
annotations: {}
# basePlugins are plugins installed and required by the operator # basePlugins are plugins installed and required by the operator
# Shouldn't contain plugins defined by user # Shouldn't contain plugins defined by user
# You can change their versions here # You can change their versions here
@ -97,20 +68,19 @@ jenkins:
# #
# basePlugins: # basePlugins:
# - name: kubernetes # - name: kubernetes
# version: 4246.v5a_12b_1fe120e # version: 1.29.6
# - name: workflow-job # - name: workflow-job
# version: 1400.v7fd111b_ec82f # version: "2.41"
# - name: workflow-aggregator # - name: workflow-aggregator
# version: 596.v8c21c963d92d # version: "2.6"
# - name: git # - name: git
# version: 5.2.2 # version: 4.7.2
# - name: job-dsl # - name: job-dsl
# version: "1.87" # version: "1.77"
# - name: configuration-as-code # - name: configuration-as-code
# version: 1810.v9b_c30a_249a_4c # version: "1.51"
# - name: kubernetes-credentials-provider # - name: kubernetes-credentials-provider
# version: 1.262.v2670ef7ea_0c5 # version: 0.18-1
basePlugins: [] basePlugins: []
# plugins are plugins required by the user # plugins are plugins required by the user
@ -124,12 +94,6 @@ jenkins:
# version: "0.6" # version: "0.6"
plugins: [] plugins: []
# latestPlugins: Allow to override jenkins-plugin-cli default behavior
# while downloading the plugin and dependencies
# see: https://github.com/jenkinsci/plugin-installation-manager-tool#cli-options
# default to true
latestPlugins: true
# seedJobs is placeholder for jenkins seed jobs # seedJobs is placeholder for jenkins seed jobs
# For seed job creation tutorial, check https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuring-seed-jobs-and-pipelines/ # For seed job creation tutorial, check https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuring-seed-jobs-and-pipelines/
# Example: # Example:
@ -142,14 +106,6 @@ jenkins:
# repositoryUrl: https://github.com/jenkinsci/kubernetes-operator.git # repositoryUrl: https://github.com/jenkinsci/kubernetes-operator.git
seedJobs: [] seedJobs: []
# SeedJobAgentImage defines the image that will be used by the seed job agent. If not defined jenkins/inbound-agent:3248.v65ecb_254c298-6 will be used.
seedJobAgentImage: ""
# skipPlugins allows to skip installation of both BasePlugins and Plugins.
# Requires using a custom image which includes the BasePlugins.
# Defaults to false.
skipPlugins: false
# Resource limit/request for Jenkins # Resource limit/request for Jenkins
# See https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ for details # See https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ for details
resources: resources:
@ -157,7 +113,7 @@ jenkins:
cpu: 1000m cpu: 1000m
memory: 3Gi memory: 3Gi
requests: requests:
cpu: 250m cpu: 1
memory: 500Mi memory: 500Mi
# volumes used by Jenkins # volumes used by Jenkins
@ -221,8 +177,8 @@ jenkins:
enabled: true enabled: true
# image used by backup feature # image used by backup feature
# By default using prebuilt backup PVC image # By default using prebuilt backup PVC image by VirtusLab
image: quay.io/jenkins-kubernetes-operator/backup-pvc:v0.4.3 image: virtuslab/jenkins-operator-backup-pvc:v0.1.0
# containerName is backup container name # containerName is backup container name
containerName: backup containerName: backup
@ -270,11 +226,6 @@ jenkins:
# BACKUP_DIR - path for storing backup files (default: "/backup") # BACKUP_DIR - path for storing backup files (default: "/backup")
# JENKINS_HOME - path to jenkins home (default: "/jenkins-home") # JENKINS_HOME - path to jenkins home (default: "/jenkins-home")
# BACKUP_COUNT - define how much recent backups will be kept # BACKUP_COUNT - define how much recent backups will be kept
# Optional in case you want to modify the backup and restore retry logic
# BACKUP_RETRY_COUNT
# BACKUP_RETRY_INTERVAL
# RESTORE_RETRY_COUNT
# RESTORE_RETRY_INTERVAL
env: env:
- name: BACKUP_DIR - name: BACKUP_DIR
value: /backup value: /backup
@ -282,15 +233,6 @@ jenkins:
value: /jenkins-home value: /jenkins-home
- name: BACKUP_COUNT - name: BACKUP_COUNT
value: "3" # keep only the 3 most recent backups value: "3" # keep only the 3 most recent backups
#- name: BACKUP_RETRY_COUNT
# value: "3"
#- name: BACKUP_RETRY_INTERVAL
# value: "60"
#- name: RESTORE_RETRY_COUNT
# value: "10"
#- name: RESTORE_RETRY_INTERVAL
# value: "10"
# volumeMounts holds the mount points for volumes # volumeMounts holds the mount points for volumes
volumeMounts: volumeMounts:
@ -302,10 +244,10 @@ jenkins:
# configuration is section where we can configure Jenkins instance # configuration is section where we can configure Jenkins instance
# See https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/customization/ for details # See https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/customization/ for details
configuration: configuration:
configurationAsCode: [] configurationAsCode: {}
# - configMapName: jenkins-casc # - configMapName: jenkins-casc
# content: {} # content: {}
groovyScripts: [] groovyScripts: {}
# - configMapName: jenkins-gs # - configMapName: jenkins-gs
# content: {} # content: {}
@ -320,7 +262,7 @@ operator:
replicaCount: 1 replicaCount: 1
# image is the name (and tag) of the Jenkins Operator image # image is the name (and tag) of the Jenkins Operator image
image: quay.io/jenkins-kubernetes-operator/operator:v0.9.0-beta1 image: virtuslab/jenkins-operator:v0.6.0
# imagePullPolicy defines policy for pulling images # imagePullPolicy defines policy for pulling images
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
@ -334,10 +276,6 @@ operator:
# fullnameOverride overrides the deployment name # fullnameOverride overrides the deployment name
fullnameOverride: "" fullnameOverride: ""
# Select a different namespace to look for the Jenkins CR and deploy Jenkins in. Defaults to the same namespace as
# the operator.
# watchNamespace: "jenkins-namespace"
resources: {} resources: {}
nodeSelector: {} nodeSelector: {}
tolerations: [] tolerations: []
@ -356,11 +294,8 @@ webhook:
# enable or disable the validation webhook # enable or disable the validation webhook
enabled: false enabled: false
cert-manager:
# cert-manager is required to generate certificates for webhook. If you don't have cert-manager installed in your cluster,
# you can install it as a subordinate chart
enabled: false
# This startupapicheck is a Helm post-install hook that waits for the webhook # This startupapicheck is a Helm post-install hook that waits for the webhook
# endpoints to become available. # endpoints to become available.
cert-manager:
startupapicheck: startupapicheck:
enabled: false enabled: false

View File

@ -1,16 +1,15 @@
ALL_IN_ONE_DEPLOY_FILE_PREFIX="all-in-one" # Setup variables for the Makefile
API_VERSION_NEXT="v1alpha3" NAME=kubernetes-operator
API_VERSION="v1alpha2" OPERATOR_SDK_VERSION=1.3.0
CLUSTER_DOMAIN="cluster.local" GO_VERSION=1.15.6
GEN_CRD_API="gen-crd-api-reference-docs" PKG=github.com/jenkinsci/kubernetes-operator
GO_VERSION="1.22" DOCKER_ORGANIZATION=virtuslab
HELM_VERSION="3.12.3" DOCKER_REGISTRY=jenkins-operator
IMAGE_PULL_MODE="local" NAMESPACE=default
KIND_CLUSTER_NAME="jenkins" API_VERSION=v1alpha2
LATEST_LTS_VERSION="2.528.1" API_VERSION_NEXT=v1alpha3
NAME="kubernetes-operator" ALL_IN_ONE_DEPLOY_FILE_PREFIX=all-in-one
NAMESPACE="default" GEN_CRD_API=gen-crd-api-reference-docs
OPERATOR_SDK_VERSION="1.35.0" IMAGE_PULL_MODE=local
PKG="github.com/jenkinsci/kubernetes-operator" HELM_VERSION=3.1.2
QUAY_ORGANIZATION="jenkins-kubernetes-operator" CLUSTER_DOMAIN=cluster.local
QUAY_REGISTRY="operator"

7
config.crc.env Normal file
View File

@ -0,0 +1,7 @@
KUBERNETES_PROVIDER=crc
JENKINS_API_HOSTNAME_COMMAND=crc ip
JENKINS_API_PORT=0
JENKINS_API_USE_NODEPORT=true
CRC_OC_PROJECT=default

View File

@ -1,5 +0,0 @@
JENKINS_API_HOSTNAME_COMMAND=echo localhost
JENKINS_API_PORT=0
JENKINS_API_USE_NODEPORT=true
KUBERNETES_PROVIDER=kind
KUBECTL_CONTEXT=kind-jenkins

10
config.minikube.env Normal file
View File

@ -0,0 +1,10 @@
KUBERNETES_PROVIDER=minikube
MINIKUBE_KUBERNETES_VERSION=v1.21.1
MINIKUBE_DRIVER=virtualbox
MINIKUBE_VERSION=1.21.0
KUBECTL_CONTEXT=minikube
JENKINS_API_HOSTNAME_COMMAND=bin/minikube ip
JENKINS_API_PORT=0
JENKINS_API_USE_NODEPORT=true

File diff suppressed because it is too large Load Diff

View File

@ -28,9 +28,7 @@ patchesStrategicMerge:
# Protect the /metrics endpoint by putting it behind auth. # Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics # If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line. # endpoint w/o any authn/z, please comment the following line.
# Mount the controller config file for loading manager configurations - manager_auth_proxy_patch.yaml
# through a ComponentConfig type
- manager_config_patch.yaml
# Mount the controller config file for loading manager configurations # Mount the controller config file for loading manager configurations
# through a ComponentConfig type # through a ComponentConfig type

View File

@ -10,23 +10,15 @@ spec:
spec: spec:
containers: containers:
- name: kube-rbac-proxy - name: kube-rbac-proxy
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.13.1 image: gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0
args: args:
- "--secure-listen-address=0.0.0.0:8443" - "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/" - "--upstream=http://127.0.0.1:8080/"
- "--logtostderr=true" - "--logtostderr=true"
- "--v=0" - "--v=10"
ports: ports:
- containerPort: 8443 - containerPort: 8443
protocol: TCP
name: https name: https
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 5m
memory: 64Mi
- name: manager - name: manager
args: args:
- "--health-probe-bind-address=:8081" - "--health-probe-bind-address=:8081"

View File

@ -14,8 +14,6 @@ spec:
metadata: metadata:
labels: labels:
control-plane: controller-manager control-plane: controller-manager
annotations:
kubectl.kubernetes.io/default-container: manager
spec: spec:
serviceAccountName: jenkins-operator serviceAccountName: jenkins-operator
securityContext: securityContext:
@ -25,7 +23,7 @@ spec:
- /manager - /manager
args: args:
- --leader-elect - --leader-elect
image: quay.io/jenkins-kubernetes-operator/operator:v0.8.0 image: virtuslab/jenkins-operator:v0.7.0
name: jenkins-operator name: jenkins-operator
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
securityContext: securityContext:
@ -44,8 +42,8 @@ spec:
periodSeconds: 10 periodSeconds: 10
resources: resources:
limits: limits:
cpu: 200m cpu: 100m
memory: 100Mi memory: 30Mi
requests: requests:
cpu: 100m cpu: 100m
memory: 20Mi memory: 20Mi
@ -54,5 +52,4 @@ spec:
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
serviceAccountName: controller-manager
terminationGracePeriodSeconds: 10 terminationGracePeriodSeconds: 10

View File

@ -1,3 +1,4 @@
# Prometheus Monitor Service (Metrics) # Prometheus Monitor Service (Metrics)
apiVersion: monitoring.coreos.com/v1 apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor kind: ServiceMonitor
@ -10,10 +11,6 @@ spec:
endpoints: endpoints:
- path: /metrics - path: /metrics
port: https port: https
scheme: https
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
tlsConfig:
insecureSkipVerify: true
selector: selector:
matchLabels: matchLabels:
control-plane: controller-manager control-plane: controller-manager

View File

@ -8,5 +8,5 @@ roleRef:
name: proxy-role name: proxy-role
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: controller-manager name: default
namespace: default namespace: default

View File

@ -9,7 +9,6 @@ spec:
ports: ports:
- name: https - name: https
port: 8443 port: 8443
protocol: TCP
targetPort: https targetPort: https
selector: selector:
control-plane: controller-manager control-plane: controller-manager

View File

@ -10,4 +10,3 @@ resources:
- auth_proxy_role.yaml - auth_proxy_role.yaml
- auth_proxy_role_binding.yaml - auth_proxy_role_binding.yaml
- auth_proxy_client_clusterrole.yaml - auth_proxy_client_clusterrole.yaml
- service_account.yaml

View File

@ -7,19 +7,9 @@ metadata:
rules: rules:
- apiGroups: - apiGroups:
- "" - ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io - coordination.k8s.io
resources: resources:
- configmaps
- leases - leases
verbs: verbs:
- get - get

View File

@ -1,8 +1,9 @@
--- ---
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole kind: Role
metadata: metadata:
name: manager-role name: jenkins-operator
rules: rules:
- apiGroups: - apiGroups:
- apps - apps

View File

@ -1,5 +0,0 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: controller-manager
namespace: system

View File

@ -1,11 +1,14 @@
--- ---
apiVersion: admissionregistration.k8s.io/v1 apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration kind: ValidatingWebhookConfiguration
metadata: metadata:
creationTimestamp: null
name: validating-webhook-configuration name: validating-webhook-configuration
webhooks: webhooks:
- admissionReviewVersions: - admissionReviewVersions:
- v1 - v1
- v1beta1
clientConfig: clientConfig:
service: service:
name: webhook-service name: webhook-service

View File

@ -7,7 +7,6 @@ metadata:
spec: spec:
ports: ports:
- port: 443 - port: 443
protocol: TCP
targetPort: 9443 targetPort: 9443
selector: selector:
control-plane: controller-manager control-plane: controller-manager

View File

@ -1,7 +1,6 @@
package controllers package controllers
import ( import (
"context"
"fmt" "fmt"
"reflect" "reflect"
@ -20,15 +19,15 @@ import (
// enqueueRequestForJenkins enqueues a Request for Secrets and ConfigMaps created by jenkins-operator. // enqueueRequestForJenkins enqueues a Request for Secrets and ConfigMaps created by jenkins-operator.
type enqueueRequestForJenkins struct{} type enqueueRequestForJenkins struct{}
func (e *enqueueRequestForJenkins) Create(ctx context.Context, evt event.CreateEvent, q workqueue.RateLimitingInterface) { func (e *enqueueRequestForJenkins) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface) {
if req := e.getOwnerReconcileRequests(ctx, evt.Object); req != nil { if req := e.getOwnerReconcileRequests(evt.Object); req != nil {
q.Add(*req) q.Add(*req)
} }
} }
func (e *enqueueRequestForJenkins) Update(ctx context.Context, evt event.UpdateEvent, q workqueue.RateLimitingInterface) { func (e *enqueueRequestForJenkins) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface) {
req1 := e.getOwnerReconcileRequests(ctx, evt.ObjectOld) req1 := e.getOwnerReconcileRequests(evt.ObjectOld)
req2 := e.getOwnerReconcileRequests(ctx, evt.ObjectNew) req2 := e.getOwnerReconcileRequests(evt.ObjectNew)
if req1 != nil || req2 != nil { if req1 != nil || req2 != nil {
jenkinsName := "unknown" jenkinsName := "unknown"
@ -52,19 +51,19 @@ func (e *enqueueRequestForJenkins) Update(ctx context.Context, evt event.UpdateE
} }
} }
func (e *enqueueRequestForJenkins) Delete(ctx context.Context, evt event.DeleteEvent, q workqueue.RateLimitingInterface) { func (e *enqueueRequestForJenkins) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface) {
if req := e.getOwnerReconcileRequests(ctx, evt.Object); req != nil { if req := e.getOwnerReconcileRequests(evt.Object); req != nil {
q.Add(*req) q.Add(*req)
} }
} }
func (e *enqueueRequestForJenkins) Generic(ctx context.Context, evt event.GenericEvent, q workqueue.RateLimitingInterface) { func (e *enqueueRequestForJenkins) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface) {
if req := e.getOwnerReconcileRequests(ctx, evt.Object); req != nil { if req := e.getOwnerReconcileRequests(evt.Object); req != nil {
q.Add(*req) q.Add(*req)
} }
} }
func (e *enqueueRequestForJenkins) getOwnerReconcileRequests(_ context.Context, object metav1.Object) *reconcile.Request { func (e *enqueueRequestForJenkins) getOwnerReconcileRequests(object metav1.Object) *reconcile.Request {
if object.GetLabels()[constants.LabelAppKey] == constants.LabelAppValue && if object.GetLabels()[constants.LabelAppKey] == constants.LabelAppValue &&
object.GetLabels()[constants.LabelWatchKey] == constants.LabelWatchValue && object.GetLabels()[constants.LabelWatchKey] == constants.LabelWatchValue &&
len(object.GetLabels()[constants.LabelJenkinsCRKey]) > 0 { len(object.GetLabels()[constants.LabelJenkinsCRKey]) > 0 {
@ -80,24 +79,24 @@ type jenkinsDecorator struct {
handler handler.EventHandler handler handler.EventHandler
} }
func (e *jenkinsDecorator) Create(ctx context.Context, evt event.CreateEvent, q workqueue.RateLimitingInterface) { func (e *jenkinsDecorator) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface) {
log.Log.WithValues("cr", evt.Object.GetName()).Info(fmt.Sprintf("%T/%s was created", evt.Object, evt.Object.GetName())) log.Log.WithValues("cr", evt.Object.GetName()).Info(fmt.Sprintf("%T/%s was created", evt.Object, evt.Object.GetName()))
e.handler.Create(ctx, evt, q) e.handler.Create(evt, q)
} }
func (e *jenkinsDecorator) Update(ctx context.Context, evt event.UpdateEvent, q workqueue.RateLimitingInterface) { func (e *jenkinsDecorator) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface) {
if !reflect.DeepEqual(evt.ObjectOld.(*v1alpha2.Jenkins).Spec, evt.ObjectNew.(*v1alpha2.Jenkins).Spec) { if !reflect.DeepEqual(evt.ObjectOld.(*v1alpha2.Jenkins).Spec, evt.ObjectNew.(*v1alpha2.Jenkins).Spec) {
log.Log.WithValues("cr", evt.ObjectNew.GetName()).Info( log.Log.WithValues("cr", evt.ObjectNew.GetName()).Info(
fmt.Sprintf("%T/%s has been updated", evt.ObjectNew, evt.ObjectNew.GetName())) fmt.Sprintf("%T/%s has been updated", evt.ObjectNew, evt.ObjectNew.GetName()))
} }
e.handler.Update(ctx, evt, q) e.handler.Update(evt, q)
} }
func (e *jenkinsDecorator) Delete(ctx context.Context, evt event.DeleteEvent, q workqueue.RateLimitingInterface) { func (e *jenkinsDecorator) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface) {
log.Log.WithValues("cr", evt.Object.GetName()).Info(fmt.Sprintf("%T/%s was deleted", evt.Object, evt.Object.GetName())) log.Log.WithValues("cr", evt.Object.GetName()).Info(fmt.Sprintf("%T/%s was deleted", evt.Object, evt.Object.GetName()))
e.handler.Delete(ctx, evt, q) e.handler.Delete(evt, q)
} }
func (e *jenkinsDecorator) Generic(ctx context.Context, evt event.GenericEvent, q workqueue.RateLimitingInterface) { func (e *jenkinsDecorator) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface) {
e.handler.Generic(ctx, evt, q) e.handler.Generic(evt, q)
} }

View File

@ -46,6 +46,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/reconcile" "sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"
) )
type reconcileError struct { type reconcileError struct {
@ -78,22 +79,9 @@ type JenkinsReconciler struct {
// SetupWithManager sets up the controller with the Manager. // SetupWithManager sets up the controller with the Manager.
func (r *JenkinsReconciler) SetupWithManager(mgr ctrl.Manager) error { func (r *JenkinsReconciler) SetupWithManager(mgr ctrl.Manager) error {
jenkinsHandler := &enqueueRequestForJenkins{} jenkinsHandler := &enqueueRequestForJenkins{}
configMapResource := &corev1.Secret{ configMapResource := &source.Kind{Type: &corev1.ConfigMap{TypeMeta: metav1.TypeMeta{APIVersion: APIVersion, Kind: ConfigMapKind}}}
TypeMeta: metav1.TypeMeta{ secretResource := &source.Kind{Type: &corev1.Secret{TypeMeta: metav1.TypeMeta{APIVersion: APIVersion, Kind: SecretKind}}}
APIVersion: APIVersion, decorator := jenkinsDecorator{handler: &handler.EnqueueRequestForObject{}}
Kind: SecretKind,
},
}
secretResource := &corev1.Secret{
TypeMeta: metav1.TypeMeta{
APIVersion: APIVersion,
Kind: SecretKind,
},
}
decorator := jenkinsDecorator{
handler: &handler.EnqueueRequestForObject{},
}
return ctrl.NewControllerManagedBy(mgr). return ctrl.NewControllerManagedBy(mgr).
For(&v1alpha2.Jenkins{}). For(&v1alpha2.Jenkins{}).
Owns(&corev1.Pod{}). Owns(&corev1.Pod{}).
@ -101,7 +89,7 @@ func (r *JenkinsReconciler) SetupWithManager(mgr ctrl.Manager) error {
Owns(&corev1.ConfigMap{}). Owns(&corev1.ConfigMap{}).
Watches(secretResource, jenkinsHandler). Watches(secretResource, jenkinsHandler).
Watches(configMapResource, jenkinsHandler). Watches(configMapResource, jenkinsHandler).
Watches(&v1alpha2.Jenkins{}, &decorator). Watches(&source.Kind{Type: &v1alpha2.Jenkins{}}, &decorator).
Complete(r) Complete(r)
} }
@ -205,7 +193,7 @@ func (r *JenkinsReconciler) Reconcile(_ context.Context, request ctrl.Request) (
return reconcile.Result{Requeue: true}, nil return reconcile.Result{Requeue: true}, nil
} }
if result.Requeue && result.RequeueAfter == 0 { if result.Requeue && result.RequeueAfter == 0 {
result.RequeueAfter = time.Duration(rand.Intn(10)) * time.Second result.RequeueAfter = time.Duration(rand.Intn(10)) * time.Millisecond
} }
return result, nil return result, nil
} }
@ -390,11 +378,6 @@ func (r *JenkinsReconciler) setDefaults(jenkins *v1alpha2.Jenkins) (requeue bool
changed = true changed = true
jenkinsContainer.LivenessProbe = resources.NewProbe(containerProbeURI, containerProbePortName, corev1.URISchemeHTTP, 80, 5, 12) jenkinsContainer.LivenessProbe = resources.NewProbe(containerProbeURI, containerProbePortName, corev1.URISchemeHTTP, 80, 5, 12)
} }
if jenkinsContainer.Lifecycle == nil {
logger.Info("Setting default Jenkins lifecycle")
changed = true
jenkinsContainer.Lifecycle = &corev1.Lifecycle{}
}
if len(jenkinsContainer.Command) == 0 { if len(jenkinsContainer.Command) == 0 {
logger.Info("Setting default Jenkins container command") logger.Info("Setting default Jenkins container command")
changed = true changed = true

View File

@ -32,8 +32,21 @@ rules:
- create - create
- patch - patch
--- ---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: leader-election-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: leader-election-role
subjects:
- kind: ServiceAccount
name: jenkins-operator
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata: metadata:
name: jenkins-operator name: jenkins-operator
rules: rules:
@ -143,6 +156,24 @@ rules:
- get - get
- list - list
- watch - watch
- apiGroups:
- jenkins.io
resources:
- '*'
verbs:
- '*'
- apiGroups:
- jenkins.io
resources:
- jenkins
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups: - apiGroups:
- jenkins.io - jenkins.io
resources: resources:
@ -157,12 +188,6 @@ rules:
- get - get
- patch - patch
- update - update
- apiGroups:
- jenkins.io
resources:
- '*'
verbs:
- '*'
- apiGroups: - apiGroups:
- rbac.authorization.k8s.io - rbac.authorization.k8s.io
resources: resources:
@ -175,7 +200,7 @@ rules:
- update - update
- watch - watch
- apiGroups: - apiGroups:
- "route.openshift.io" - route.openshift.io
resources: resources:
- routes - routes
verbs: verbs:
@ -184,78 +209,48 @@ rules:
- list - list
- update - update
- watch - watch
- apiGroups:
- "image.openshift.io"
resources:
- imagestreams
verbs:
- get
- list
- watch
- apiGroups:
- "build.openshift.io"
resources:
- builds
- buildconfigs
verbs:
- get
- list
- watch
--- ---
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding kind: RoleBinding
metadata: metadata:
name: leader-election-rolebinding name: manager-rolebinding
roleRef: roleRef:
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io
kind: Role kind: Role
name: leader-election-role
subjects:
- kind: ServiceAccount
name: jenkins-operator
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: jenkins-operator name: jenkins-operator
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: jenkins-operator name: jenkins-operator
roleRef:
kind: Role
name: jenkins-operator
apiGroup: rbac.authorization.k8s.io
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: jenkins-operator name: jenkins-operator
labels: labels:
app.kubernetes.io/name: jenkins-operator control-plane: controller-manager
helm.sh/chart: jenkins-operator-0.9.0-beta1
app.kubernetes.io/version: "0.9.0-beta1"
spec: spec:
replicas: 1
selector: selector:
matchLabels: matchLabels:
app.kubernetes.io/name: jenkins-operator control-plane: controller-manager
replicas: 1
template: template:
metadata: metadata:
labels: labels:
app.kubernetes.io/name: jenkins-operator control-plane: controller-manager
spec: spec:
serviceAccountName: jenkins-operator serviceAccountName: jenkins-operator
securityContext:
runAsUser: 65532
containers: containers:
- name: jenkins-operator - command:
image: quay.io/jenkins-kubernetes-operator/operator:v0.9.0-beta1
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 80
protocol: TCP
command:
- /manager - /manager
args: args:
- --leader-elect
image: virtuslab/jenkins-operator:v0.7.0
name: jenkins-operator
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /healthz path: /healthz
@ -268,21 +263,16 @@ spec:
port: 8081 port: 8081
initialDelaySeconds: 5 initialDelaySeconds: 5
periodSeconds: 10 periodSeconds: 10
resources:
limits:
cpu: 100m
memory: 30Mi
requests:
cpu: 100m
memory: 20Mi
env: env:
- name: WATCH_NAMESPACE - name: WATCH_NAMESPACE
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: POD_NAME terminationGracePeriodSeconds: 10
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: OPERATOR_NAME
value: "jenkins-operator"
resources:
limits:
cpu: 100m
memory: 120Mi
requests:
cpu: 100m
memory: 120Mi

File diff suppressed because it is too large Load Diff

120
docs/404.html Normal file
View File

@ -0,0 +1,120 @@
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="generator" content="Hugo 0.62.2" />
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<link rel="shortcut icon" href="/favicons/favicon.ico" >
<link rel="apple-touch-icon" href="/kubernetes-operator/favicons/apple-touch-icon-180x180.png" sizes="180x180">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-36x36.png" sizes="36x36">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-48x48.png" sizes="48x48">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-72x72.png" sizes="72x72">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-96x196.png" sizes="96x196">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-144x144.png" sizes="144x144">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-192x192.png"sizes="192x192">
<title>404 Page not found | Jenkins Operator</title><meta property="og:title" content="404 Page not found" />
<meta property="og:description" content="A native operator for Kubernetes to manage Jenkins" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://jenkinsci.github.io/kubernetes-operator/404.html" />
<meta property="og:site_name" content="Jenkins Operator" />
<meta itemprop="name" content="404 Page not found">
<meta itemprop="description" content="A native operator for Kubernetes to manage Jenkins"><meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="404 Page not found"/>
<meta name="twitter:description" content="A native operator for Kubernetes to manage Jenkins"/>
<link rel="preload" href="/kubernetes-operator/scss/main.min.6c58fba96b88d035ce071c346f084a9dc4dedee4e80eb3724fe530520541a4ec.css" as="style">
<link href="/kubernetes-operator/scss/main.min.6c58fba96b88d035ce071c346f084a9dc4dedee4e80eb3724fe530520541a4ec.css" rel="stylesheet" integrity="">
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
</head>
<body class="td-404">
<header>
<nav class="js-navbar-scroll navbar navbar-expand navbar-dark flex-column flex-md-row td-navbar">
<a class="navbar-brand" href="/kubernetes-operator/">
<img style="width: 32px; height: 32px; margin-right: 7.5px;" src="/kubernetes-operator/img/logo.svg"></img><span class="text-uppercase font-weight-bold">Jenkins Operator</span>
</a>
<div class="td-navbar-nav-scroll ml-md-auto" id="main_navbar">
<ul class="navbar-nav mt-2 mt-lg-0">
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="/kubernetes-operator/about"><span>What's the Jenkins Operator?</span></a>
</li>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="/kubernetes-operator/docs"><span>Documentation</span></a>
</li>
</ul>
</div>
<div class="navbar-nav d-none d-lg-block">
<input type="search" class="form-control td-search-input" placeholder="&#xf002 Search this site…" aria-label="Search this site…" autocomplete="off">
</div>
</nav>
</header>
<div class="container-fluid td-default td-outer">
<main role="main" class="td-main">
<main id="main">
<div>
<h1 id="title">Not found</h1>
<p>Oops! This page doesn't exist. Try going back to our <a href="/kubernetes-operator/">home page</a>.</p>
<p>You can learn how to make a 404 page like this in <a href="https://gohugo.io/templates/404/">Custom 404 Pages</a>.</p>
</div>
</main>
</main>
<footer class="bg-dark py-5 row d-print-none">
<div class="bg-dark container-fluid trademark-bigger">
<div class="row">
<div class="col-6 col-sm-4 text-xs-center order-sm-2">
</div>
<div class="col-6 col-sm-4 text-right text-xs-center order-sm-3">
</div>
<div class="col-12 col-sm-12 text-center py-4 order-sm-2">
<small class="text-white">&copy; 2021 Jenkins Operator is created by VirtusLab. Source is available under Apache License Version 2 and website content under Creative Commons Attribution-ShareAlike 4.0.</small><br>
<small class="text-white">Jenkins® is a registered trademark of Software in the Public Interest, Inc.</small>
<p class="mt-2"><a href="/kubernetes-operator/about/">What&#39;s the Jenkins Operator?</a></p>
</div>
</div>
</div>
</footer>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script src="/kubernetes-operator/js/main.min.b0e99aac17991fa76812dd47914049168ac469a1faa0939560f0b370565becab.js" integrity="sha256-sOmarBeZH6doEt1HkUBJForEaaH6oJOVYPCzcFZb7Ks="></script>
</body>
</html>

166
docs/about/index.html Normal file
View File

@ -0,0 +1,166 @@
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="generator" content="Hugo 0.62.2" />
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<link rel="alternate" type="application/rss&#43;xml" href="https://jenkinsci.github.io/kubernetes-operator/about/index.xml">
<link rel="shortcut icon" href="/favicons/favicon.ico" >
<link rel="apple-touch-icon" href="/kubernetes-operator/favicons/apple-touch-icon-180x180.png" sizes="180x180">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-36x36.png" sizes="36x36">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-48x48.png" sizes="48x48">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-72x72.png" sizes="72x72">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-96x196.png" sizes="96x196">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-144x144.png" sizes="144x144">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-192x192.png"sizes="192x192">
<title>What&#39;s the Jenkins Operator? | Jenkins Operator</title><meta property="og:title" content="What&#39;s the Jenkins Operator?" />
<meta property="og:description" content="A native operator for Kubernetes to manage Jenkins" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://jenkinsci.github.io/kubernetes-operator/about/" />
<meta property="og:site_name" content="Jenkins Operator" />
<meta itemprop="name" content="What&#39;s the Jenkins Operator?">
<meta itemprop="description" content="A native operator for Kubernetes to manage Jenkins"><meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="What&#39;s the Jenkins Operator?"/>
<meta name="twitter:description" content="A native operator for Kubernetes to manage Jenkins"/>
<link rel="preload" href="/kubernetes-operator/scss/main.min.6c58fba96b88d035ce071c346f084a9dc4dedee4e80eb3724fe530520541a4ec.css" as="style">
<link href="/kubernetes-operator/scss/main.min.6c58fba96b88d035ce071c346f084a9dc4dedee4e80eb3724fe530520541a4ec.css" rel="stylesheet" integrity="">
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
</head>
<body class="td-section">
<header>
<nav class="js-navbar-scroll navbar navbar-expand navbar-dark flex-column flex-md-row td-navbar">
<a class="navbar-brand" href="/kubernetes-operator/">
<img style="width: 32px; height: 32px; margin-right: 7.5px;" src="/kubernetes-operator/img/logo.svg"></img><span class="text-uppercase font-weight-bold">Jenkins Operator</span>
</a>
<div class="td-navbar-nav-scroll ml-md-auto" id="main_navbar">
<ul class="navbar-nav mt-2 mt-lg-0">
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="/kubernetes-operator/about"><span>What's the Jenkins Operator?</span></a>
</li>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="/kubernetes-operator/docs"><span>Documentation</span></a>
</li>
</ul>
</div>
<div class="navbar-nav d-none d-lg-block">
<input type="search" class="form-control td-search-input" placeholder="&#xf002 Search this site…" aria-label="Search this site…" autocomplete="off">
</div>
</nav>
</header>
<div class="container-fluid td-default td-outer">
<main role="main" class="td-main">
<a id="td-block-0" class="td-offset-anchor"></a>
<section class="row td-box td-box--primary position-relative td-box--gradient td-box--height-auto">
<div class="container text-center td-arrow-down">
<span class="h4 mb-0">
<div style="font-size: 110%;" class="col-12">
Jenkins Operator is a Kubernetes native operator which fully manages Jenkins on Kubernetes. <br />It was built with immutability and declarative configuration as code in mind.
</div>
</span>
</div>
</section>
<a id="td-block-1" class="td-offset-anchor"></a>
<section class="row td-box td-box--1 td-box--gradient td-box--height-auto">
<div class="col">
<div class="row ">
<div class="col-md-1 order-md-1 hidden-xs hidden-sm hidden-md"></div>
<div class="col-md-3 col-lg-1 order-xs-first order-sm-first order-md-last text-center ">
<img src="/kubernetes-operator/img/logo.svg" style="height: 75%; margin-left: -75%; margin-top: 50%;" alt="Logo"/>
</div>
<div class="col-md-4 col-lg-8 order-xs-2 order-sm-2 order-md-2">
<h1>The main reason why we decided to develop the <b>Jenkins Operator</b> is the fact that we faced a lot of problems with standard Jenkins deployment. We want to make Jenkins more robust, suitable for dynamic and multi-tenant environments.</h1>
<p class="lead mt-2">
<br />
Some of the problems we want to solve:
<ul>
<li>Installing plugins with incompatible versions or security vulnerabilities</li>
<li>Better configuration as code</li>
<li>Lack of end to end tests</li>
<li>Handling graceful shutdown properly</li>
<li>Security and hardening out of the box</li>
<li>Orphaned jobs with no jnlp connection</li>
<li>Making errors more visible for end users</li>
</ul>
</p>
</div>
</div>
</div>
</section>
</main>
<footer class="bg-dark py-5 row d-print-none">
<div class="bg-dark container-fluid trademark-bigger">
<div class="row">
<div class="col-6 col-sm-4 text-xs-center order-sm-2">
</div>
<div class="col-6 col-sm-4 text-right text-xs-center order-sm-3">
</div>
<div class="col-12 col-sm-12 text-center py-4 order-sm-2">
<small class="text-white">&copy; 2021 Jenkins Operator is created by VirtusLab. Source is available under Apache License Version 2 and website content under Creative Commons Attribution-ShareAlike 4.0.</small><br>
<small class="text-white">Jenkins® is a registered trademark of Software in the Public Interest, Inc.</small>
<p class="mt-2"><a href="/kubernetes-operator/about/">What&#39;s the Jenkins Operator?</a></p>
</div>
</div>
</div>
</footer>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script src="/kubernetes-operator/js/main.min.b0e99aac17991fa76812dd47914049168ac469a1faa0939560f0b370565becab.js" integrity="sha256-sOmarBeZH6doEt1HkUBJForEaaH6oJOVYPCzcFZb7Ks="></script>
</body>
</html>

22
docs/about/index.xml Normal file
View File

@ -0,0 +1,22 @@
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Jenkins Operator What&#39;s the Jenkins Operator?</title>
<link>https://jenkinsci.github.io/kubernetes-operator/about/</link>
<description>Recent Hugo news from gohugo.io</description>
<generator>Hugo -- gohugo.io</generator>
<image>
<url>https://jenkinsci.github.io/kubernetes-operator/img/hugo.png</url>
<title>GoHugo.io</title>
<link>https://jenkinsci.github.io/kubernetes-operator/about/</link>
</image>
<atom:link href="https://jenkinsci.github.io/kubernetes-operator/about/index.xml" rel="self" type="application/rss+xml" />
</channel>
</rss>

View File

@ -0,0 +1,684 @@
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="generator" content="Hugo 0.62.2" />
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<link rel="shortcut icon" href="/favicons/favicon.ico" >
<link rel="apple-touch-icon" href="/kubernetes-operator/favicons/apple-touch-icon-180x180.png" sizes="180x180">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-36x36.png" sizes="36x36">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-48x48.png" sizes="48x48">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-72x72.png" sizes="72x72">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-96x196.png" sizes="96x196">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-144x144.png" sizes="144x144">
<link rel="icon" type="image/png" href="/kubernetes-operator/favicons/android-192x192.png"sizes="192x192">
<title>Another Great Release | Jenkins Operator</title><meta property="og:title" content="Another Great Release" />
<meta property="og:description" content="A short lead description about this content page. Text here can also be **bold** or _italic_ and can even be split over multiple paragraphs.
" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://jenkinsci.github.io/kubernetes-operator/blog/2018/01/04/another-great-release/" />
<meta property="article:published_time" content="2018-01-04T00:00:00+00:00" />
<meta property="article:modified_time" content="2018-01-04T00:00:00+00:00" /><meta property="og:site_name" content="Jenkins Operator" />
<meta itemprop="name" content="Another Great Release">
<meta itemprop="description" content="A short lead description about this content page. Text here can also be **bold** or _italic_ and can even be split over multiple paragraphs.
">
<meta itemprop="datePublished" content="2018-01-04T00:00:00&#43;00:00" />
<meta itemprop="dateModified" content="2018-01-04T00:00:00&#43;00:00" />
<meta itemprop="wordCount" content="1233">
<meta itemprop="keywords" content="" /><meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Another Great Release"/>
<meta name="twitter:description" content="A short lead description about this content page. Text here can also be **bold** or _italic_ and can even be split over multiple paragraphs.
"/>
<link rel="preload" href="/kubernetes-operator/scss/main.min.6c58fba96b88d035ce071c346f084a9dc4dedee4e80eb3724fe530520541a4ec.css" as="style">
<link href="/kubernetes-operator/scss/main.min.6c58fba96b88d035ce071c346f084a9dc4dedee4e80eb3724fe530520541a4ec.css" rel="stylesheet" integrity="">
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<title>Another Great Release | Jenkins Operator</title>
</head>
<body class="td-page td-blog">
<header>
<nav class="js-navbar-scroll navbar navbar-expand navbar-dark flex-column flex-md-row td-navbar">
<a class="navbar-brand" href="/kubernetes-operator/">
<img style="width: 32px; height: 32px; margin-right: 7.5px;" src="/kubernetes-operator/img/logo.svg"></img><span class="text-uppercase font-weight-bold">Jenkins Operator</span>
</a>
<div class="td-navbar-nav-scroll ml-md-auto" id="main_navbar">
<ul class="navbar-nav mt-2 mt-lg-0">
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="/kubernetes-operator/about"><span>What's the Jenkins Operator?</span></a>
</li>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a class="nav-link" href="/kubernetes-operator/docs"><span>Documentation</span></a>
</li>
</ul>
</div>
<div class="navbar-nav d-none d-lg-block">
<input type="search" class="form-control td-search-input" placeholder="&#xf002 Search this site…" aria-label="Search this site…" autocomplete="off">
</div>
</nav>
</header>
<div class="container-fluid td-outer">
<div class="td-main">
<div class="row flex-xl-nowrap">
<div class="col-12 col-md-3 col-xl-2 td-sidebar d-print-none">
<div id="td-sidebar-menu" class="td-sidebar__inner">
<form class="td-sidebar__search d-flex align-items-center">
<input type="search" class="form-control td-search-input" placeholder="&#xf002 Search this site…" aria-label="Search this site…" autocomplete="off">
<button class="btn btn-link td-sidebar__toggle d-md-none p-0 ml-3 fas fa-bars" type="button" data-toggle="collapse" data-target="#td-section-nav" aria-controls="td-docs-nav" aria-expanded="false" aria-label="Toggle section navigation">
</button>
</form>
<nav class="collapse td-sidebar-nav pt-2 pl-4" id="td-section-nav">
<ul class="td-sidebar-nav__section pr-md-3">
<li class="td-sidebar-nav__section-title">
<a href="/kubernetes-operator/blog/" class="align-left pl-0 pr-2 td-sidebar-link td-sidebar-link__section">Blog</a>
</li>
<ul>
<li class="collapse show" id="kubernetes-operator-blog">
<ul class="td-sidebar-nav__section pr-md-3">
<li class="td-sidebar-nav__section-title">
<a href="/kubernetes-operator/blog/news/" class="align-left pl-0 pr-2 collapsed td-sidebar-link td-sidebar-link__section">News</a>
</li>
<ul>
<li class="collapse " id="kubernetes-operator-blog-news">
<a class="td-sidebar-link td-sidebar-link__page " id="m-kubernetes-operator-blog-2018-10-06-easy-documentation-with-docsy" href="/kubernetes-operator/blog/2018/10/06/easy-documentation-with-docsy/">Announcing Docsy</a>
<a class="td-sidebar-link td-sidebar-link__page " id="m-kubernetes-operator-blog-2018-10-06-the-second-blog-post" href="/kubernetes-operator/blog/2018/10/06/the-second-blog-post/">Second blog post</a>
</li>
</ul>
</ul>
<ul class="td-sidebar-nav__section pr-md-3">
<li class="td-sidebar-nav__section-title">
<a href="/kubernetes-operator/blog/releases/" class="align-left pl-0 pr-2 active td-sidebar-link td-sidebar-link__section">Releases</a>
</li>
<ul>
<li class="collapse show" id="kubernetes-operator-blog-releases">
<a class="td-sidebar-link td-sidebar-link__page active" id="m-kubernetes-operator-blog-2018-01-04-another-great-release" href="/kubernetes-operator/blog/2018/01/04/another-great-release/">Release New Features</a>
</li>
</ul>
</ul>
</li>
</ul>
</ul>
</nav>
</div>
</div>
<div class="d-none d-xl-block col-xl-2 td-toc d-print-none">
<div class="td-page-meta ml-2 pb-1 pt-2 mb-0">
<a href="https://github.com/jenkinsci/kubernetes-operator/edit/master/website/content/en/blog/releases/in-depth-monoliths-detailed-spec.md" target="_blank"><i class="fa fa-edit fa-fw"></i> Edit this page</a>
<a href="https://github.com/jenkinsci/kubernetes-operator/issues/new?labels=documentation&amp;template=documentation.md&amp;title=Another%20Great%20Release" target="_blank"><i class="fab fa-github fa-fw"></i> Create documentation issue</a>
<a href="https://github.com/jenkinsci/kubernetes-operator/issues/new/choose" target="_blank"><i class="fas fa-tasks fa-fw"></i> Create project issue</a>
</div>
<nav id="TableOfContents">
<ul>
<li>
<ul>
<li><a href="#first-header">First Header</a></li>
<li><a href="#header-2">Header 2</a>
<ul>
<li><a href="#header-3">Header 3</a>
<ul>
<li><a href="#header-4">Header 4</a>
<ul>
<li><a href="#header-5">Header 5</a>
<ul>
<li><a href="#header-6">Header 6</a></li>
</ul></li>
</ul></li>
</ul></li>
</ul></li>
<li><a href="#components">Components</a>
<ul>
<li><a href="#alerts">Alerts</a></li>
</ul></li>
<li><a href="#sizing">Sizing</a>
<ul>
<li><a href="#parameters-available">Parameters available</a></li>
<li><a href="#using-pixels">Using pixels</a></li>
<li><a href="#using-rem">Using rem</a></li>
</ul></li>
<li><a href="#memory">Memory</a>
<ul>
<li><a href="#ram-to-use">RAM to use</a></li>
<li><a href="#more-is-better">More is better</a></li>
<li><a href="#used-ram">Used RAM</a></li>
</ul></li>
</ul></li>
</ul>
</nav>
</div>
<main class="col-12 col-md-9 col-xl-8 pl-md-5 pr-md-4" role="main">
<a class="btn btn-lg -bg-orange td-rss-button d-none d-lg-block" href="https://jenkinsci.github.io/kubernetes-operator/blog/releases/index.xml" target="_blank">
RSS <i class="fa fa-rss ml-2 "></i>
</a>
<div class="td-content">
<h1>Another Great Release</h1>
<div class="lead">A short lead description about this content page. Text here can also be <strong>bold</strong> or <em>italic</em> and can even be split over multiple paragraphs.</div>
<div class="td-byline mb-4">
<time datetime="2018-01-04" class="text-muted">Thursday, January 04, 2018</time>
</div>
<p>Text can be <strong>bold</strong>, <em>italic</em>, or <del>strikethrough</del>. <a href="https://github.com">Links</a> should be blue with no underlines (unless hovered over).</p>
<p>There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs.</p>
<p>There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs.</p>
<blockquote>
<p>There should be no margin above this first sentence.</p>
<p>Blockquotes should be a lighter gray with a border along the left side in the secondary color.</p>
<p>There should be no margin below this final sentence.</p>
</blockquote>
<h2 id="first-header">First Header</h2>
<p>This is a normal paragraph following a header. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.</p>
<p>Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.</p>
<p>On big screens, paragraphs and headings should not take up the full container width, but we want tables, code blocks and similar to take the full width.</p>
<p>Lorem markdownum tuta hospes stabat; idem saxum facit quaterque repetito
occumbere, oves novem gestit haerebat frena; qui. Respicit recurvam erat:
pignora hinc reppulit nos <strong>aut</strong>, aptos, ipsa.</p>
<p>Meae optatos <em>passa est</em> Epiros utiliter <em>Talibus niveis</em>, hoc lata, edidit.
Dixi ad aestum.</p>
<h2 id="header-2">Header 2</h2>
<blockquote>
<p>This is a blockquote following a header. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.</p>
</blockquote>
<h3 id="header-3">Header 3</h3>
<pre><code>This is a code block following a header.</code></pre>
<h4 id="header-4">Header 4</h4>
<ul>
<li>This is an unordered list following a header.</li>
<li>This is an unordered list following a header.</li>
<li>This is an unordered list following a header.</li>
</ul>
<h5 id="header-5">Header 5</h5>
<ol>
<li>This is an ordered list following a header.</li>
<li>This is an ordered list following a header.</li>
<li>This is an ordered list following a header.</li>
</ol>
<h6 id="header-6">Header 6</h6>
<table>
<thead>
<tr>
<th>What</th>
<th>Follows</th>
</tr>
</thead>
<tbody>
<tr>
<td>A table</td>
<td>A header</td>
</tr>
<tr>
<td>A table</td>
<td>A header</td>
</tr>
<tr>
<td>A table</td>
<td>A header</td>
</tr>
</tbody>
</table>
<hr />
<p>There&rsquo;s a horizontal rule above and below this.</p>
<hr />
<p>Here is an unordered list:</p>
<ul>
<li>Salt-n-Pepa</li>
<li>Bel Biv DeVoe</li>
<li>Kid &lsquo;N Play</li>
</ul>
<p>And an ordered list:</p>
<ol>
<li>Michael Jackson</li>
<li>Michael Bolton</li>
<li>Michael Bublé</li>
</ol>
<p>And an unordered task list:</p>
<ul class="task-list">
<li><label><input type="checkbox" checked disabled class="task-list-item"> Create a sample markdown document</label></li>
<li><label><input type="checkbox" checked disabled class="task-list-item"> Add task lists to it</label></li>
<li><label><input type="checkbox" disabled class="task-list-item"> Take a vacation</label></li>
</ul>
<p>And a &ldquo;mixed&rdquo; task list:</p>
<ul class="task-list">
<li><label><input type="checkbox" disabled class="task-list-item"> Steal underpants</label></li>
<li>?</li>
<li><label><input type="checkbox" disabled class="task-list-item"> Profit!</label></li>
</ul>
<p>And a nested list:</p>
<ul>
<li>Jackson 5
<ul>
<li>Michael</li>
<li>Tito</li>
<li>Jackie</li>
<li>Marlon</li>
<li>Jermaine</li>
</ul></li>
<li>TMNT
<ul>
<li>Leonardo</li>
<li>Michelangelo</li>
<li>Donatello</li>
<li>Raphael</li>
</ul></li>
</ul>
<p>Definition lists can be used with Markdown syntax. Definition terms are bold.</p>
<dl>
<dt>Name</dt>
<dd>Godzilla</dd>
<dt>Born</dt>
<dd>1952</dd>
<dt>Birthplace</dt>
<dd>Japan</dd>
<dt>Color</dt>
<dd>Green</dd>
</dl>
<hr />
<p>Tables should have bold headings and alternating shaded rows.</p>
<table>
<thead>
<tr>
<th>Artist</th>
<th>Album</th>
<th>Year</th>
</tr>
</thead>
<tbody>
<tr>
<td>Michael Jackson</td>
<td>Thriller</td>
<td>1982</td>
</tr>
<tr>
<td>Prince</td>
<td>Purple Rain</td>
<td>1984</td>
</tr>
<tr>
<td>Beastie Boys</td>
<td>License to Ill</td>
<td>1986</td>
</tr>
</tbody>
</table>
<p>If a table is too wide, it should scroll horizontally.</p>
<table>
<thead>
<tr>
<th>Artist</th>
<th>Album</th>
<th>Year</th>
<th>Label</th>
<th>Awards</th>
<th>Songs</th>
</tr>
</thead>
<tbody>
<tr>
<td>Michael Jackson</td>
<td>Thriller</td>
<td>1982</td>
<td>Epic Records</td>
<td>Grammy Award for Album of the Year, American Music Award for Favorite Pop/Rock Album, American Music Award for Favorite Soul/R&amp;B Album, Brit Award for Best Selling Album, Grammy Award for Best Engineered Album, Non-Classical</td>
<td>Wanna Be Startin&rsquo; Somethin&rsquo;, Baby Be Mine, The Girl Is Mine, Thriller, Beat It, Billie Jean, Human Nature, P.Y.T. (Pretty Young Thing), The Lady in My Life</td>
</tr>
<tr>
<td>Prince</td>
<td>Purple Rain</td>
<td>1984</td>
<td>Warner Brothers Records</td>
<td>Grammy Award for Best Score Soundtrack for Visual Media, American Music Award for Favorite Pop/Rock Album, American Music Award for Favorite Soul/R&amp;B Album, Brit Award for Best Soundtrack/Cast Recording, Grammy Award for Best Rock Performance by a Duo or Group with Vocal</td>
<td>Let&rsquo;s Go Crazy, Take Me With U, The Beautiful Ones, Computer Blue, Darling Nikki, When Doves Cry, I Would Die 4 U, Baby I&rsquo;m a Star, Purple Rain</td>
</tr>
<tr>
<td>Beastie Boys</td>
<td>License to Ill</td>
<td>1986</td>
<td>Mercury Records</td>
<td>noawardsbutthistablecelliswide</td>
<td>Rhymin &amp; Stealin, The New Style, She&rsquo;s Crafty, Posse in Effect, Slow Ride, Girls, (You Gotta) Fight for Your Right, No Sleep Till Brooklyn, Paul Revere, Hold It Now, Hit It, Brass Monkey, Slow and Low, Time to Get Ill</td>
</tr>
</tbody>
</table>
<hr />
<p>Code snippets like <code>var foo = &quot;bar&quot;;</code> can be shown inline.</p>
<p>Also, <code>this should vertically align</code> <del><code>with this</code></del> <del>and this</del>.</p>
<p>Code can also be shown in a block element.</p>
<pre><code>foo := "bar";
bar := "foo";</code></pre>
<p>Code can also use syntax highlighting.</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-go" data-lang="go"><span style="color:#204a87;font-weight:bold">func</span> <span style="color:#000">main</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000;font-weight:bold">)</span> <span style="color:#000;font-weight:bold">{</span>
<span style="color:#000">input</span> <span style="color:#ce5c00;font-weight:bold">:=</span> <span style="color:#4e9a06">`</span><span style="color:#4e9a06">var foo = &#34;bar&#34;;</span><span style="color:#4e9a06">`</span>
<span style="color:#000">lexer</span> <span style="color:#ce5c00;font-weight:bold">:=</span> <span style="color:#000">lexers</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Get</span><span style="color:#000;font-weight:bold">(</span><span style="color:#4e9a06">&#34;javascript&#34;</span><span style="color:#000;font-weight:bold">)</span>
<span style="color:#000">iterator</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">_</span> <span style="color:#ce5c00;font-weight:bold">:=</span> <span style="color:#000">lexer</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Tokenise</span><span style="color:#000;font-weight:bold">(</span><span style="color:#204a87;font-weight:bold">nil</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">input</span><span style="color:#000;font-weight:bold">)</span>
<span style="color:#000">style</span> <span style="color:#ce5c00;font-weight:bold">:=</span> <span style="color:#000">styles</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Get</span><span style="color:#000;font-weight:bold">(</span><span style="color:#4e9a06">&#34;github&#34;</span><span style="color:#000;font-weight:bold">)</span>
<span style="color:#000">formatter</span> <span style="color:#ce5c00;font-weight:bold">:=</span> <span style="color:#000">html</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">New</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000">html</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">WithLineNumbers</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000;font-weight:bold">)</span><span style="color:#000;font-weight:bold">)</span>
<span style="color:#204a87;font-weight:bold">var</span> <span style="color:#000">buff</span> <span style="color:#000">bytes</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Buffer</span>
<span style="color:#000">formatter</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Format</span><span style="color:#000;font-weight:bold">(</span><span style="color:#ce5c00;font-weight:bold">&amp;</span><span style="color:#000">buff</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">style</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">iterator</span><span style="color:#000;font-weight:bold">)</span>
<span style="color:#000">fmt</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Println</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000">buff</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">String</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000;font-weight:bold">)</span><span style="color:#000;font-weight:bold">)</span>
<span style="color:#000;font-weight:bold">}</span></code></pre></div><pre><code>Long, single-line code blocks should not wrap. They should horizontally scroll if they are too long. This line should be long enough to demonstrate this.</code></pre>
<p>Inline code inside table cells should still be distinguishable.</p>
<table>
<thead>
<tr>
<th>Language</th>
<th>Code</th>
</tr>
</thead>
<tbody>
<tr>
<td>Javascript</td>
<td><code>var foo = &quot;bar&quot;;</code></td>
</tr>
<tr>
<td>Ruby</td>
<td><code>foo = &quot;bar&quot;{</code></td>
</tr>
</tbody>
</table>
<hr />
<p>Small images should be shown at their actual size.</p>
<p><img src="http://placekitten.com/g/300/200/" alt="" /></p>
<p>Large images should always scale down and fit in the content container.</p>
<p><img src="http://placekitten.com/g/1200/800/" alt="" /></p>
<h2 id="components">Components</h2>
<h3 id="alerts">Alerts</h3>
<p>
<div class="alert alert-primary" role="alert">
This is an alert.
</div>
<div class="alert alert-primary" role="alert">
<h4 class="alert-heading">Note:</h4>
This is an alert with a title.
</div>
<div class="alert alert-primary" role="alert">
This is a successful alert.
</div>
<div class="alert alert-primary" role="alert">
This is a warning!
</div>
<div class="alert alert-primary" role="alert">
<h4 class="alert-heading">Warning!</h4>
This is a warning with a title!
</div>
</p>
<h2 id="sizing">Sizing</h2>
<p>Add some sections here to see how the ToC looks like. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.</p>
<h3 id="parameters-available">Parameters available</h3>
<p>Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.</p>
<h3 id="using-pixels">Using pixels</h3>
<p>Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.</p>
<h3 id="using-rem">Using rem</h3>
<p>Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.</p>
<h2 id="memory">Memory</h2>
<p>Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.</p>
<h3 id="ram-to-use">RAM to use</h3>
<p>Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.</p>
<h3 id="more-is-better">More is better</h3>
<p>Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.</p>
<h3 id="used-ram">Used RAM</h3>
<p>Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.</p>
<pre><code>This is the final element on the page and there should be no margin below this.</code></pre>
<ul class="list-unstyled d-flex justify-content-between align-items-center mb-0 pt-5">
<li>
<a class="btn btn-primary disabled"><span class="mr-1"></span> Previous</a>
</li>
<a class="btn btn-primary disabled">Next <span class="ml-1"></span></a>
</li>
</ul>
</div>
</main>
</div>
</div>
<footer class="bg-dark py-5 row d-print-none">
<div class="bg-dark container-fluid trademark-bigger">
<div class="row">
<div class="col-6 col-sm-4 text-xs-center order-sm-2">
</div>
<div class="col-6 col-sm-4 text-right text-xs-center order-sm-3">
</div>
<div class="col-12 col-sm-12 text-center py-4 order-sm-2">
<small class="text-white">&copy; 2021 Jenkins Operator is created by VirtusLab. Source is available under Apache License Version 2 and website content under Creative Commons Attribution-ShareAlike 4.0.</small><br>
<small class="text-white">Jenkins® is a registered trademark of Software in the Public Interest, Inc.</small>
<p class="mt-2"><a href="/kubernetes-operator/about/">What&#39;s the Jenkins Operator?</a></p>
</div>
</div>
</div>
</footer>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script src="/kubernetes-operator/js/main.min.b0e99aac17991fa76812dd47914049168ac469a1faa0939560f0b370565becab.js" integrity="sha256-sOmarBeZH6doEt1HkUBJForEaaH6oJOVYPCzcFZb7Ks="></script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 KiB

Some files were not shown because too many files have changed in this diff Show More