├── .github ├── dependabot.yml ├── release-drafter.yml └── workflows │ ├── build-and-publish.yaml │ ├── differential-shellcheck.yaml │ ├── release-drafter.yaml │ └── simple-test.yaml ├── .gitignore ├── .pre-commit-config.yaml ├── Containerfile ├── LICENSE ├── README.md ├── examples ├── artifact-caching-proxy │ ├── README.md │ └── artifact-caching-proxy-values.yaml ├── catalog-version-explained │ └── README.md ├── custom-plugins-tags │ └── README.md ├── exec-hooks │ ├── push-to-artifactory.sh │ ├── push-to-remote-repo.sh │ ├── use-nginx-proxy-cache.sh │ └── use-official-url-to-do-something-instead-of-downloading.sh ├── integrate-with-pre-commit │ └── README.md ├── plugins-controller.yaml ├── plugins-oc.yaml ├── the-src-tag │ └── README.md ├── workflow-generating-effective-bundles │ ├── .gitignore │ ├── README.md │ └── raw-bundles-original │ │ ├── base │ │ ├── bundle.yaml │ │ ├── items.yaml │ │ ├── jenkins.yaml │ │ ├── plugins.yaml │ │ └── variables.yaml │ │ ├── bundle-a │ │ ├── bundle.yaml │ │ ├── items.yaml │ │ ├── jenkins.yaml │ │ ├── plugins.yaml │ │ └── variables.yaml │ │ ├── controller-a │ │ ├── bundle.yaml │ │ ├── items.yaml │ │ ├── jenkins.yaml │ │ ├── plugins.yaml │ │ └── variables.yaml │ │ └── controller-c │ │ ├── bundle.yaml │ │ ├── items.yaml │ │ ├── jenkins.yaml │ │ ├── plugins.yaml │ │ └── variables.yaml └── workflow-standard-steps │ ├── README.md │ └── files │ ├── bundles │ ├── bundle-v2.387.3.5-add │ │ ├── plugin-catalog.yaml │ │ └── plugins.yaml │ ├── bundle-v2.387.3.5-remove │ │ ├── plugin-catalog.yaml │ │ └── plugins.yaml │ ├── bundle-v2.387.3.5 │ │ ├── plugin-catalog.yaml │ │ └── plugins.yaml │ ├── bundle-v2.414.1.4-add │ │ ├── plugin-catalog.yaml │ │ └── plugins.yaml │ └── bundle-v2.414.1.4 │ │ ├── plugin-catalog.yaml │ │ └── plugins.yaml │ ├── plugins-minimal.yaml │ ├── plugins-raw.yaml │ └── plugins-starter.yaml ├── run.sh ├── tests ├── README.md ├── complex │ ├── command.sh │ ├── expected │ │ ├── plugin-catalog-offline.yaml │ │ ├── plugin-catalog.yaml │ │ ├── plugins-minimal-for-generation-only.yaml │ │ ├── plugins-minimal.yaml │ │ └── plugins.yaml │ └── source-plugins.yaml ├── multi-files │ ├── command.sh │ ├── expected │ │ ├── plugin-catalog-offline.yaml │ │ ├── plugin-catalog.yaml │ │ ├── plugins-minimal-for-generation-only.yaml │ │ ├── plugins-minimal.yaml │ │ └── plugins.yaml │ ├── source-plugins-additional.yaml │ └── source-plugins-core.yaml ├── run.sh ├── simple-annotations-override │ ├── command.sh │ ├── expected │ │ ├── plugin-catalog-offline.yaml │ │ ├── plugin-catalog.yaml │ │ ├── plugins-minimal-for-generation-only.yaml │ │ ├── plugins-minimal.yaml │ │ └── plugins.yaml │ ├── source-plugins-v2.yaml │ └── source-plugins.yaml ├── simple-annotations │ ├── command.sh │ ├── expected │ │ ├── plugin-catalog-offline.yaml │ │ ├── plugin-catalog.yaml │ │ ├── plugins-minimal-for-generation-only.yaml │ │ ├── plugins-minimal.yaml │ │ └── plugins.yaml │ └── source-plugins.yaml ├── simple-download │ ├── command.sh │ ├── expected │ │ ├── plugin-catalog-offline.yaml │ │ ├── plugin-catalog.yaml │ │ ├── plugins-minimal-for-generation-only.yaml │ │ ├── plugins-minimal.yaml │ │ └── plugins.yaml │ └── source-plugins.yaml ├── simple-generation-only │ ├── command.sh │ ├── expected │ │ ├── plugin-catalog-offline.yaml │ │ ├── plugin-catalog.yaml │ │ ├── plugins-minimal-for-generation-only.yaml │ │ ├── plugins-minimal.yaml │ │ └── plugins.yaml │ └── source-plugins.yaml ├── simple-sha │ ├── command.sh │ ├── expected │ │ ├── plugin-catalog-offline.yaml │ │ ├── plugin-catalog.yaml │ │ ├── plugins-minimal-for-generation-only.yaml │ │ ├── plugins-minimal.yaml │ │ └── plugins.yaml │ └── source-plugins.yaml └── simple │ ├── command.sh │ ├── expected │ ├── plugin-catalog-offline.yaml │ ├── plugin-catalog.yaml │ ├── plugins-minimal-for-generation-only.yaml │ ├── plugins-minimal.yaml │ └── plugins.yaml │ └── source-plugins.yaml ├── utils └── generate-effective-bundles.sh └── version-check.sh /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | # Check for updates to GitHub Actions every week 7 | interval: "weekly" 8 | -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name-template: 'v$RESOLVED_VERSION' 2 | tag-template: 'v$RESOLVED_VERSION' 3 | categories: 4 | - title: '🚀 Features' 5 | labels: 6 | - 'feature' 7 | - 'enhancement' 8 | - title: '🐛 Bug Fixes' 9 | labels: 10 | - 'fix' 11 | - 'bugfix' 12 | - 'bug' 13 | - title: '🧰 Maintenance' 14 | label: 'chore' 15 | change-template: '- $TITLE @$AUTHOR (#$NUMBER)' 16 | change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. 17 | version-resolver: 18 | major: 19 | labels: 20 | - 'major' 21 | minor: 22 | labels: 23 | - 'minor' 24 | patch: 25 | labels: 26 | - 'patch' 27 | default: patch 28 | template: | 29 | ## Changes 30 | 31 | $CHANGES -------------------------------------------------------------------------------- /.github/workflows/build-and-publish.yaml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | 6 | # GitHub recommends pinning actions to a commit SHA. 7 | # To get a newer version, you will need to update the SHA. 8 | # You can also reference a tag or branch, but the action may change without warning. 9 | 10 | name: Create and publish a Docker image 11 | 12 | on: 13 | workflow_dispatch: 14 | release: 15 | types: [published] 16 | env: 17 | REGISTRY: ghcr.io 18 | IMAGE_NAME: ${{ github.repository }} 19 | 20 | jobs: 21 | build-and-push-image: 22 | runs-on: ubuntu-latest 23 | permissions: 24 | contents: read 25 | packages: write 26 | 27 | steps: 28 | - name: Checkout repository 29 | uses: actions/checkout@v4 30 | 31 | - 32 | name: Set up Docker Buildx 33 | uses: docker/setup-buildx-action@v3 34 | 35 | - name: Log in to the Container registry 36 | uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 37 | with: 38 | registry: ${{ env.REGISTRY }} 39 | username: ${{ github.actor }} 40 | password: ${{ secrets.GITHUB_TOKEN }} 41 | 42 | - name: Extract metadata (tags, labels) for Docker 43 | id: meta 44 | uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 45 | with: 46 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} 47 | 48 | - name: Build and push Docker image 49 | uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 50 | with: 51 | context: . 52 | file: Containerfile 53 | push: true 54 | tags: ${{ steps.meta.outputs.tags }} 55 | labels: ${{ steps.meta.outputs.labels }} 56 | -------------------------------------------------------------------------------- /.github/workflows/differential-shellcheck.yaml: -------------------------------------------------------------------------------- 1 | name: Differential ShellCheck 2 | on: 3 | push: 4 | branches: [ master ] 5 | pull_request: 6 | branches: [ master ] 7 | 8 | permissions: 9 | contents: read 10 | 11 | jobs: 12 | lint: 13 | runs-on: ubuntu-latest 14 | 15 | permissions: 16 | # required for all workflows 17 | security-events: write 18 | 19 | # only required for workflows in private repositories 20 | actions: read 21 | contents: read 22 | 23 | steps: 24 | - name: Repository checkout 25 | uses: actions/checkout@v4 26 | with: 27 | fetch-depth: 0 28 | 29 | - id: ShellCheck 30 | name: Differential ShellCheck 31 | uses: redhat-plumbers-in-action/differential-shellcheck@v5 32 | with: 33 | token: ${{ secrets.GITHUB_TOKEN }} 34 | -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yaml: -------------------------------------------------------------------------------- 1 | name: Release Drafter 2 | 3 | on: 4 | push: 5 | # branches to consider in the event; optional, defaults to all 6 | branches: 7 | - master 8 | - main 9 | # pull_request event is required only for autolabeler 10 | pull_request: 11 | # Only following types are handled by the action, but one can default to all as well 12 | types: [opened, reopened, synchronize] 13 | # pull_request_target event is required for autolabeler to support PRs from forks 14 | # pull_request_target: 15 | # types: [opened, reopened, synchronize] 16 | 17 | permissions: 18 | contents: read 19 | 20 | jobs: 21 | update_release_draft: 22 | permissions: 23 | # write permission is required to create a github release 24 | contents: write 25 | # write permission is required for autolabeler 26 | # otherwise, read permission is required at least 27 | pull-requests: write 28 | runs-on: ubuntu-latest 29 | steps: 30 | # (Optional) GitHub Enterprise requires GHE_HOST variable set 31 | #- name: Set GHE_HOST 32 | # run: | 33 | # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV 34 | 35 | # Drafts your next Release notes as Pull Requests are merged into "master" 36 | - uses: release-drafter/release-drafter@v6 37 | # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml 38 | # with: 39 | # config-name: my-config.yml 40 | # disable-autolabeler: true 41 | with: 42 | commitish: master 43 | env: 44 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/simple-test.yaml: -------------------------------------------------------------------------------- 1 | name: Test the plugin dependency script 2 | run-name: ${{ github.actor }} is testing the script 🚀 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - master 8 | paths: 9 | - 'tests' 10 | - 'utils' 11 | - 'run.sh' 12 | pull_request: 13 | branches: 14 | - master 15 | paths: 16 | - 'tests' 17 | - 'utils' 18 | - 'run.sh' 19 | env: 20 | TEST_TAG: local:test 21 | jobs: 22 | Simple-Test: 23 | runs-on: ubuntu-latest 24 | steps: 25 | - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." 26 | - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" 27 | - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." 28 | - 29 | name: Check out repository code 30 | uses: actions/checkout@v4 31 | - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." 32 | - run: echo "🖥️ The workflow is now ready to test your code on the runner." 33 | - 34 | name: Set up Docker Buildx 35 | uses: docker/setup-buildx-action@v3 36 | - 37 | name: Build Docker image 38 | uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 39 | with: 40 | context: . 41 | file: Containerfile 42 | load: true 43 | tags: ${{ env.TEST_TAG }} 44 | - 45 | name: Run tests 46 | run: docker run -u$(id -u):$(id -g) --rm -v $(pwd):$(pwd) -w $(pwd) ${{ env.TEST_TAG }} ./tests/run.sh 47 | - run: echo "🍏 This job's status is ${{ job.status }}." 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .cache 2 | jenkins.war 3 | cb-*.war 4 | jenkins-plugin-manager.jar 5 | ./plugins.yaml 6 | ./plugin-catalog.yaml 7 | update-center.json 8 | target 9 | test-resources 10 | 11 | # used in the tests 12 | **/actual/*.yaml 13 | 14 | **/effective-bundles -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/thlorenz/doctoc 3 | rev: v2.2.0 4 | hooks: 5 | - id: doctoc 6 | args: 7 | - -u 8 | - repo: https://github.com/koalaman/shellcheck-precommit 9 | rev: v0.9.0 10 | hooks: 11 | - id: shellcheck 12 | # args: ["--severity=warning"] # Optionally only show errors and warnings -------------------------------------------------------------------------------- /Containerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | 3 | # tools 4 | ENV YQ_VERSION=v4.40.2 \ 5 | JQ_VERSION=jq-1.7 \ 6 | KUSTOMIZE_VERSION=v5.2.1 \ 7 | ARCH=amd64 8 | 9 | # utils and non-root user 10 | RUN apk add --update --no-cache \ 11 | bash \ 12 | tree \ 13 | curl \ 14 | findutils \ 15 | git \ 16 | zip \ 17 | make \ 18 | && addgroup -S -g 1000 casc-user && adduser -S -u 1000 casc-user -G casc-user -s /bin/bash \ 19 | && mkdir -p /home/casc-user/bin && chown -R casc-user:casc-user /home/casc-user/bin 20 | 21 | # kustomize and tools 22 | RUN curl -sLO https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_${ARCH}.tar.gz && \ 23 | tar xvzf kustomize_${KUSTOMIZE_VERSION}_linux_${ARCH}.tar.gz && \ 24 | mv kustomize /usr/bin/kustomize && \ 25 | chmod +x /usr/bin/kustomize && \ 26 | rm kustomize_${KUSTOMIZE_VERSION}_linux_${ARCH}.tar.gz 27 | ADD --chmod=655 https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 /usr/bin/yq 28 | ADD --chmod=655 https://github.com/jqlang/jq/releases/download/${JQ_VERSION}/jq-linux-amd64 /usr/bin/jq 29 | 30 | # environment stuff 31 | WORKDIR /home/casc-user 32 | ENV CACHE_DIR=/tmp/pimt-cache \ 33 | CACHE_BASE_DIR=/tmp/casc-plugin-dependency-calculation-cache \ 34 | TARGET_BASE_DIR=/tmp/casc-plugin-dependency-calculation-target \ 35 | PATH="/home/casc-user/bin:$PATH" 36 | 37 | # scripts 38 | COPY run.sh /usr/local/bin/cascdeps 39 | COPY utils/generate-effective-bundles.sh /usr/local/bin/cascgen 40 | 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Kenny Younger 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CloudBees CasC Plugin Catalog and Transitive Dependencies Calculator 2 | 3 | 4 | 5 | ## Contents 6 | 7 | - [Intro](#intro) 8 | - [General Features](#general-features) 9 | - [Requirements](#requirements) 10 | - [Usage](#usage) 11 | - [Using the docker image](#using-the-docker-image) 12 | - [Using locally](#using-locally) 13 | - [Local Development](#local-development) 14 | - [NEW: Effective Bundle Management](#new-effective-bundle-management) 15 | - [Source Plugin Management](#source-plugin-management) 16 | - [Additional Plugin Metadata](#additional-plugin-metadata) 17 | - [File header](#file-header) 18 | - [Unnecessary Plugins Check](#unnecessary-plugins-check) 19 | - [Tests](#tests) 20 | - [Examples](#examples) 21 | 22 | 23 | 24 | ## Intro 25 | 26 | Give this script a path to a `plugins.yaml` file in a bundle with all plugins you want installed (any tier), and it will: 27 | 28 | 1. Generate the `plugin-catalog.yaml` file for you including all versions and transitive dependencies. 29 | 2. Generate variations of the `plugins.yaml` file you originally specifed with any additional transitive dependencies. 30 | 3. Allow you to specify where you want the resulting files to go. 31 | 32 | This means that as long as you are willing to use the plugin versions in the CloudBees Update Centers (which you should be doing), then all you ever need to do is add plugins to the `plugins.yaml` file and this script will handle the rest. No more manually crafting plugin catalogs! 33 | 34 | ### General Features 35 | 36 | - **minimal plugin list** - create a minimal viable list of plugins based on a starting list. See `-s` for more details. 37 | - **multiple CBCI versions** - create a master plugin catalog for multiple CBCI versions 38 | - **multiple source files** - create a master plugin catalog from multiple source files 39 | - **metadata** - option to include metadata as a comment in the `plugins.yaml` 40 | - **final target locations** - option to set specific target locations for final files 41 | - **bootstrap or optional plugins** - improved plugin dependency management for more accurate `plugins.yaml` 42 | - include optional dependencies per flag 43 | - include bootstrap dependencies per flag 44 | - **exec hooks** - ability to run `exec-hooks` for plugin post-processing 45 | - ability to create air-gapped `plugin-catalog-offline.yaml` files 46 | - **simple cache** - rudimentary plugin-cache for holding plugins without an artifact repository manager 47 | 48 | ## Requirements 49 | 50 | Use the docker image provided, or 51 | 52 | - jq (tested with `v1.6` and `v1.7`) 53 | - yq (tested with `v4.35.2`and `v4.40.2`) 54 | - curl 55 | 56 | ## Usage 57 | 58 | The tool can be used either locally or using the docker image. 59 | 60 | ### Using the docker image 61 | 62 | Within the directory of your choice... 63 | 64 | ...use as one-shot container with: 65 | 66 | ```sh 67 | docker run -v $(pwd):$(pwd) -w $(pwd) -u $(id -u):$(id -g) --rm -it ghcr.io/kyounger/casc-plugin-dependency-calculation bash 68 | ``` 69 | 70 | ...use as a long-lived container to stop and start with: 71 | 72 | ```sh 73 | docker run -v $(pwd):$(pwd) -w $(pwd) -u $(id -u):$(id -g) -d ghcr.io/kyounger/casc-plugin-dependency-calculation tail -f /dev/null 74 | 75 | ``` 76 | 77 | Whereby... 78 | 79 | ```mono 80 | -v $(pwd):$(pwd) # mount your current directory 81 | -w $(pwd) # use your current directory as the working directory 82 | -u $(id -u):$(id -g) # use your own user 83 | ``` 84 | 85 | ### Using locally 86 | 87 | Ensuring you meet the requirements above. 88 | 89 | The docker image provides two commands 90 | 91 | - `cascdeps` which is equal to the main `run.sh` at the root of this repository 92 | - `cascgen` which is equal to the `utils/generate-effective-bundles.sh` util script 93 | 94 | If you wish to have the same thing when running locally, simply add a couple of symlinks, e.g. 95 | 96 | ```sh 97 | ❯ ls -l $(which cascdeps) 98 | lrwxrwxrwx 1 fred fred 79 Nov 13 21:04 /home/fred/bin/cascdeps -> /path/to/casc-plugin-dependency-calculation/run.sh 99 | ❯ ls -l $(which cascgen) 100 | lrwxrwxrwx 1 fred fred 108 Nov 13 22:45 /home/fred/bin/cascgen -> /path/to/casc-plugin-dependency-calculation/utils/generate-effective-bundles.sh 101 | ``` 102 | 103 | ### Local Development 104 | 105 | Building your own image: 106 | 107 | ```sh 108 | docker build -t casc-plugin-dependency-calculation:dev -f Containerfile . 109 | ``` 110 | 111 | Then using it, for example, to run tests before pushing commits: 112 | 113 | ```sh 114 | docker run -v $(pwd):$(pwd) -w $(pwd) -u $(id -u):$(id -g) --rm -it casc-plugin-dependency-calculation:dev ./tests/run.sh simple 115 | ``` 116 | 117 | ## NEW: Effective Bundle Management 118 | 119 | The plugin dependency management has now been integrated with a new [generate-effective-bundles.sh](./utils/generate-effective-bundles.sh) script. 120 | 121 | See the example page [generating effective bundles](./examples/workflow-generating-effective-bundles/README.md) for more details. 122 | 123 | ## Source Plugin Management 124 | 125 | A better way of managing plugin lists has been added. See the [Standard Workflow](examples/workflow-standard-steps/README.md) for more details 126 | 127 | ## Additional Plugin Metadata 128 | 129 | This tool now provides metadata to the `plugins.yaml` giving more context to the included plugins. 130 | 131 | Metadata is added in the form of comments behind the plugin. 132 | 133 | ### File header 134 | 135 | The file now comes with a header describing the categories. 136 | 137 | ```yaml 138 | ❯ yq target/2.375.1.1/mm/my-plugins.yaml 139 | # This file is automatically generated - please do not edit manually. 140 | 141 | # Annotations: 142 | # tag:custom:version=... - sets a custom version 143 | # tag:custom:url=... - sets a custom url 144 | # tag:custom:requires=... - specifies any required dependencies 145 | 146 | # Plugin Categories: 147 | # cap - is this a CAP plugin? 148 | # 3rd - is this a 3rd party plugin? 149 | # old - is this a deprecated plugin? 150 | # cve - are there open security issues? 151 | # bst - installed by default 152 | # dep - installed as dependency 153 | # src - used as a source plugin for this list 154 | plugins 155 | ``` 156 | 157 | ## Unnecessary Plugins Check 158 | 159 | The script will check for superfluous plugins which are already installed by another plugin in the list. 160 | 161 | :warning: You still need to decide whether your situation requires the plugin explicitly. Do not simple remove plugins blindly. 162 | 163 | The log will look something like this: 164 | 165 | ```text 166 | INFO: CANDIDATES FOR REMOVAL: candidates found... 167 | INFO: ============================================================== 168 | INFO: !!! Candidates for potential removal from the plugins.yaml !!! 169 | INFO: ============================================================== 170 | INFO: The following plugins are either bootstrap or dependencies of CAP plugins: cloudbees-casc-items-api cloudbees-casc-items-commons favorite git git-client github github-api github-branch-source htmlpublisher mailer 171 | INFO: For more details run: p=; grep -E ".* -> $p($| )" "/home/sboardwell/Workspace/sboardwell/casc-plugin-dependency-calculation/target/2.387.3.5/mm/generated/deps-processed-tree-single.txt" 172 | INFO: cloudbees-casc-items-api: provided by cloudbees-casc-client cloudbees-casc-items-controller 173 | INFO: cloudbees-casc-items-commons: provided by cloudbees-casc-items-controller 174 | INFO: favorite: provided by blueocean 175 | INFO: git: provided by blueocean blueocean-git-pipeline 176 | INFO: git-client: provided by blueocean 177 | INFO: github: provided by blueocean 178 | INFO: github-api: provided by blueocean 179 | INFO: github-branch-source: provided by blueocean 180 | INFO: htmlpublisher: provided by blueocean 181 | INFO: mailer: is a bootstrap plugin 182 | ``` 183 | 184 | The command given given for more detail looks like: 185 | 186 | ```text 187 | ❯ p=aws-credentials; grep -E ".* -> $p($| )" "target/2.401.2.3/mm/generated/deps-processed-tree-single.txt" 188 | infradna-backup -> aws-credentials -> aws-java-sdk-ec2 -> aws-java-sdk-minimal -> apache-httpcomponents-client-4-api 189 | infradna-backup -> aws-credentials -> aws-java-sdk-ec2 -> aws-java-sdk-minimal -> jackson2-api -> javax-activation-api 190 | infradna-backup -> aws-credentials -> aws-java-sdk-ec2 -> aws-java-sdk-minimal -> jackson2-api -> jaxb -> javax-activation-api 191 | ... 192 | ... 193 | ``` 194 | 195 | ## Tests 196 | 197 | Please see the [tests page](./tests/README.md) for details on how to run and create tests. 198 | 199 | ## Examples 200 | 201 | Please see the [examples directory](./examples/) for more examples. 202 | 203 | A single run with the plugins.yaml file in the same directory as `run.sh`. This creates `plugin-catalog.yaml`: 204 | 205 | `./run.sh -v 2.263.4.2` 206 | 207 | A single run with a specified path to plugins.yaml file, but using the `-x` option to turn on the "inplace update". This will overwrite the `plugins.yaml` and `plugin-catalog.yaml` files. 208 | 209 | `./run.sh -v 2.263.4.2 -f /path/to/plugins.yaml` 210 | 211 | Multiple runs taking advantage of caching and generating multiple different `plugin-catalogs.yaml` and updating their corresponding `plugins.yaml`: 212 | 213 | ``` bash 214 | ./run.sh -v 2.263.1.2 -f /bundle1/plugins.yaml 215 | ./run.sh -v 2.263.4.2 -f /bundle2/plugins.yaml 216 | ./run.sh -v 2.263.4.2 -f /bundle3/plugins.yaml 217 | ./run.sh -v 2.277.1.2 -f /bundle4/plugins.yaml 218 | ``` 219 | -------------------------------------------------------------------------------- /examples/artifact-caching-proxy/README.md: -------------------------------------------------------------------------------- 1 | # Artifact Caching Proxy for 3rd Party Plugins 2 | 3 | We will: 4 | 5 | - create the `artifact-caching-proxy` nginx server 6 | - test the connection 7 | 8 | ## Install `artifact-caching-proxy` 9 | 10 | Now you have the values in place you can install the chart with: 11 | 12 | ```mono 13 | helm upgrade --install my-artifact-caching-proxy --values artifact-caching-proxy-values.yaml jenkins-infra/artifact-caching-proxy --version 0.16.1 14 | ``` 15 | 16 | ## Prime the cache 17 | 18 | Prime the cache for your list of plugins by using an exec-hook such as in [../exec-hooks/use-nginx-proxy-cache.sh](../exec-hooks/use-nginx-proxy-cache.sh) 19 | 20 | This exec-hook gives an example of how the plugin dependency tool can be used to call the cache in advance to allow it to pull the plugins before starting the controller. -------------------------------------------------------------------------------- /examples/artifact-caching-proxy/artifact-caching-proxy-values.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | limits: 3 | cpu: 100m 4 | memory: 128Mi 5 | requests: 6 | cpu: 100m 7 | memory: 128Mi 8 | # Datadog Integration 9 | datadog: 10 | metricsCollection: 11 | enabled: false 12 | logCollection: 13 | enabled: false 14 | cache: 15 | # http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path 16 | path: /data/nginx-cache 17 | keysZoneSize: "200m" 18 | inactive: "1M" 19 | useTempPath: "off" 20 | proxy: 21 | proxyPass: "jenkins-updates.cloudbees.com" 22 | proxyCacheValidCode: "200 206" 23 | proxyCacheValidCodeDuration: "1M" 24 | # http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_bypass 25 | proxyBypass: 26 | enabled: true -------------------------------------------------------------------------------- /examples/catalog-version-explained/README.md: -------------------------------------------------------------------------------- 1 | # Plugin Catalog Version Explained 2 | 3 | 4 | 5 | 6 | - [The Format](#the-format) 7 | - [Example](#example) 8 | - [Plugins](#plugins) 9 | - [The `includePlugins` section](#the-includeplugins-section) 10 | - [Why do we need the `includePlugins` section?](#why-do-we-need-the-includeplugins-section) 11 | 12 | 13 | 14 | When validating a bundle, one of the important things is to ensure the target machine contains: 15 | 16 | - the same set of plugins 17 | - in the same versions 18 | 19 | This is where the version comment in the plugin catalog may prove useful. Prefixed with `CHECKSUM_PLUGIN_FILES=`, it can be seen as a unique identifier for the expected set of 3rd party plugins and dependencies. 20 | 21 | It is already used internally by the script to determine whether to update a particular plugin catalog. 22 | 23 | ```mono 24 | ❯ cat effective-bundles/controller-test/catalog.plugin-catalog.yaml 25 | # CHECKSUM_PLUGIN_FILES=2-401-2-6-3463125b1438df855aaad9f12814f473-dbbca657af13497964cbbb579136ed2c 26 | type: "plugin-catalog" 27 | version: "1" 28 | ... 29 | ... 30 | ``` 31 | 32 | ## The Format 33 | 34 | The format consists of `--` 35 | 36 | - `CI_VERSION_DASHES` - 2-401-2-6 for version 2.401.2.6 37 | - `EFFECTIVE_PLUGINS_MD5SUM` - the md5sum of the effective list of plugins 38 | - `CATALOG_INCLUDE_PLUGINS_MD5SUM` - the md5sum of the includePlugins section of the plugin catalog 39 | 40 | ## Example 41 | 42 | Consider an effective bundle for a controller named `controller-a` consisting of plugins from: 43 | 44 | - base - the base or global bundle 45 | - bundle-a - an intermediary bundle (e.g. with plugins for a particular purpose, e.g. android, finance) 46 | - controller-a - the controller bundle (e.g. with plugins specific for this controller or controller type) 47 | 48 | ```sh 49 | ❯ tree effective-bundles/controller-a 50 | effective-bundles/controller-a 51 | ├── bundle.yaml 52 | ├── catalog.plugin-catalog.yaml 53 | ├── items.0.base.items.items.yaml 54 | ├── items.1.bundle-a.items.items.yaml 55 | ├── jcasc.0.base.jcasc.jenkins.yaml 56 | ├── jcasc.1.bundle-a.jcasc.jenkins.yaml 57 | ├── jcasc.2.controller-a.jcasc.jenkins.yaml 58 | ├── plugins.0.base.plugins.plugins.yaml 59 | ├── plugins.1.bundle-a.plugins.plugins.yaml 60 | ├── plugins.2.controller-a.plugins.plugins.yaml 61 | ├── variables.0.base.variables.variables.yaml 62 | ├── variables.1.bundle-a.variables.variables.yaml 63 | └── variables.2.controller-a.variables.variables.yaml 64 | ``` 65 | 66 | It has a unique plugin catalog ID of `2-401-2-6-b26f5b8c05254744c84d39c4c8aaf24c-c2bbe1739393f3765a56f7299e66c72c` 67 | 68 | ### Plugins 69 | 70 | Let's find the `b26f5b8c05254744c84d39c4c8aaf24c` from the plugins files. 71 | 72 | Source: `plugins.0.base.plugins.plugins.yaml` 73 | 74 | ```yaml 75 | plugins: 76 | - id: cloudbees-casc-client # cap src 77 | - id: cloudbees-casc-items-controller # cap src 78 | - id: cloudbees-prometheus # 3rd src 79 | # tag:custom:url=https://acme.org/artifactory/some-custom-plugin/1.0/some-custom-plugin-1.0.hpi 80 | - id: some-custom-plugin # 3rd src 81 | - id: configuration-as-code # cap src 82 | - id: github # cap src 83 | - id: infradna-backup # cap src 84 | - id: managed-master-hibernation # cap src 85 | - id: pipeline-model-definition # cap src 86 | - id: pipeline-stage-view # cap src 87 | - id: sshd # cap src 88 | - id: branch-api # cap dep 89 | - id: job-dsl # 3rd src 90 | ``` 91 | 92 | Source: `plugins.1.bundle-a.plugins.plugins.yaml` 93 | 94 | ```yaml 95 | plugins: 96 | - id: branch-api # cap dep 97 | - id: job-dsl # 3rd src 98 | ``` 99 | 100 | Source: `plugins.2.controller-a.plugins.plugins.yaml` 101 | 102 | ```yaml 103 | plugins: 104 | - id: beer # 3rd src 105 | # tag:custom:url=https://acme.org/artifactory/some-custom-plugin/1.1/some-custom-plugin-1.1.hpi 106 | - id: some-custom-plugin # 3rd src 107 | ``` 108 | 109 | :warning: Notice that `controller-a` overrides the url of the `some-custom-plugin` to use version `1.1` 110 | 111 | For more information on custom tags, see [custom pluginstags](../custom-plugins-tags/README.md). 112 | 113 | Listing all plugins from all files with: 114 | 115 | ```sh 116 | ❯ yq --no-doc '.plugins' plugins.0.base.plugins.plugins.yaml plugins.1.bundle-a.plugins.plugins.yaml plugins.2.controller-a.plugins.plugins.yaml 117 | - id: cloudbees-casc-client # cap src 118 | - id: cloudbees-casc-items-controller # cap src 119 | - id: cloudbees-prometheus # 3rd src 120 | - id: configuration-as-code # cap src 121 | # tag:custom:url=https://acme.org/artifactory/some-custom-plugin/1.0/some-custom-plugin-1.0.hpi 122 | - id: some-custom-plugin # 3rd src 123 | - id: github # cap src 124 | - id: infradna-backup # cap src 125 | - id: managed-master-hibernation # cap src 126 | - id: pipeline-model-definition # cap src 127 | - id: pipeline-stage-view # cap src 128 | - id: sshd # cap src 129 | - id: branch-api # cap dep 130 | - id: job-dsl # 3rd src 131 | 132 | - id: branch-api # cap dep 133 | - id: job-dsl # 3rd src 134 | 135 | - id: beer # 3rd src 136 | # tag:custom:url=https://acme.org/artifactory/some-custom-plugin/1.1/some-custom-plugin-1.1.hpi 137 | - id: some-custom-plugin # 3rd src 138 | ``` 139 | 140 | Now we create a unique list by: 141 | 142 | - reversing (so the `1.1` version of `some-custom-plugin` comes first) 143 | - removing duplocates (existing entries are not overwritten) 144 | - sorting again to create an ordered list 145 | 146 | The result is as follows: 147 | 148 | ```sh 149 | ❯ ...previous command... | yq '. |= (reverse | unique_by(.id) | sort_by(.id))' - --header-preprocess=false 150 | - id: beer # 3rd src 151 | - id: branch-api # cap dep 152 | - id: cloudbees-casc-client # cap src 153 | - id: cloudbees-casc-items-controller # cap src 154 | - id: cloudbees-prometheus # 3rd src 155 | - id: configuration-as-code # cap src 156 | - id: github # cap src 157 | - id: infradna-backup # cap src 158 | - id: job-dsl # 3rd src 159 | - id: managed-master-hibernation # cap src 160 | - id: pipeline-model-definition # cap src 161 | - id: pipeline-stage-view # cap src 162 | # tag:custom:url=https://acme.org/artifactory/some-custom-plugin/1.1/some-custom-plugin-1.1.hpi 163 | - id: some-custom-plugin # 3rd src 164 | - id: sshd # cap src 165 | ``` 166 | 167 | Finally, an `md5sum` is made to create the `EFFECTIVE_PLUGINS_MD5SUM` part of the ID. 168 | 169 | ```sh 170 | ❯ ...previous command... | md5sum - 171 | b26f5b8c05254744c84d39c4c8aaf24c - 172 | ``` 173 | 174 | ### The `includePlugins` section 175 | 176 | This is a much simpler command to find the `c2bbe1739393f3765a56f7299e66c72c` part of the ID. 177 | 178 | ```sh 179 | ❯ yq '.configurations[0].includePlugins' catalog.plugin-catalog.yaml | md5sum - 180 | c2bbe1739393f3765a56f7299e66c72c - 181 | ``` 182 | 183 | ### Why do we need the `includePlugins` section? 184 | 185 | Because the **versions** of 3rd plugins can still change, even if the underlying list does not. 186 | 187 | We also want to be aware if this happens. 188 | -------------------------------------------------------------------------------- /examples/custom-plugins-tags/README.md: -------------------------------------------------------------------------------- 1 | # Tags for Custom Plugins 2 | 3 | Sometimes you have a custom plugin which is not in the official CloudBees Update Center. Perhaps it is an in-house plugin, or perhaps you wish to use a specific version. 4 | 5 | Normally the dependency script's sanity check would fail saying the "the plugin does not exist in the UC". 6 | 7 | However, a set of tags now allows you to specify custom plugins in your plugins list. 8 | 9 | - The tags must be given as comments above the plugin in question. 10 | - An short explanation of the tags is provided in the header of the resulting `plugins.yaml` (see below) 11 | 12 | ```yaml 13 | # Annotations (given as a comment above the plugin in question): 14 | # tag:custom:version=... - set a custom version (e.g. 1.0) 15 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 16 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 17 | ``` 18 | 19 | ## Tag `tag:custom:version` 20 | 21 | This tag sets a custom version for your plugin. 22 | 23 | :warning: You are responsible for ensuring the plugin can be found in the version you specify. 24 | 25 | Example: 26 | 27 | ```mono 28 | ❯ grep -B 1 beer target/2.401.3.3/mm/plugins.yaml 29 | # tag:custom:version=9.9.9 30 | - id: beer # 3rd src 31 | 32 | ❯ grep -A 1 beer target/2.401.3.3/mm/plugin-catalog.yaml 33 | beer: 34 | version: "9.9.9" 35 | 36 | ❯ grep -A 1 beer target/2.401.3.3/mm/plugin-catalog-offline.yaml 37 | beer: 38 | url: "https://jenkins-updates.cloudbees.com/download/plugins/beer/9.9.9/beer.hpi" 39 | ``` 40 | 41 | ## Tag `tag:custom:url` 42 | 43 | This tag sets a custom url for your plugin. 44 | 45 | **NOTE:** here the url is used in both the `plugin-catalog.yaml` (where versions are otherwise given) as well as the `plugin-catalog-offline.yaml`. 46 | 47 | :warning: You are responsible for ensuring the plugin can be found in the version you specify. 48 | 49 | Example: 50 | 51 | ```mono 52 | ❯ grep -B 1 beer target/2.401.3.3/mm/plugins.yaml 53 | # tag:custom:url=https://artifacts.acme.com/download/beer.hpi 54 | - id: beer # 3rd src 55 | 56 | ❯ grep -A 1 beer target/2.401.3.3/mm/plugin-catalog.yaml 57 | beer: 58 | url: "https://artifacts.acme.com/download/beer.hpi" 59 | 60 | ❯ grep -A 1 beer target/2.401.3.3/mm/plugin-catalog-offline.yaml 61 | beer: 62 | url: "https://artifacts.acme.com/download/beer.hpi" 63 | ``` 64 | 65 | ## Tag `tag:custom:requires` 66 | 67 | This tag allows you specify any dependencies your custom plugin has. 68 | 69 | e.g. the follow would tell ensure the script checks for the existence of the `badge` and `env-inject` in the list when generating the plugins list 70 | 71 | ```mono 72 | # tag:custom:url=https://artifacts.acme.com/download/custom-badges.hpi 73 | # tag:custom:requires=badge envinject 74 | - id: custom-badges # src 75 | ``` 76 | 77 | **NOTE:** The required plugins will also need the 'src' tag. 78 | -------------------------------------------------------------------------------- /examples/exec-hooks/push-to-artifactory.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | # Using https://jfrog.com/getcli/ 6 | echo "Running with: 7 | - PNAME=$PNAME 8 | - PVERSION=$PVERSION 9 | - PFILE=$PFILE 10 | - PURL=$PURL 11 | - PURL_OFFICIAL=$PURL_OFFICIAL 12 | " 13 | echo WOULD NOW RUN: jf rt u "$PFILE" "my-local-repo/plugins/$PNAME/$PVERSION/" -------------------------------------------------------------------------------- /examples/exec-hooks/push-to-remote-repo.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | # Using a git repository 6 | echo "Running with: 7 | - PNAME=$PNAME 8 | - PVERSION=$PVERSION 9 | - PFILE=$PFILE 10 | - PURL=$PURL 11 | - PURL_OFFICIAL=$PURL_OFFICIAL 12 | " 13 | cat << EOF 14 | WOULD NOW RUN: 15 | cd my-local-repo 16 | mkdir -p "plugins/$PNAME/$PVERSION/" 17 | cp "$PFILE" "plugins/$PNAME/$PVERSION/" 18 | git add "plugins/$PNAME/$PVERSION/" 19 | git commit -m "Add plugin $PNAME:$PVERSION" 20 | git push 21 | EOF -------------------------------------------------------------------------------- /examples/exec-hooks/use-nginx-proxy-cache.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | echo "Running with: 6 | - PNAME=$PNAME 7 | - PVERSION=$PVERSION 8 | - PFILE=$PFILE (this will be empty if you do not use '-d') 9 | - PURL=$PURL 10 | - PURL_OFFICIAL=$PURL_OFFICIAL 11 | " 12 | echo "WOULD NOW RUN #2 - curl HIT/MISS: kubectl exec my-artifact-caching-proxy-0 -c artifact-caching-proxy -- curl -I $PURL" 13 | echo "WOULD NOW RUN #3 - curl BYPASS: kubectl exec my-artifact-caching-proxy-0 -c artifact-caching-proxy -- curl -I -H 'Cache-Purge: true' $PURL" 14 | -------------------------------------------------------------------------------- /examples/exec-hooks/use-official-url-to-do-something-instead-of-downloading.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | echo "Running with: 6 | - PNAME=$PNAME 7 | - PVERSION=$PVERSION 8 | - PFILE=$PFILE (this will be empty if you do not use '-d') 9 | - PURL=$PURL 10 | - PURL_OFFICIAL=$PURL_OFFICIAL 11 | " 12 | echo "WOULD NOW RUN: curl $PURL -sO $PNAME && do something with the file (e.g. kubectl cp to my offline cache)" -------------------------------------------------------------------------------- /examples/integrate-with-pre-commit/README.md: -------------------------------------------------------------------------------- 1 | # Integration with `pre-commit` 2 | 3 | Using [pre-commit](https://pre-commit.com/) helps ensure you do not check in inconsistent bundles. 4 | 5 | For example, if you make a change to your raw bundle but forget to run the appropriate `cascgen` command. 6 | 7 | To do this, simply add the following pre-commit configuration to the root of your bundles repository. 8 | 9 | ```yaml 10 | repos: 11 | - repo: local 12 | hooks: 13 | - id: check-effective-bundles 14 | name: check-effective-bundles 15 | entry: /usr/bin/env 16 | args: [cascgen, pre-commit] 17 | language: script 18 | pass_filenames: false 19 | verbose: false 20 | always_run: true 21 | - repo: https://github.com/pre-commit/pre-commit-hooks 22 | rev: v4.4.0 23 | hooks: 24 | - id: check-yaml 25 | files: .*\.(yaml|yml)$ 26 | ``` 27 | 28 | ## Example 29 | 30 | Make a change to a bundle 31 | 32 | ```sh 33 | ❯ git --no-pager diff 34 | diff --git a/raw-bundles/controller-a/jcasc/jenkins.yaml b/raw-bundles/controller-a/jcasc/jenkins.yaml 35 | index a01af6b..f4d0755 100644 36 | --- a/raw-bundles/controller-a/jcasc/jenkins.yaml 37 | +++ b/raw-bundles/controller-a/jcasc/jenkins.yaml 38 | @@ -1,3 +1,3 @@ 39 | --- 40 | jenkins: 41 | - systemMessage: "Configured with CasC from ${bundleName}! Hell yeah!" 42 | + systemMessage: "Configured with CasC from ${bundleName}! This was added without regenerating!" 43 | ``` 44 | 45 | Try and commit... 46 | 47 | ```sh 48 | ❯ gc -m "Adding a new system message" raw-bundles/controller-a/jcasc/jenkins.yaml 49 | check-effective-bundles..................................................Failed 50 | - hook id: check-effective-bundles 51 | - exit code: 1 52 | - files were modified by this hook 53 | 54 | Looking for action 'pre-commit' 55 | Setting some vars... 56 | INFO: Setting CI_VERSION according to git branch from command. 57 | Running with: 58 | DEP_TOOL=/home/sboardwell/bin/cascdeps 59 | TARGET_BASE_DIR=/home/sboardwell/Workspace/tsmp-falcon-platform/ci-bundles-controllers-git-sync-effective/target 60 | CACHE_BASE_DIR=/home/sboardwell/Workspace/tsmp-falcon-platform/ci-bundles-controllers-git-sync-effective/.cache 61 | RAW_DIR=/home/sboardwell/Workspace/tsmp-falcon-platform/ci-bundles-controllers-git-sync-effective/raw-bundles 62 | EFFECTIVE_DIR=/home/sboardwell/Workspace/tsmp-falcon-platform/ci-bundles-controllers-git-sync-effective/effective-bundles 63 | CI_VERSION=2.401.2.6 64 | Effective bundles changed - please stage them before committing. Execution log: /tmp/pre-commit.check-effective-bundles.log 65 | 66 | check yaml...............................................................Passed 67 | ``` 68 | 69 | View the new diff after pre-commit ran the generate command for us... 70 | 71 | ```sh 72 | ❯ git --no-pager diff 73 | diff --git a/effective-bundles/controller-a/bundle.yaml b/effective-bundles/controller-a/bundle.yaml 74 | index 9b7281d..c6772f6 100644 75 | --- a/effective-bundles/controller-a/bundle.yaml 76 | +++ b/effective-bundles/controller-a/bundle.yaml 77 | @@ -1,7 +1,7 @@ 78 | apiVersion: '1' 79 | id: 'controller-a' 80 | description: 'Controller A (version: 2.401.2.6, inheritance: base bundle-a controller-a)' 81 | -version: '40fdaeef37aa94cf9e92c621c1ccdc8f' 82 | +version: '0d1ae0097a09a4b4940d6d5591fce8e5' 83 | availabilityPattern: ".*test" 84 | jcascMergeStrategy: 'override' 85 | jcasc: 86 | diff --git a/effective-bundles/controller-a/jcasc.2.controller-a.jcasc.jenkins.yaml b/effective-bundles/controller-a/jcasc.2.controller-a.jcasc.jenkins.yaml 87 | index a01af6b..f4d0755 100644 88 | --- a/effective-bundles/controller-a/jcasc.2.controller-a.jcasc.jenkins.yaml 89 | +++ b/effective-bundles/controller-a/jcasc.2.controller-a.jcasc.jenkins.yaml 90 | @@ -1,3 +1,3 @@ 91 | --- 92 | jenkins: 93 | - systemMessage: "Configured with CasC from ${bundleName}! Hell yeah!" 94 | + systemMessage: "Configured with CasC from ${bundleName}! This was added without regenerating!" 95 | diff --git a/raw-bundles/controller-a/jcasc/jenkins.yaml b/raw-bundles/controller-a/jcasc/jenkins.yaml 96 | index a01af6b..f4d0755 100644 97 | --- a/raw-bundles/controller-a/jcasc/jenkins.yaml 98 | +++ b/raw-bundles/controller-a/jcasc/jenkins.yaml 99 | @@ -1,3 +1,3 @@ 100 | --- 101 | jenkins: 102 | - systemMessage: "Configured with CasC from ${bundleName}! Hell yeah!" 103 | + systemMessage: "Configured with CasC from ${bundleName}! This was added without regenerating!" 104 | ``` 105 | 106 | Stage the newly changed files... 107 | 108 | ```sh 109 | ❯ git add effective-bundles raw-bundles 110 | ``` 111 | 112 | Now if we run pre-commit, it doesn't complain. Yippeh! 113 | 114 | ```sh 115 | ❯ pre-commit run 116 | check-effective-bundles..................................................Passed 117 | check yaml...............................................................Passed 118 | ``` 119 | -------------------------------------------------------------------------------- /examples/plugins-controller.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - id: cloudbees-casc-items-controller 3 | - id: cloudbees-casc-client 4 | - id: cloudbees-casc-items-api 5 | - id: cloudbees-casc-items-commons 6 | - id: git 7 | - id: sshd 8 | - id: ssh-credentials 9 | - id: configuration-as-code 10 | - id: ansible 11 | - id: github 12 | - id: job-dsl 13 | - id: opentelemetry 14 | - id: configuration-as-code 15 | - id: cloudbees-prometheus 16 | - id: uno-choice 17 | - id: saml 18 | - id: managed-master-hibernation 19 | - id: workflow-multibranch 20 | - id: cloudbees-workflow-template 21 | # - id: bitbucket-kubernetes-credentials 22 | # - id: aws-secrets-manager-secret-source 23 | -------------------------------------------------------------------------------- /examples/plugins-oc.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - id: cloudbees-casc-client 3 | - id: cloudbees-casc-items-api 4 | - id: cloudbees-casc-items-commons 5 | - id: cloudbees-prometheus 6 | - id: configuration-as-code 7 | - id: saml 8 | - id: view-job-filters 9 | - id: git 10 | - id: git-client 11 | -------------------------------------------------------------------------------- /examples/the-src-tag/README.md: -------------------------------------------------------------------------------- 1 | # The `src` tag 2 | 3 | The `src` tag could also be seen as the `keep-me-at-all-costs` tag. 4 | 5 | It tells the script which plugins you wish to keep regardless. 6 | 7 | If you create a minimal plugin list (using `-s`) on a clean set of plugins without any `src` tag, the script will automatically append the `# src` tags to all necessary plugins. 8 | 9 | More context and information can be found in the example sections: 10 | 11 | - the [manual alterations section of the standard workflow example](../workflow-standard-steps/README.md#manual-alterations) 12 | - the [the reasoning behind the src plugins only option](../workflow-standard-steps/README.md#the-reasoning-behind-the--a-source-plugins-only-option) 13 | 14 | ## Example 15 | 16 | Starting with a simple `plugins.yaml` 17 | 18 | ```yaml 19 | plugins: 20 | - id: beer 21 | - id: ec2-fleet 22 | ``` 23 | 24 | Running `./run.sh -v 2.401.3.3 -f plugins.yaml -s` 25 | 26 | ...would give you a `plugins-minimal.yaml` like this (note the only "source" or "src" is the original `ec2-fleet` and `beer` plugins) 27 | 28 | ```yaml 29 | plugins: 30 | - id: aws-credentials # cap dep 31 | - id: aws-java-sdk # 3rd dep 32 | - id: aws-java-sdk-cloudformation # 3rd dep 33 | - id: aws-java-sdk-codebuild # 3rd dep 34 | - id: aws-java-sdk-ec2 # cap dep 35 | - id: aws-java-sdk-ecr # 3rd dep 36 | - id: aws-java-sdk-ecs # 3rd dep 37 | - id: aws-java-sdk-efs # 3rd dep 38 | - id: aws-java-sdk-elasticbeanstalk # cap dep 39 | - id: aws-java-sdk-iam # 3rd dep 40 | - id: aws-java-sdk-kinesis # 3rd dep 41 | - id: aws-java-sdk-logs # 3rd dep 42 | - id: aws-java-sdk-minimal # cap dep 43 | - id: aws-java-sdk-sns # 3rd dep 44 | - id: aws-java-sdk-sqs # 3rd dep 45 | - id: aws-java-sdk-ssm # 3rd dep 46 | - id: beer # 3rd src 47 | - id: ec2-fleet # 3rd src 48 | - id: ssh-slaves # cap dep 49 | ``` 50 | 51 | Removing the `ec2-fleet` plugin and re-running would remove the plugin and all its dependencies. 52 | 53 | However, if you wished, for whatever reason, to keep the `ssh-slaves` plugin regardless, simply append the `src` tag. 54 | 55 | ```yaml 56 | ... 57 | ... 58 | - id: beer # 3rd src 59 | - id: ec2-fleet # 3rd src 60 | - id: ssh-slaves # cap dep src 61 | ``` 62 | 63 | Now, even if you remove the `ec2-fleet` plugin, the `ssh-slaves` will still be kept. 64 | 65 | ```yaml 66 | - id: beer # 3rd src 67 | - id: ssh-slaves # cap src 68 | ``` 69 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/.gitignore: -------------------------------------------------------------------------------- 1 | raw-bundles 2 | effective-bundles 3 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/README.md: -------------------------------------------------------------------------------- 1 | # Generating Effective Bundles 2 | 3 | 4 | 5 | 6 | - [Intro](#intro) 7 | - [Scripts and example files](#scripts-and-example-files) 8 | - [Simple Structure](#simple-structure) 9 | - [Environment based structure using `BUNDLE_SUB_DIR`](#environment-based-structure-using-bundle_sub_dir) 10 | - [Filtering](#filtering) 11 | - [Tab completion for filtering](#tab-completion-for-filtering) 12 | - [Example](#example) 13 | - [Debugging](#debugging) 14 | - [Integration with pre-commit](#integration-with-pre-commit) 15 | - [Automatic detection of the `CI_VERSION`](#automatic-detection-of-the-ci_version) 16 | - [TLDR Walkthrough](#tldr-walkthrough) 17 | - [Setup](#setup) 18 | - [Using `plugins` to sanitize plugins files](#using-plugins-to-sanitize-plugins-files) 19 | - [Using `generate` to create effective bundles](#using-generate-to-create-effective-bundles) 20 | - [The plugin catalog versioning explained](#the-plugin-catalog-versioning-explained) 21 | - [The `AUTO_UPDATE_CATALOG` feature explained](#the-auto_update_catalog-feature-explained) 22 | - [The `plugins` command explained](#the-plugins-command-explained) 23 | - [What does the command do?](#what-does-the-command-do) 24 | - [The `generate` command explained](#the-generate-command-explained) 25 | - [What does the plugin-catalog command do?](#what-does-the-plugin-catalog-command-do) 26 | - [The `all` command explained](#the-all-command-explained) 27 | - [The `force` command explained](#the-force-command-explained) 28 | - [Unique Bundle Version Per Effective Bundle](#unique-bundle-version-per-effective-bundle) 29 | - [Overwriting versions/URLs of custom plugins](#overwriting-versionsurls-of-custom-plugins) 30 | - [PRO TIP: Use `raw.bundle.yaml`](#pro-tip-use-rawbundleyaml) 31 | - [Making changes](#making-changes) 32 | - [Changes to plugins](#changes-to-plugins) 33 | - [Changes to configuration only](#changes-to-configuration-only) 34 | - [Upgrading](#upgrading) 35 | 36 | 37 | 38 | ## Intro 39 | 40 | This page will guide you through the steps used to manage your bundles statically by creating effective bundles per bundle AND CI version. 41 | 42 | A set of example files are provided with the commands. 43 | 44 | Starting with an initial set of bundles, we will: 45 | 46 | - Prepare the `plugins.yaml` for each bundle for future management 47 | - Create the effective bundle including custom `plugin-catalog.yaml` and `plugins.yaml` 48 | 49 | ## Scripts and example files 50 | 51 | The scripts used here are: 52 | 53 | - [run.sh](../../run.sh) (aliased to `cascdeps` in the container) 54 | - [utils/generate-effective-bundles.sh](../../utils/generate-effective-bundles.sh) (aliased to `cascgen` in the container) 55 | - currently provides 4 actions 56 | - `plugins`: used to create the minimal set of plugins for your bundles 57 | - `generate`: used to create the effective bundles 58 | - `all`: running both plugins and then generate 59 | - `force`: running both plugins and then generate, but taking a fresh update center json (normally cached for 6 hours, and regenerating the plugin catalog regardless) 60 | - `pre-commit`: can be used in combination with [pre-commit](https://pre-commit.com/) to avoid unwanted mistakes in commits 61 | 62 | The directories in this example are: 63 | 64 | - `raw-bundles-original`: (temporary) kept just to show the difference before and after. 65 | - `raw-bundles`: this directory holds the bundles in their raw form 66 | - `effective-bundles`: TO BE CREATED, this directory holds the bundles in their effective form 67 | 68 | ### Simple Structure 69 | 70 | Imagine the following structure. 71 | 72 | ```mono 73 | bundles 74 | ├── raw-bundles 75 | │   ├── admin-prod 76 | │   ├── base-prod 77 | │   ├── bundle-a-prod 78 | └── .env 79 | ``` 80 | 81 | ### Environment based structure using `BUNDLE_SUB_DIR` 82 | 83 | You can also put bundles into groups if you need to handle them slightly differently. 84 | 85 | Imagine the following structure for `test` and `prod` environments. 86 | 87 | ```mono 88 | bundles 89 | ├── prod 90 | │   ├── raw-bundles 91 | │   │   ├── admin-prod 92 | │   │   ├── base-prod 93 | │   │   ├── bundle-a-prod 94 | │   └── .env 95 | ├── test 96 | │   ├── raw-bundles 97 | │   │   ├── admin 98 | │   │   ├── base 99 | │   │   ├── bundle-a 100 | │   └── .env 101 | └── .env 102 | ``` 103 | 104 | Configuration: 105 | 106 | - global configuration in the `.env` at root level 107 | - environment specific overrides in the `.env` at the environment level 108 | 109 | Commands are performed by either: 110 | 111 | - navigating to the directory containing the raw-bundles directory 112 | - using the `BUNDLE_SUB_DIR` environment variable 113 | - using the filtering option (see below) 114 | 115 | ## Filtering 116 | 117 | **NOTE:** the bundle filter will take into consider all children of a bundle. Filtering by a parent will therefore automatically perform actions on all children. 118 | 119 | Both the `plugins` and the `generate` actions have two optional positional arguments which can be used for filtering so that: 120 | 121 | ```mono 122 | cascgen 123 | ``` 124 | 125 | At the raw-bundles level, the following scenarios can be achieved: 126 | 127 | - `cascgen ` - all bundles 128 | - `cascgen controller-c` - `controller-c` and child bundles, if any 129 | - `cascgen raw-bundles/controller-c` - `controller-c` and child bundles, if any 130 | 131 | In a multilayered structure, the following scenarios can be achieved: 132 | 133 | - `cascgen prod` - all bundles in the prod sub directory 134 | - `cascgen prod/raw-bundles/bundle-a` - `bundle-a` and child bundles, if any 135 | - `cascgen prod` - `controller-c` and child bundles, if any 136 | 137 | ### Tab completion for filtering 138 | 139 | **NOTE:** the optional `raw-bundles` in filters such as `raw-bundles/bundle-a` or `prod/raw-bundles/bundle-a` allows tabbing to filter. 140 | 141 | This means you type things like `cascgen generate`, then `` to set a filter. 142 | 143 | ### Example 144 | 145 | You can filtering when running the new debugging `vars` action. Look at the `Filtering - ...` messages below. 146 | 147 | ```mono 148 | ❯ cascgen vars prod/raw-bundles/admin-prod 149 | INFO: Filtering - BUNDLE_FILTER set to 'admin-prod' (from 'prod/raw-bundles/admin-prod') 150 | INFO: Filtering - BUNDLE_SUB_DIR set to 'prod' (from 'prod/raw-bundles/admin-prod') 151 | INFO: Setting WORKSPACE to BUNDLE_SUB_DIR: /path/to/casc-bundles/prod 152 | INFO: Found .env sourcing the file: /path/to/casc-bundles/prod/.env 153 | Setting some vars... 154 | INFO: Testing CI_VERSION according to parent of RAW_DIR... 155 | INFO: Testing CI_VERSION according to GIT_BRANCH env var... 156 | INFO: Testing CI_VERSION according to git branch from command... 157 | INFO: Setting CI_VERSION according to git branch from command (-> 2.426.3.3). 158 | Running with: 159 | DEP_TOOL=/home/sboardwell/bin/cascdeps 160 | TARGET_BASE_DIR=/path/to/casc-bundles/target 161 | CACHE_BASE_DIR=/path/to/casc-bundles/.cache 162 | RAW_DIR=/path/to/casc-bundles/prod/raw-bundles 163 | EFFECTIVE_DIR=/path/to/casc-bundles/prod/effective-bundles 164 | BUNDLE_FILTER=admin-prod 165 | CI_VERSION=2.426.3.3 166 | ``` 167 | 168 | ## Debugging 169 | 170 | Running with `DEBUG=1` will output additional information. 171 | 172 | If even more detailed information is needed, you can also revert to using `bash -x ...` 173 | 174 | ## Integration with pre-commit 175 | 176 | Stop making inadvertent mistakes. See [integration with pre-commit](../integrate-with-pre-commit/README.md) for more details. 177 | 178 | ## Automatic detection of the `CI_VERSION` 179 | 180 | The `CI_VERSION` is determined in order by one of the following things (see the `determineCIVersion` method for more details): 181 | 182 | - the `CI_VERSION` environment variable. 183 | - the parent directory of the `RAW_DIR` (according to the `CI_DETECTION_PATTERN` which defaults to `vX.X.X.X`) 184 | - the `GIT_BRANCH` environment variable. 185 | - the git branch name using the git command (if available). 186 | 187 | ## TLDR Walkthrough 188 | 189 | Navigate into this directory and start the local container using the commands found on the [main page](../../README.md). 190 | 191 | ```sh 192 | ❯ docker build -t casc-plugin-dependency-calculation:v1 -f Containerfile . 193 | 194 | ❯ cd examples/workflow-generating-effective-bundles 195 | 196 | ❯ docker run -v $(pwd):$(pwd) -w $(pwd) --rm -it casc-plugin-dependency-calculation:v1 bash 197 | 198 | ``` 199 | 200 | ### Setup 201 | 202 | We are here 👇 203 | 204 | ```sh 205 | $ ls -al 206 | total 48 207 | drwxrwxr-x 3 casc-use casc-use 4096 Nov 21 13:46 . 208 | drwxrwxr-x 8 casc-use casc-use 4096 Nov 17 15:09 .. 209 | -rw-rw-r-- 1 casc-use casc-use 30 Nov 21 13:05 .gitignore 210 | -rw-rw-r-- 1 casc-use casc-use 16210 Nov 21 13:06 README.md 211 | drwxrwxr-x 6 casc-use casc-use 4096 Nov 21 13:06 raw-bundles-original 212 | ``` 213 | 214 | Running the command tells us what our options are: 215 | 216 | ```mono 217 | $ cascgen 218 | Looking for action '' 219 | Unknown action '' (actions are: pre-commit, generate, plugins, all, force) 220 | - plugins: used to create the minimal set of plugins for your bundles 221 | - generate: used to create the effective bundles 222 | - all: running both plugins and then generate 223 | - force: running both plugins and then generate, but taking a fresh update center json (normally cached for 6 hours, and regenerating the plugin catalog regardless) 224 | - pre-commit: can be used in combination with https://pre-commit.com/ to avoid unwanted mistakes in commits 225 | ``` 226 | 227 | Let's run the plugins command 228 | 229 | ```sh 230 | $ cascgen plugins 231 | Looking for action 'plugins' 232 | Setting some vars... 233 | RAW_DIR '/workspace/workflow-generating-effective-bundles/raw-bundles' is not a directory 234 | ``` 235 | 236 | Oh, wait, the raw-bundles dir hasn't been created. Let's copy the original... 237 | 238 | ```sh 239 | $ cp -r raw-bundles-original raw-bundles 240 | $ cascgen plugins 241 | Looking for action 'plugins' 242 | Setting some vars... 243 | EFFECTIVE_DIR '/workspace/workflow-generating-effective-bundles/effective-bundles' is not a directory 244 | ``` 245 | 246 | Create the effective-bundles dir and export the `CI_VERSION` since it is cannot be automatically detected in this example... 247 | 248 | ```sh 249 | $ mkdir effective-bundles 250 | $ cascgen plugins 251 | Looking for action 'plugins' 252 | Setting some vars... 253 | CI_VERSION '' is not a valid version. 254 | $ export CI_VERSION=2.401.2.3 255 | ``` 256 | 257 | ### Using `plugins` to sanitize plugins files 258 | 259 | Run the `plugins` command 260 | 261 | ```sh 262 | $ cascgen plugins 263 | Looking for action 'plugins' 264 | Setting some vars... 265 | INFO: Setting CI_VERSION according to CI_VERSION env var. 266 | Running with: 267 | DEP_TOOL=/usr/local/bin/cascdeps 268 | TARGET_BASE_DIR=/workspace/workflow-generating-effective-bundles/target 269 | CACHE_BASE_DIR=/workspace/workflow-generating-effective-bundles/.cache 270 | RAW_DIR=/workspace/workflow-generating-effective-bundles/raw-bundles 271 | EFFECTIVE_DIR=/workspace/workflow-generating-effective-bundles/effective-bundles 272 | CI_VERSION=2.401.2.3 273 | Running... /usr/local/bin/cascdeps -v 2.401.2.3 -sAf /workspace/workflow-generating-effective-bundles/raw-bundles/controller-a/plugins.yaml -G /workspace/workflow-generating-effective-bundles/raw-bundles/controller-a/plugins.yaml 274 | INFO: CI_VERSION set to '2.401.2.3'. 275 | ``` 276 | 277 | Looking at the diff between `raw-bundles-original` and the `raw-bundles` we see that only the `plugins.yaml` have changed. 278 | 279 | ```sh 280 | $ diff -rq raw-bundles raw-bundles-original 281 | Files raw-bundles/base/plugins.yaml and raw-bundles-original/base/plugins.yaml differ 282 | Files raw-bundles/bundle-a/plugins.yaml and raw-bundles-original/bundle-a/plugins.yaml differ 283 | Files raw-bundles/controller-a/plugins.yaml and raw-bundles-original/controller-a/plugins.yaml differ 284 | Files raw-bundles/controller-c/plugins.yaml and raw-bundles-original/controller-c/plugins.yaml differ 285 | ``` 286 | 287 | Taking a closer look at one of the `plugins.yaml` we see the file has been sanitised. 288 | 289 | This form of 'sanitising' is explained in the [standard-workflow-steps](../workflow-standard-steps/README.md) 290 | 291 | ```sh 292 | $ diff raw-bundles-original/controller-c/plugins.yaml raw-bundles/controller-c/plugins.yaml 293 | --- raw-bundles-original/controller-c/plugins.yaml 294 | +++ raw-bundles/controller-c/plugins.yaml 295 | @@ -1,4 +1,20 @@ 296 | +# This file is automatically generated - please do not edit manually. 297 | + 298 | +# Annotations (given as a comment above the plugin in question): 299 | +# tag:custom:version=... - set a custom version (e.g. 1.0) 300 | +# tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 301 | +# tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 302 | + 303 | +# Plugin Categories: 304 | +# cap - is this a CAP plugin? 305 | +# 3rd - is this a 3rd party plugin? 306 | +# old - is this a deprecated plugin? 307 | +# cve - are there open security issues? 308 | +# bst - installed by default 309 | +# dep - installed as dependency 310 | +# src - used as a source plugin for this list 311 | + 312 | plugins: 313 | - - id: git 314 | - - id: jfrog 315 | - - id: pipeline-model-definition 316 | + - id: git # cap dep 317 | + - id: jfrog # 3rd src 318 | + - id: pipeline-model-definition # cap dep 319 | ``` 320 | 321 | ### Using `generate` to create effective bundles 322 | 323 | Now that we have a trusted set of `plugins.yaml` for which the dependencies have been calculated, we can use the `generate` action to create the effective bundle and corresponding plugin catalog. 324 | 325 | From the root of your bundles repository, run the command `generate`. 326 | 327 | ```sh 328 | $ cascgen generate 329 | Looking for action 'generate' 330 | Setting some vars... 331 | INFO: Setting CI_VERSION according to CI_VERSION env var. 332 | Running with: 333 | DEP_TOOL=/usr/local/bin/cascdeps 334 | TARGET_BASE_DIR=/workspace/workflow-generating-effective-bundles/target 335 | CACHE_BASE_DIR=/workspace/workflow-generating-effective-bundles/.cache 336 | RAW_DIR=/workspace/workflow-generating-effective-bundles/raw-bundles 337 | EFFECTIVE_DIR=/workspace/workflow-generating-effective-bundles/effective-bundles 338 | CI_VERSION=2.401.2.3 339 | INFO: Creating bundle 'controller-c' using parents 'base controller-c' 340 | 341 | AUTO_UPDATE_CATALOG - Checking plugin files checksum 'actual: ' vs 'expected: 2.401.2.3-62a294abe449b334cd474ee07c0c69f0' 342 | AUTO_UPDATE_CATALOG - no current plugin catalog found. Automatically refreshing the plugin catalog (setting DRY_RUN=0)... 343 | 344 | Running... /usr/local/bin/cascdeps -N -M -v 2.401.2.3 -f /workspace/workflow-generating-effective-bundles/effective-bundles/controller-c/plugins.1.controller-c.plugins.yaml -f /workspace/workflow-generating-effective-bundles/effective-bundles/controller-c/plugins.0.base.plugins.yaml -c /workspace/workflow-generating-effective-bundles/effective-bundles/controller-c/catalog.plugin-catalog.yaml 345 | Removing any previous catalog files... 346 | INFO: CI_VERSION set to '2.401.2.3'. 347 | INFO: Setting CACHE_BASE_DIR=/workspace/workflow-generating-effective-bundles/.cache 348 | INFO: Multiple source files passed. Creating temporary plugins.yaml file '/tmp/tmp.bIebin'. 349 | INFO: update-center.json is less than 360 minutes old. You can remove it or use the '-R' flag to refresh the cache. 350 | INFO: Creating target dir (/workspace/workflow-generating-effective-bundles/target/2.401.2.3/mm) 351 | INFO: Sanity checking '/tmp/tmp.bIebin' for duplicates. 352 | 353 | ... 354 | ... 355 | 356 | INFO: Resulting files created using tree... 357 | /workspace/workflow-generating-effective-bundles/effective-bundles/controller-c 358 | ├── bundle.yaml 359 | ├── catalog.plugin-catalog.yaml 360 | ├── items.0.base.items.yaml 361 | ├── items.1.controller-c.items.yaml 362 | ├── jcasc.0.base.jenkins.yaml 363 | ├── jcasc.1.controller-c.jenkins.yaml 364 | ├── plugins.0.base.plugins.yaml 365 | ├── plugins.1.controller-c.plugins.yaml 366 | ├── variables.0.base.variables.yaml 367 | └── variables.1.controller-c.variables.yaml 368 | 369 | 0 directories, 10 files 370 | 371 | INFO: Resulting bundle.yaml 372 | apiVersion: '1' 373 | id: 'controller-c' 374 | description: 'Controller C (version: 2.401.2.3, inheritance: base controller-c)' 375 | version: '55dae9646e4c8ab1faf1e5173d33612b' 376 | availabilityPattern: ".*" 377 | jcascMergeStrategy: 'override' 378 | jcasc: 379 | - jcasc.0.base.jenkins.yaml 380 | - jcasc.1.controller-c.jenkins.yaml 381 | items: 382 | - items.0.base.items.yaml 383 | - items.1.controller-c.items.yaml 384 | catalog: 385 | - catalog.plugin-catalog.yaml 386 | plugins: 387 | - plugins.0.base.plugins.yaml 388 | - plugins.1.controller-c.plugins.yaml 389 | variables: 390 | - variables.0.base.variables.yaml 391 | - variables.1.controller-c.variables.yaml 392 | Done 393 | ``` 394 | 395 | ### The plugin catalog versioning explained 396 | 397 | Please see [catalog version explained](../catalog-version-explained/README.md) for more details on how the version of the plugin catalog is calculated. 398 | 399 | ### The `AUTO_UPDATE_CATALOG` feature explained 400 | 401 | The `AUTO_UPDATE_CATALOG` is a feature which automatically detects changes in a bundles plugins and "automatically" recreates the associated plugin catalog. 402 | 403 | It does this by adding a header comment to the plugin catalog file in the format `-`. If the checksum or version changes, the plugin catalog is recreated. 404 | 405 | Subsequent runs are obviously a lot faster if nothing has changed since the generation is skipped. 406 | 407 | It is set activated by default, but can be deactivated if required (but then there is a risk that the plugin catalog becomes stale). 408 | 409 | Here the log for a first run: 410 | 411 | ```sh 412 | AUTO_UPDATE_CATALOG - Checking plugin files checksum 'actual: ' vs 'expected: 2.401.2.3-62a294abe449b334cd474ee07c0c69f0' 413 | AUTO_UPDATE_CATALOG - no current plugin catalog found. Automatically refreshing the plugin catalog (setting DRY_RUN=0)... 414 | ``` 415 | 416 | And here a subsequent run with the same set of plugins 417 | 418 | ```sh 419 | AUTO_UPDATE_CATALOG - Checking plugin files checksum 'actual: 2.401.2.3-62a294abe449b334cd474ee07c0c69f0' vs 'expected: 2.401.2.3-62a294abe449b334cd474ee07c0c69f0' 420 | ``` 421 | 422 | Here upon adding a plugin 423 | 424 | ```sh 425 | AUTO_UPDATE_CATALOG - Checking plugin files checksum 'actual: 2.401.2.3-62a294abe449b334cd474ee07c0c69f0' vs 'expected: 2.401.2.3-348b38f0e2108f8adce89d79743c9178' 426 | AUTO_UPDATE_CATALOG - differences in plugins found. Automatically refreshing the plugin catalog (setting DRY_RUN=0)... 427 | ``` 428 | 429 | Here upon updating the `CI_VERSION` 430 | 431 | ```sh 432 | AUTO_UPDATE_CATALOG - Checking plugin files checksum 'actual: 2.401.2.3-62a294abe449b334cd474ee07c0c69f0' vs 'expected: 2.401.3.3-62a294abe449b334cd474ee07c0c69f0' 433 | AUTO_UPDATE_CATALOG - differences in plugins found. Automatically refreshing the plugin catalog (setting DRY_RUN=0)... 434 | ``` 435 | 436 | ### The `plugins` command explained 437 | 438 | The output will look something like this (**NOTE:** the full path has been made into a relative path for readability): 439 | 440 | ```sh 441 | ❯ cascgen plugins controller-c 442 | Looking for action 'plugins' 443 | Setting some vars... 444 | Running with: 445 | DEP_TOOL=/home/sboardwell/bin/cascdeps 446 | TARGET_BASE_DIR=/home/sboardwell/Workspace/sboardwell/casc-plugin-dependency-calculation/target 447 | CACHE_BASE_DIR=/home/sboardwell/Workspace/sboardwell/casc-plugin-dependency-calculation/.cache 448 | RAW_DIR=raw-bundles 449 | EFFECTIVE_DIR=effective-bundles 450 | Running... /home/sboardwell/bin/cascdeps -v 2.401.2.3 -s -f raw-bundles/controller-c/plugins/plugins.yaml -G raw-bundles/controller-c/plugins/plugins.yaml 451 | ``` 452 | 453 | #### What does the command do? 454 | 455 | Looking at one of the commands above in more detail we can rewrite as: 456 | 457 | ```sh 458 | /home/sboardwell/bin/cascdeps \ 459 | -v 2.401.2.3 \ 460 | -s \ 461 | -f raw-bundles/controller-a/plugins/plugins.yaml \ 462 | -G raw-bundles/controller-a/plugins/plugins.yaml 463 | ``` 464 | 465 | What this commands says is: 466 | 467 | - using the plugin dependency tool 468 | - `-v`: for version 2.401.2.3 469 | - `-s`: create a minimal viable plugins list 470 | - `-f`: using `raw-bundles/controller-a/plugins/plugins.yaml` as an input list 471 | - `-G`: copy the resulting minimal viable plugins list to `raw-bundles/controller-a/plugins/plugins.yaml` (effectively replacing the input list) 472 | 473 | ### The `generate` command explained 474 | 475 | Running the `generate` command you will see the following in the logs: 476 | 477 | ```sh 478 | ❯ cascgen generate controller-c 479 | ... 480 | ... 481 | Running... /home/sboardwell/bin/cascdeps -N -M -v 2.401.2.3 -f /workspace/workflow-generating-effective-bundles/effective-bundles/2.401.2.3-controller-c/plugins/0.base.plugins.plugins.yaml -f /workspace/workflow-generating-effective-bundles/effective-bundles/2.401.2.3-controller-c/plugins/1.bundle-a.plugins.plugins.yaml -f /workspace/workflow-generating-effective-bundles/effective-bundles/2.401.2.3-controller-c/plugins/2.controller-c.plugins.plugins.yaml -c /workspace/workflow-generating-effective-bundles/effective-bundles/2.401.2.3-controller-c/catalog/plugin-catalog.yaml 482 | Set DRY_RUN=0 to execute. 483 | ``` 484 | 485 | #### What does the plugin-catalog command do? 486 | 487 | Looking at one of the commands above in more detail we can rewrite as: 488 | 489 | ```sh 490 | /home/sboardwell/bin/cascdeps \ 491 | -N \ 492 | -M \ 493 | -v 2.401.2.3 \ 494 | -f effective-bundles/2.401.2.3-controller-c/plugins/0.base.plugins.plugins.yaml \ 495 | -f effective-bundles/2.401.2.3-controller-c/plugins/1.bundle-a.plugins.plugins.yaml \ 496 | -f effective-bundles/2.401.2.3-controller-c/plugins/2.controller-c.plugins.plugins.yaml \ 497 | -c effective-bundles/2.401.2.3-controller-c/catalog/plugin-catalog.yaml 498 | ``` 499 | 500 | What this commands says is: 501 | 502 | - using the plugin dependency tool 503 | - `-N`: skip dependency check and create the plugin catalog only (since we trust these plugin list) 504 | - `-M`: deduplicate any plugins (plugin entries will be overwritten in the order of the argument) 505 | - `-v`: for version 2.401.2.3 506 | - `-f`: using `xxxxx` as an input list (**NOTE:** the order is the inheritance order of `base` -> `bundle-a` -> `controller-a`) 507 | - `-c`: copy the resulting plugin catalog to `effective-bundles/2.401.2.3-controller-c/catalog/plugin-catalog.yaml` (previous files will be removed) 508 | 509 | ### The `all` command explained 510 | 511 | This is the same as calling `plugins` and `generate` 512 | 513 | ### The `force` command explained 514 | 515 | This is the same as calling `all`. However, the update center will be downloaded afresh and everything will be recreated, regardless of the `CHECKSUM_PLUGIN_FILES`, etc. 516 | 517 | ### Unique Bundle Version Per Effective Bundle 518 | 519 | The unique `version` found in the `bundle.yaml` is made up of the md5sum all files found in the effective bundle. 520 | 521 | ### Overwriting versions/URLs of custom plugins 522 | 523 | This is also covered in [the custom plugin tags section](../custom-plugins-tags/README.md) 524 | 525 | Sometimes a child bundle may need to use a different version of a custom plugin. This can be seen when looking at the `bundle-a` and `controller-a`, where the `some-custom-plugin` is overwritten to use `2.0` by the child bundle `controller-a`. 526 | 527 | ```sh 528 | ❯ grep -r custom-plugin raw-bundles 529 | raw-bundles/controller-a/plugins/plugins.yaml: # tag:custom:url=https://acme.org/artifactory/some-custom-plugin/2.0/some-custom-plugin-2.0.hpi 530 | raw-bundles/controller-a/plugins/plugins.yaml: - id: some-custom-plugin # 3rd src 531 | raw-bundles/bundle-a/plugins/plugins.yaml: # tag:custom:url=https://acme.org/artifactory/some-custom-plugin/1.0/some-custom-plugin-1.0.hpi 532 | raw-bundles/bundle-a/plugins/plugins.yaml: - id: some-custom-plugin # 3rd 533 | ``` 534 | 535 | The resulting dedicated plugin catalog after generating the effective bundle contains the version `2.0`: 536 | 537 | ```sh 538 | $ grep -r custom-plugin effective-bundles | grep plugin-catalog 539 | effective-bundles/controller-a/catalog.plugin-catalog.yaml: some-custom-plugin: 540 | effective-bundles/controller-a/catalog.plugin-catalog.yaml: url: "https://acme.org/artifactory/some-custom-plugin/1.0/some-custom-plugin-2.0.hpi" 541 | effective-bundles/bundle-a/catalog.plugin-catalog.yaml: some-custom-plugin: 542 | effective-bundles/bundle-a/catalog.plugin-catalog.yaml: url: "https://acme.org/artifactory/some-custom-plugin/1.0/some-custom-plugin-1.0.hpi" 543 | ``` 544 | 545 | ## PRO TIP: Use `raw.bundle.yaml` 546 | 547 | Consider having your raw bundles and effective bundles in the same branch. 548 | 549 | Given the bundle names are now duplicated, you cannot load them into the CloudBees Operations Center. 550 | 551 | Meet the `raw.bundle.yaml`... 552 | 553 | When looking for raw bundles, the tool will also recognise `*bundle.yaml` files. 554 | 555 | This means you can change your raw bundles `bundle.yaml` files to something like `raw.bundle.yaml` 556 | 557 | Try it for yourself 558 | 559 | ```sh 560 | for f in $(find raw-bundles -name bundle.yaml); do fname=$(basename $f); fdir=$(dirname $f); mv "$f" "${fdir}/raw.${fname}"; done 561 | ``` 562 | 563 | The commands work the same, but now we can use the "CasC Bundle Location" feature in the CloudBees Operations Center. 564 | 565 | ## Making changes 566 | 567 | ### Changes to plugins 568 | 569 | - add the plugin to the respective `plugins.yaml` 570 | - run either: 571 | - the `plugins` and `generate` action (optionally with filtering) 572 | - the `all` action to do both (optionally with filtering) 573 | 574 | ### Changes to configuration only 575 | 576 | - make the change in the raw-bundles 577 | - run the `generate` action (optionally with filtering) 578 | 579 | ### Upgrading 580 | 581 | This topic is out of the scope of this README. 582 | 583 | The `CI_VERSION` is determined by one of the following things in order (see the `determineCIVersion` method for more details): 584 | 585 | - the `CI_VERSION` environment variable. 586 | - the parent directory of the `RAW_DIR` (sterred by the the `CI_DETECTION_PATTERN` which defaults to `vX.X.X.X`) 587 | - the `GIT_BRANCH` environment variable. 588 | - the git branch name using the git command (if available). 589 | 590 | Whether to use: 591 | 592 | - a single branch with version-based directories 593 | - multiple branches with each branch called after the version 594 | - multiple branches with each branch called after the version with the raw-bundles as code, but the effective-bundles as git sub modules 595 | - a single branch with multiple different versions within the same list of bundles (I would not recommend this) 596 | 597 | It is really a matter of choice. As soon as a standard is found, we can put it here. 598 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/base/bundle.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: '1' 2 | id: 'base-controller' 3 | description: 'Base Bundle' 4 | version: '1' 5 | availabilityPattern: ".*" 6 | jcascMergeStrategy: 'override' 7 | jcasc: 8 | - jenkins.yaml 9 | items: 10 | - items.yaml 11 | catalog: 12 | - 'catalog' 13 | plugins: 14 | - plugins.yaml 15 | variables: 16 | - variables.yaml 17 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/base/items.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | removeStrategy: 3 | rbac: SYNC 4 | items: NONE 5 | items: 6 | - kind: freeStyle 7 | name: test-job-from-base-casc-fs 8 | blockBuildWhenDownstreamBuilding: false 9 | blockBuildWhenUpstreamBuilding: false 10 | builders: 11 | - shell: 12 | command: echo "hi" 13 | concurrentBuild: false 14 | description: 'Hi!' 15 | disabled: false 16 | scm: 17 | none: {} 18 | scmCheckoutStrategy: 19 | standard: {} 20 | label: build 21 | - kind: pipeline 22 | name: test-job-from-base-casc-pipeline 23 | concurrentBuild: false 24 | definition: 25 | cpsFlowDefinition: 26 | sandbox: true 27 | script: | 28 | pipeline { 29 | agent none 30 | stages { 31 | stage('Main') { 32 | agent { 33 | label 'debian' 34 | } 35 | steps { 36 | container('debian') { 37 | sh 'hostname' 38 | } 39 | } 40 | } 41 | } 42 | } 43 | description: 'Hi!' 44 | disabled: false 45 | properties: 46 | - buildDiscarder: 47 | strategy: 48 | logRotator: 49 | artifactDaysToKeep: -1 50 | artifactNumToKeep: -1 51 | daysToKeep: 2 52 | numToKeep: 10 53 | resumeBlocked: false 54 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/base/jenkins.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | jenkins: 3 | systemMessage: "Configured with CasC from ${bundleName}" 4 | kube: 5 | podTemplatesConfiguration: 6 | templates: 7 | - containers: 8 | - args: "9999999" 9 | command: "sleep" 10 | image: "debian" 11 | name: "debian" 12 | name: "debian" 13 | nodeUsageMode: "NORMAL" 14 | label: "build debian" 15 | unclassified: 16 | hibernationConfiguration: 17 | activities: 18 | - "build" 19 | - "web" 20 | enabled: true 21 | gracePeriod: 900 22 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/base/plugins.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - id: aws-credentials 3 | - id: aws-java-sdk-ec2 4 | - id: aws-java-sdk-minimal 5 | - id: branch-api 6 | - id: cloudbees-casc-client 7 | - id: cloudbees-casc-items-api 8 | - id: cloudbees-casc-items-commons 9 | - id: cloudbees-casc-items-controller 10 | - id: cloudbees-prometheus 11 | - id: commons-lang3-api 12 | - id: commons-text-api 13 | - id: configuration-as-code 14 | - id: git 15 | - id: git-client 16 | - id: github 17 | - id: github-api 18 | - id: infradna-backup 19 | - id: managed-master-hibernation 20 | - id: mina-sshd-api-common 21 | - id: mina-sshd-api-core 22 | - id: mina-sshd-api-sftp 23 | - id: ssh-credentials 24 | - id: sshd 25 | - id: workflow-basic-steps 26 | - id: pipeline-input-step 27 | - id: pipeline-groovy-lib 28 | - id: workflow-multibranch 29 | - id: pipeline-stage-tags-metadata 30 | - id: pipeline-model-definition 31 | - id: pipeline-graph-analysis 32 | - id: pipeline-rest-api 33 | - id: pipeline-stage-view 34 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/base/variables.yaml: -------------------------------------------------------------------------------- 1 | variables: 2 | - bundleName: base -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/bundle-a/bundle.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: '1' 2 | id: 'base-controller' 3 | description: 'Bundle A' 4 | parent: "base" 5 | version: '1' 6 | availabilityPattern: ".*" 7 | jcascMergeStrategy: 'override' 8 | jcasc: 9 | - jenkins.yaml 10 | items: 11 | - items.yaml 12 | catalog: 13 | - 'catalog' 14 | plugins: 15 | - plugins.yaml 16 | variables: 17 | - variables.yaml 18 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/bundle-a/items.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | removeStrategy: 3 | rbac: SYNC 4 | items: NONE 5 | items: 6 | - kind: pipeline 7 | name: test-job-from-bundle-a 8 | displayName: test-job-from-bundle-a-idx-5 9 | concurrentBuild: false 10 | definition: 11 | cpsFlowDefinition: 12 | sandbox: true 13 | script: | 14 | pipeline { 15 | agent none 16 | stages { 17 | stage('Main') { 18 | steps { 19 | echo "Hi from bundle-a" 20 | } 21 | } 22 | } 23 | } 24 | description: '' 25 | disabled: false 26 | properties: 27 | - buildDiscarder: 28 | strategy: 29 | logRotator: 30 | artifactDaysToKeep: -1 31 | artifactNumToKeep: -1 32 | daysToKeep: 2 33 | numToKeep: 10 34 | resumeBlocked: false 35 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/bundle-a/jenkins.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | jenkins: 3 | systemMessage: "Configured with CasC from ${bundleName}" 4 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/bundle-a/plugins.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - id: job-dsl 3 | # tag:custom:url=https://acme.org/artifactory/some-custom-plugin/1.0/some-custom-plugin-1.0.hpi 4 | - id: some-custom-plugin # 3rd src -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/bundle-a/variables.yaml: -------------------------------------------------------------------------------- 1 | variables: 2 | - bundleName: bundle-a -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/controller-a/bundle.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: '1' 2 | id: 'controller-a' 3 | description: 'Controller A' 4 | parent: "bundle-a" 5 | version: '1' 6 | availabilityPattern: ".*test" 7 | jcascMergeStrategy: 'override' 8 | jcasc: 9 | - jenkins.yaml 10 | items: 11 | - items.yaml 12 | catalog: 13 | - 'catalog' 14 | plugins: 15 | - plugins.yaml 16 | variables: 17 | - variables.yaml 18 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/controller-a/items.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyounger/casc-plugin-dependency-calculation/3c7e9fc5b944fd31ce3fdbdd9637b60f15642232/examples/workflow-generating-effective-bundles/raw-bundles-original/controller-a/items.yaml -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/controller-a/jenkins.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | jenkins: 3 | systemMessage: "Configured with CasC from ${bundleName}!" 4 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/controller-a/plugins.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - id: beer 3 | # tag:custom:url=https://acme.org/artifactory/some-custom-plugin/1.0/some-custom-plugin-2.0.hpi 4 | - id: some-custom-plugin # 3rd src -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/controller-a/variables.yaml: -------------------------------------------------------------------------------- 1 | variables: 2 | - bundleName: controller-a -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/controller-c/bundle.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: '1' 2 | id: 'controller-c' 3 | description: 'Controller C' 4 | parent: "base" 5 | version: '1' 6 | availabilityPattern: ".*" 7 | jcascMergeStrategy: 'override' 8 | jcasc: 9 | - jenkins.yaml 10 | items: 11 | - items.yaml 12 | catalog: 13 | - 'catalog' 14 | plugins: 15 | - plugins.yaml 16 | variables: 17 | - variables.yaml 18 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/controller-c/items.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | removeStrategy: 3 | rbac: SYNC 4 | items: NONE 5 | items: 6 | - kind: pipeline 7 | name: test-job-from-controller-c 8 | displayName: test-job-from-controller-c-idx-0 9 | concurrentBuild: false 10 | definition: 11 | cpsFlowDefinition: 12 | sandbox: true 13 | script: | 14 | pipeline { 15 | agent none 16 | stages { 17 | stage('Main') { 18 | steps { 19 | echo "Hi from controller-c" 20 | } 21 | } 22 | } 23 | } 24 | description: '' 25 | disabled: false 26 | properties: 27 | - buildDiscarder: 28 | strategy: 29 | logRotator: 30 | artifactDaysToKeep: -1 31 | artifactNumToKeep: -1 32 | daysToKeep: 2 33 | numToKeep: 10 34 | resumeBlocked: false 35 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/controller-c/jenkins.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | jenkins: 3 | systemMessage: "Configured with CasC from ${bundleName}." 4 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/controller-c/plugins.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - id: git 3 | - id: jfrog 4 | - id: pipeline-model-definition 5 | -------------------------------------------------------------------------------- /examples/workflow-generating-effective-bundles/raw-bundles-original/controller-c/variables.yaml: -------------------------------------------------------------------------------- 1 | variables: 2 | - bundleName: controller-c -------------------------------------------------------------------------------- /examples/workflow-standard-steps/README.md: -------------------------------------------------------------------------------- 1 | # Standard Workflow 2 | 3 | 4 | 5 | 6 | - [Intro](#intro) 7 | - [The `src` tag explained](#the-src-tag-explained) 8 | - [Support for Custom Plugins](#support-for-custom-plugins) 9 | - [Obtaining a `plugins.yaml` from a controller](#obtaining-a-pluginsyaml-from-a-controller) 10 | - [Preparing your `plugins.yaml`](#preparing-your-pluginsyaml) 11 | - [Minimum viable vs raw list](#minimum-viable-vs-raw-list) 12 | - [Minimum viable vs generation-only list](#minimum-viable-vs-generation-only-list) 13 | - [Manual alterations](#manual-alterations) 14 | - [Creating your first `plugins.yaml` and `plugin-catalog.yaml`](#creating-your-first-pluginsyaml-and-plugin-catalogyaml) 15 | - [Updating your `plugins.yaml` and `plugin-catalog.yaml`](#updating-your-pluginsyaml-and-plugin-catalogyaml) 16 | - [The reasoning behind the `-A` source plugins only option](#the-reasoning-behind-the--a-source-plugins-only-option) 17 | - [Making changes](#making-changes) 18 | - [Adding a plugin](#adding-a-plugin) 19 | - [Removing a plugin](#removing-a-plugin) 20 | 21 | 22 | 23 | ## Intro 24 | 25 | This page will guide you through the steps used to manage your plugins in a standard environment with a single plugin list. 26 | 27 | A set of example files are provided with the commands. 28 | 29 | We will look at: 30 | 31 | - Obtaining the initial set of plugins from a controller 32 | - preparing the `plugins.yaml` for future management 33 | - creating the `plugin-catalog.yaml` and `plugins.yaml` for a given version of CI 34 | - recreating the `plugin-catalog.yaml` and `plugins.yaml` for an upgrade 35 | - making changes 36 | 37 | ### The `src` tag explained 38 | 39 | More information on [the src tag](./examples/the-src-tag/README.md). 40 | 41 | ### Support for Custom Plugins 42 | 43 | See the information for [custom plugins tags](./examples/custom-plugins-tags/README.md). 44 | 45 | ## Obtaining a `plugins.yaml` from a controller 46 | 47 | Assuming the "CloudBees CasC Client" plugin is already installed, go to "Manage Jenkins" -> "CloudBees Configuration as Code export and update". Then click on the view icon. 48 | 49 | Copy the list to `plugins-raw.yaml` 50 | 51 | Example: 52 | 53 | ```sh 54 | yq . "examples/workflow-standard-steps/files/plugins-raw.yaml" 55 | ``` 56 | 57 | ## Preparing your `plugins.yaml` 58 | 59 | Let us assume we are creating a bundle for CloudBees CI version `2.387.3.5` 60 | 61 | Let's run the script using the `-s` option to minimise the raw set of plugins. 62 | 63 | ```sh 64 | ./run.sh -v "2.387.3.5" -f "examples/workflow-standard-steps/files/plugins-raw.yaml" -s 65 | ``` 66 | 67 | Take a closer look at the "Summary" at the end of the script. 68 | 69 | ### Minimum viable vs raw list 70 | 71 | When comparing the "minimal list vs the original list" you will notice that: 72 | 73 | - the bootstrap plugins have been removed 74 | - any dependencies of CAP plugins have been removed 75 | 76 | (both of which are installed automatically and therefore not needed in our list) 77 | 78 | ```sh 79 | diff -y "target/2.387.3.5/mm/plugins.yaml" "target/2.387.3.5/mm/plugins-minimal.yaml" | less 80 | ``` 81 | 82 | ### Minimum viable vs generation-only list 83 | 84 | Further comparing "minimal list vs the generation-only list" you will notice that: 85 | 86 | - the generation-only list contains the absolute minimum set of plugins this script needs to create the viable list of plugins 87 | - all source plugins are tagged with the `src` category to indicate they are needed for generation purposes 88 | 89 | ```sh 90 | diff -y "target/2.387.3.5/mm/plugins-minimal.yaml" "target/2.387.3.5/mm/plugins-minimal-for-generation-only.yaml" | less 91 | ``` 92 | 93 | The example file can be found at `examples/workflow-standard-steps/files/plugins-minimal.yaml` 94 | 95 | ### Manual alterations 96 | 97 | There may be some plugins which are not currently classed as `src` but which you wish to keep. 98 | 99 | In the example above, consider the `aws-credentials` plugin. We may wish to have this installed regardless. In this case, simply add the `src` tag to the plugin. 100 | 101 | Before: 102 | 103 | ```yaml 104 | plugins: 105 | - id: aws-credentials # cap dep 106 | ``` 107 | 108 | After (comment is optional): 109 | 110 | ```yaml 111 | plugins: 112 | # we want to keep this plugin regardless - src added manually 113 | - id: aws-credentials # cap dep src 114 | ``` 115 | 116 | The resulting starter file can be found at `examples/workflow-standard-steps/files/plugins-starter.yaml` 117 | 118 | We will now use this file to create our first catalog. 119 | 120 | ## Creating your first `plugins.yaml` and `plugin-catalog.yaml` 121 | 122 | :information_source: the need for the `-A` flag will be explained in the upgrade section. 123 | 124 | We will make use of: 125 | 126 | - `-A` to use only the source (`src`) plugins when generating the new files 127 | - `-G` to copy the resulting minimal viable list to it's final destination 128 | - `-c` to copy the resulting plugin catalog to it's final destination 129 | 130 | Using the starter file from above, we run: 131 | 132 | ```sh 133 | ./run.sh -v "2.387.3.5" \ 134 | -s \ 135 | -A \ 136 | -f "examples/workflow-standard-steps/files/plugins-starter.yaml" \ 137 | -G "examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5/plugins.yaml" \ 138 | -c "examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5/plugin-catalog.yaml" 139 | ``` 140 | 141 | As expected, the resulting `plugins.yaml` is identical to our input `plugins-starter.yaml`. This is because we are generating files for the same CloudBees CI version. 142 | 143 | ```sh 144 | diff target/2.387.3.5/mm/plugins.yaml.orig.yaml examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5/plugins.yaml 145 | ``` 146 | 147 | From now on, we no longer need the separate starter file. Instead we can use the actual `examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5/plugins.yaml` as our reference file. 148 | 149 | Running the following is identical to using the starter file, but with in place updates: 150 | 151 | ```sh 152 | ./run.sh -v "2.387.3.5" \ 153 | -s \ 154 | -A \ 155 | -f "examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5/plugins.yaml" \ 156 | -G "examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5/plugins.yaml" \ 157 | -c "examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5/plugin-catalog.yaml" 158 | ``` 159 | 160 | Let's see what happens when we upgrade! 161 | 162 | ## Updating your `plugins.yaml` and `plugin-catalog.yaml` 163 | 164 | :information_source: **handling changes to plugins and versions:** the bundle directories in this example are separated by CI version in order to show the differences between updates. However, you may wish to use the same directory and version your changes through git commits. 165 | 166 | Using only the `src` plugins of our newly created reference file (in the `bundle-v2.387.3.5` bundle), we can create the files for our upcoming upgrade to `2.414.1.4`: 167 | 168 | ```sh 169 | ./run.sh -v "2.414.1.4" \ 170 | -s \ 171 | -A \ 172 | -f "examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5/plugins.yaml" \ 173 | -G "examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4/plugins.yaml" \ 174 | -c "examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4/plugin-catalog.yaml" 175 | ``` 176 | 177 | Looking at the differences, you can see that upgraded `plugins.yaml` now has an additional dependency plugin `aws-java-sdk-kinesis` as well as the usual version changes in the `plugin-catalog.yaml` files: 178 | 179 | ```sh 180 | ❯ diff examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5/plugins.yaml examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4/plugins.yaml 181 | 28a29 182 | > - id: aws-java-sdk-kinesis # 3rd dep 183 | ``` 184 | 185 | ### The reasoning behind the `-A` source plugins only option 186 | 187 | So, now we have a new file for `2.414.1.4` which contains additional plugins which were not present in a previous version `2.387.3.5`. 188 | 189 | :warning: Following the same logic, a dependency could also be removed in a future release. 190 | 191 | If we were to try and recreate files for the older `2.387.3.5` but using our plugin list from `2.414.1.4` the script would fail with: 192 | 193 | ```sh 194 | ❯ ./run.sh -v 2.387.3.5 -f examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4/plugins.yaml -s 195 | INFO: CI_VERSION set to '2.387.3.5'. 196 | ... 197 | ... 198 | INFO: Sanity checking 'examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4/plugins.yaml' for missing online plugins. 199 | WARN: Missing online plugin 'aws-java-sdk-kinesis' which does not have a custom version or URL annotation. 200 | ERROR: PLUGINS_MISSING_ONLINE: see above. 201 | 202 | ``` 203 | 204 | Using the `-A` option allows us to recreate files using just the source plugins, in effect making it a static set of plugins you wish to install from which to recreate viable lists for all versions. 205 | 206 | To test, we repeat the command, but this time with the `-A` option: 207 | 208 | ```sh 209 | ./run.sh -v 2.387.3.5 -f examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4/plugins.yaml -s -A 210 | ``` 211 | 212 | This time it succeeds. 213 | 214 | Comparing the input list with the newly created minimal list, we see that the `aws-java-sdk-kinesis` has been removed: 215 | 216 | ```sh 217 | ❯ diff "target/2.387.3.5/mm/plugins.yaml.orig.yaml" "target/2.387.3.5/mm/plugins-minimal.yaml" 218 | 29d28 219 | < - id: aws-java-sdk-kinesis # 3rd dep 220 | ``` 221 | 222 | ## Making changes 223 | 224 | Now that we have our reference file with `src` plugins marked accordingly, making changes is relatively easy. 225 | 226 | ### Adding a plugin 227 | 228 | Files found in `*-add`. 229 | 230 | Consider we want the `basic-branch-build-strategies` plugin. We can edit the reference file, adding the plugin and marking as `src` 231 | 232 | ```yaml 233 | - id: basic-branch-build-strategies # src 234 | ``` 235 | 236 | Then recreate the necessary files using the now edited file: 237 | 238 | ```sh 239 | ./run.sh -v "2.387.3.5" \ 240 | -s \ 241 | -A \ 242 | -f "examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-add/plugins.yaml" \ 243 | -G "examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-add/plugins.yaml" \ 244 | -c "examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-add/plugin-catalog.yaml" 245 | ``` 246 | 247 | The new files now include the `branch-api` as a dependency of the `basic-branch-build-strategies` plugin. 248 | 249 | ```sh 250 | ❯ diff -r examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5 examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-add 251 | diff --color -r examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5/plugin-catalog.yaml examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-add/plugin-catalog.yaml 252 | 31a32,33 253 | > basic-branch-build-strategies: 254 | > version: "71.vc1421f89888e" 255 | diff --color -r examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5/plugins.yaml examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-add/plugins.yaml 256 | 32a33,34 257 | > - id: basic-branch-build-strategies # 3rd src 258 | > - id: branch-api # cap dep 259 | ``` 260 | 261 | And, as before, the same can be performed for `2.414.1.4`: 262 | 263 | ```sh 264 | ./run.sh -v "2.414.1.4" \ 265 | -s \ 266 | -A \ 267 | -f "examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-add/plugins.yaml" \ 268 | -G "examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4-additional-plugin/plugins.yaml" \ 269 | -c "examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4-additional-plugin/plugin-catalog.yaml" 270 | ``` 271 | 272 | Results are similar, just with updated versions of the plugins: 273 | 274 | ```sh 275 | ❯ diff -r examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4 examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4-add 276 | diff --color -r examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4/plugin-catalog.yaml examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4-add/plugin-catalog.yaml 277 | 33a34,35 278 | > basic-branch-build-strategies: 279 | > version: "81.v05e333931c7d" 280 | diff --color -r examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4/plugins.yaml examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4-add/plugins.yaml 281 | 33a34,35 282 | > - id: basic-branch-build-strategies # 3rd src 283 | > - id: branch-api # cap dep 284 | ``` 285 | 286 | ### Removing a plugin 287 | 288 | Files found in `*-remove`. 289 | 290 | Consider we want to now remove the `basic-branch-build-strategies` plugin. We can edit the reference file, removing the plugin (NOTE: the `branch-api` dependency is still in the list, but not a src file). 291 | 292 | ```sh 293 | ❯ diff -r examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-add/plugins.yaml examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-remove/plugins.yaml 294 | 33d32 295 | < - id: basic-branch-build-strategies # 3rd src 296 | ``` 297 | 298 | Then recreate the necessary files using the now edited file: 299 | 300 | ```sh 301 | ./run.sh -v "2.387.3.5" \ 302 | -s \ 303 | -A \ 304 | -f "examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-remove/plugins.yaml" \ 305 | -G "examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-remove/plugins.yaml" \ 306 | -c "examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-remove/plugin-catalog.yaml" 307 | ``` 308 | 309 | The new files now reference neither plugin nor depedency. 310 | 311 | ```sh 312 | ❯ diff -r examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-add examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-remove 313 | diff --color -r examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-add/plugin-catalog.yaml examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-remove/plugin-catalog.yaml 314 | 32,33d31 315 | < basic-branch-build-strategies: 316 | < version: "71.vc1421f89888e" 317 | diff --color -r examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-add/plugins.yaml examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-remove/plugins.yaml 318 | 33,34d32 319 | < - id: basic-branch-build-strategies # 3rd src 320 | < - id: branch-api # cap dep 321 | ``` 322 | -------------------------------------------------------------------------------- /examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-add/plugin-catalog.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | aws-java-sdk: 11 | version: "1.12.406-374.v4cdf53953691" 12 | aws-java-sdk-cloudformation: 13 | version: "1.12.406-374.v4cdf53953691" 14 | aws-java-sdk-codebuild: 15 | version: "1.12.406-374.v4cdf53953691" 16 | aws-java-sdk-ecr: 17 | version: "1.12.406-374.v4cdf53953691" 18 | aws-java-sdk-ecs: 19 | version: "1.12.406-374.v4cdf53953691" 20 | aws-java-sdk-efs: 21 | version: "1.12.406-374.v4cdf53953691" 22 | aws-java-sdk-iam: 23 | version: "1.12.406-374.v4cdf53953691" 24 | aws-java-sdk-logs: 25 | version: "1.12.406-374.v4cdf53953691" 26 | aws-java-sdk-sns: 27 | version: "1.12.406-374.v4cdf53953691" 28 | aws-java-sdk-sqs: 29 | version: "1.12.406-374.v4cdf53953691" 30 | aws-java-sdk-ssm: 31 | version: "1.12.406-374.v4cdf53953691" 32 | basic-branch-build-strategies: 33 | version: "71.vc1421f89888e" 34 | ec2-fleet: 35 | version: "3.0.0" 36 | mock-security-realm: 37 | version: "54.v07143c60a_992" 38 | -------------------------------------------------------------------------------- /examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-add/plugins.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | # we want to keep this plugin regardless - src added manually 19 | - id: aws-credentials # cap dep src 20 | - id: aws-java-sdk # 3rd dep 21 | - id: aws-java-sdk-cloudformation # 3rd dep 22 | - id: aws-java-sdk-codebuild # 3rd dep 23 | - id: aws-java-sdk-ecr # 3rd dep 24 | - id: aws-java-sdk-ecs # 3rd dep 25 | - id: aws-java-sdk-efs # 3rd dep 26 | - id: aws-java-sdk-elasticbeanstalk # cap dep 27 | - id: aws-java-sdk-iam # 3rd dep 28 | - id: aws-java-sdk-logs # 3rd dep 29 | - id: aws-java-sdk-sns # 3rd dep 30 | - id: aws-java-sdk-sqs # 3rd dep 31 | - id: aws-java-sdk-ssm # 3rd dep 32 | - id: basic-branch-build-strategies # 3rd src 33 | - id: branch-api # cap dep 34 | - id: cloudbees-casc-client # cap src 35 | - id: cloudbees-casc-items-controller # cap src 36 | - id: configuration-as-code # cap src 37 | - id: ec2-fleet # 3rd src 38 | - id: email-ext # cap src 39 | - id: mock-security-realm # 3rd src 40 | - id: ssh-slaves # cap dep 41 | - id: sshd # cap src 42 | -------------------------------------------------------------------------------- /examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-remove/plugin-catalog.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | aws-java-sdk: 11 | version: "1.12.406-374.v4cdf53953691" 12 | aws-java-sdk-cloudformation: 13 | version: "1.12.406-374.v4cdf53953691" 14 | aws-java-sdk-codebuild: 15 | version: "1.12.406-374.v4cdf53953691" 16 | aws-java-sdk-ecr: 17 | version: "1.12.406-374.v4cdf53953691" 18 | aws-java-sdk-ecs: 19 | version: "1.12.406-374.v4cdf53953691" 20 | aws-java-sdk-efs: 21 | version: "1.12.406-374.v4cdf53953691" 22 | aws-java-sdk-iam: 23 | version: "1.12.406-374.v4cdf53953691" 24 | aws-java-sdk-logs: 25 | version: "1.12.406-374.v4cdf53953691" 26 | aws-java-sdk-sns: 27 | version: "1.12.406-374.v4cdf53953691" 28 | aws-java-sdk-sqs: 29 | version: "1.12.406-374.v4cdf53953691" 30 | aws-java-sdk-ssm: 31 | version: "1.12.406-374.v4cdf53953691" 32 | ec2-fleet: 33 | version: "3.0.0" 34 | mock-security-realm: 35 | version: "54.v07143c60a_992" 36 | -------------------------------------------------------------------------------- /examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5-remove/plugins.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | # we want to keep this plugin regardless - src added manually 19 | - id: aws-credentials # cap dep src 20 | - id: aws-java-sdk # 3rd dep 21 | - id: aws-java-sdk-cloudformation # 3rd dep 22 | - id: aws-java-sdk-codebuild # 3rd dep 23 | - id: aws-java-sdk-ecr # 3rd dep 24 | - id: aws-java-sdk-ecs # 3rd dep 25 | - id: aws-java-sdk-efs # 3rd dep 26 | - id: aws-java-sdk-elasticbeanstalk # cap dep 27 | - id: aws-java-sdk-iam # 3rd dep 28 | - id: aws-java-sdk-logs # 3rd dep 29 | - id: aws-java-sdk-sns # 3rd dep 30 | - id: aws-java-sdk-sqs # 3rd dep 31 | - id: aws-java-sdk-ssm # 3rd dep 32 | - id: cloudbees-casc-client # cap src 33 | - id: cloudbees-casc-items-controller # cap src 34 | - id: configuration-as-code # cap src 35 | - id: ec2-fleet # 3rd src 36 | - id: email-ext # cap src 37 | - id: mock-security-realm # 3rd src 38 | - id: ssh-slaves # cap dep 39 | - id: sshd # cap src 40 | -------------------------------------------------------------------------------- /examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5/plugin-catalog.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | aws-java-sdk: 11 | version: "1.12.406-374.v4cdf53953691" 12 | aws-java-sdk-cloudformation: 13 | version: "1.12.406-374.v4cdf53953691" 14 | aws-java-sdk-codebuild: 15 | version: "1.12.406-374.v4cdf53953691" 16 | aws-java-sdk-ecr: 17 | version: "1.12.406-374.v4cdf53953691" 18 | aws-java-sdk-ecs: 19 | version: "1.12.406-374.v4cdf53953691" 20 | aws-java-sdk-efs: 21 | version: "1.12.406-374.v4cdf53953691" 22 | aws-java-sdk-iam: 23 | version: "1.12.406-374.v4cdf53953691" 24 | aws-java-sdk-logs: 25 | version: "1.12.406-374.v4cdf53953691" 26 | aws-java-sdk-sns: 27 | version: "1.12.406-374.v4cdf53953691" 28 | aws-java-sdk-sqs: 29 | version: "1.12.406-374.v4cdf53953691" 30 | aws-java-sdk-ssm: 31 | version: "1.12.406-374.v4cdf53953691" 32 | ec2-fleet: 33 | version: "3.0.0" 34 | mock-security-realm: 35 | version: "54.v07143c60a_992" 36 | -------------------------------------------------------------------------------- /examples/workflow-standard-steps/files/bundles/bundle-v2.387.3.5/plugins.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | # we want to keep this plugin regardless - src added manually 19 | - id: aws-credentials # cap dep src 20 | - id: aws-java-sdk # 3rd dep 21 | - id: aws-java-sdk-cloudformation # 3rd dep 22 | - id: aws-java-sdk-codebuild # 3rd dep 23 | - id: aws-java-sdk-ecr # 3rd dep 24 | - id: aws-java-sdk-ecs # 3rd dep 25 | - id: aws-java-sdk-efs # 3rd dep 26 | - id: aws-java-sdk-elasticbeanstalk # cap dep 27 | - id: aws-java-sdk-iam # 3rd dep 28 | - id: aws-java-sdk-logs # 3rd dep 29 | - id: aws-java-sdk-sns # 3rd dep 30 | - id: aws-java-sdk-sqs # 3rd dep 31 | - id: aws-java-sdk-ssm # 3rd dep 32 | - id: cloudbees-casc-client # cap src 33 | - id: cloudbees-casc-items-controller # cap src 34 | - id: configuration-as-code # cap src 35 | - id: ec2-fleet # 3rd src 36 | - id: email-ext # cap src 37 | - id: mock-security-realm # 3rd src 38 | - id: ssh-slaves # cap dep 39 | - id: sshd # cap src 40 | -------------------------------------------------------------------------------- /examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4-add/plugin-catalog.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.414.1.4" 7 | prerequisites: 8 | productVersion: "[2.414.1.4]" 9 | includePlugins: 10 | aws-java-sdk: 11 | version: "1.12.481-392.v8b_291cfcda_09" 12 | aws-java-sdk-cloudformation: 13 | version: "1.12.481-392.v8b_291cfcda_09" 14 | aws-java-sdk-codebuild: 15 | version: "1.12.481-392.v8b_291cfcda_09" 16 | aws-java-sdk-ecr: 17 | version: "1.12.481-392.v8b_291cfcda_09" 18 | aws-java-sdk-ecs: 19 | version: "1.12.481-392.v8b_291cfcda_09" 20 | aws-java-sdk-efs: 21 | version: "1.12.481-392.v8b_291cfcda_09" 22 | aws-java-sdk-iam: 23 | version: "1.12.481-392.v8b_291cfcda_09" 24 | aws-java-sdk-kinesis: 25 | version: "1.12.481-392.v8b_291cfcda_09" 26 | aws-java-sdk-logs: 27 | version: "1.12.481-392.v8b_291cfcda_09" 28 | aws-java-sdk-sns: 29 | version: "1.12.481-392.v8b_291cfcda_09" 30 | aws-java-sdk-sqs: 31 | version: "1.12.481-392.v8b_291cfcda_09" 32 | aws-java-sdk-ssm: 33 | version: "1.12.481-392.v8b_291cfcda_09" 34 | basic-branch-build-strategies: 35 | version: "81.v05e333931c7d" 36 | ec2-fleet: 37 | version: "3.0.0" 38 | mock-security-realm: 39 | version: "54.v07143c60a_992" 40 | -------------------------------------------------------------------------------- /examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4-add/plugins.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | # we want to keep this plugin regardless - src added manually 19 | - id: aws-credentials # cap dep src 20 | - id: aws-java-sdk # 3rd dep 21 | - id: aws-java-sdk-cloudformation # 3rd dep 22 | - id: aws-java-sdk-codebuild # 3rd dep 23 | - id: aws-java-sdk-ecr # 3rd dep 24 | - id: aws-java-sdk-ecs # 3rd dep 25 | - id: aws-java-sdk-efs # 3rd dep 26 | - id: aws-java-sdk-elasticbeanstalk # cap dep 27 | - id: aws-java-sdk-iam # 3rd dep 28 | - id: aws-java-sdk-kinesis # 3rd dep 29 | - id: aws-java-sdk-logs # 3rd dep 30 | - id: aws-java-sdk-sns # 3rd dep 31 | - id: aws-java-sdk-sqs # 3rd dep 32 | - id: aws-java-sdk-ssm # 3rd dep 33 | - id: basic-branch-build-strategies # 3rd src 34 | - id: branch-api # cap dep 35 | - id: cloudbees-casc-client # cap src 36 | - id: cloudbees-casc-items-controller # cap src 37 | - id: configuration-as-code # cap src 38 | - id: ec2-fleet # 3rd src 39 | - id: email-ext # cap src 40 | - id: mock-security-realm # 3rd src 41 | - id: ssh-slaves # cap dep 42 | - id: sshd # cap src 43 | -------------------------------------------------------------------------------- /examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4/plugin-catalog.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.414.1.4" 7 | prerequisites: 8 | productVersion: "[2.414.1.4]" 9 | includePlugins: 10 | aws-java-sdk: 11 | version: "1.12.481-392.v8b_291cfcda_09" 12 | aws-java-sdk-cloudformation: 13 | version: "1.12.481-392.v8b_291cfcda_09" 14 | aws-java-sdk-codebuild: 15 | version: "1.12.481-392.v8b_291cfcda_09" 16 | aws-java-sdk-ecr: 17 | version: "1.12.481-392.v8b_291cfcda_09" 18 | aws-java-sdk-ecs: 19 | version: "1.12.481-392.v8b_291cfcda_09" 20 | aws-java-sdk-efs: 21 | version: "1.12.481-392.v8b_291cfcda_09" 22 | aws-java-sdk-iam: 23 | version: "1.12.481-392.v8b_291cfcda_09" 24 | aws-java-sdk-kinesis: 25 | version: "1.12.481-392.v8b_291cfcda_09" 26 | aws-java-sdk-logs: 27 | version: "1.12.481-392.v8b_291cfcda_09" 28 | aws-java-sdk-sns: 29 | version: "1.12.481-392.v8b_291cfcda_09" 30 | aws-java-sdk-sqs: 31 | version: "1.12.481-392.v8b_291cfcda_09" 32 | aws-java-sdk-ssm: 33 | version: "1.12.481-392.v8b_291cfcda_09" 34 | ec2-fleet: 35 | version: "3.0.0" 36 | mock-security-realm: 37 | version: "54.v07143c60a_992" 38 | -------------------------------------------------------------------------------- /examples/workflow-standard-steps/files/bundles/bundle-v2.414.1.4/plugins.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | # we want to keep this plugin regardless - src added manually 19 | - id: aws-credentials # cap dep src 20 | - id: aws-java-sdk # 3rd dep 21 | - id: aws-java-sdk-cloudformation # 3rd dep 22 | - id: aws-java-sdk-codebuild # 3rd dep 23 | - id: aws-java-sdk-ecr # 3rd dep 24 | - id: aws-java-sdk-ecs # 3rd dep 25 | - id: aws-java-sdk-efs # 3rd dep 26 | - id: aws-java-sdk-elasticbeanstalk # cap dep 27 | - id: aws-java-sdk-iam # 3rd dep 28 | - id: aws-java-sdk-kinesis # 3rd dep 29 | - id: aws-java-sdk-logs # 3rd dep 30 | - id: aws-java-sdk-sns # 3rd dep 31 | - id: aws-java-sdk-sqs # 3rd dep 32 | - id: aws-java-sdk-ssm # 3rd dep 33 | - id: cloudbees-casc-client # cap src 34 | - id: cloudbees-casc-items-controller # cap src 35 | - id: configuration-as-code # cap src 36 | - id: ec2-fleet # 3rd src 37 | - id: email-ext # cap src 38 | - id: mock-security-realm # 3rd src 39 | - id: ssh-slaves # cap dep 40 | - id: sshd # cap src 41 | -------------------------------------------------------------------------------- /examples/workflow-standard-steps/files/plugins-minimal.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: aws-credentials # cap dep 19 | - id: aws-java-sdk # 3rd dep 20 | - id: aws-java-sdk-cloudformation # 3rd dep 21 | - id: aws-java-sdk-codebuild # 3rd dep 22 | - id: aws-java-sdk-ecr # 3rd dep 23 | - id: aws-java-sdk-ecs # 3rd dep 24 | - id: aws-java-sdk-efs # 3rd dep 25 | - id: aws-java-sdk-elasticbeanstalk # cap dep 26 | - id: aws-java-sdk-iam # 3rd dep 27 | - id: aws-java-sdk-logs # 3rd dep 28 | - id: aws-java-sdk-sns # 3rd dep 29 | - id: aws-java-sdk-sqs # 3rd dep 30 | - id: aws-java-sdk-ssm # 3rd dep 31 | - id: cloudbees-casc-client # cap src 32 | - id: cloudbees-casc-items-controller # cap src 33 | - id: configuration-as-code # cap src 34 | - id: ec2-fleet # 3rd src 35 | - id: email-ext # cap src 36 | - id: mock-security-realm # 3rd src 37 | - id: ssh-slaves # cap dep 38 | - id: sshd # cap src 39 | -------------------------------------------------------------------------------- /examples/workflow-standard-steps/files/plugins-raw.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - id: apache-httpcomponents-client-4-api 3 | - id: aws-credentials 4 | - id: aws-java-sdk 5 | - id: aws-java-sdk-cloudformation 6 | - id: aws-java-sdk-codebuild 7 | - id: aws-java-sdk-ec2 8 | - id: aws-java-sdk-ecr 9 | - id: aws-java-sdk-ecs 10 | - id: aws-java-sdk-efs 11 | - id: aws-java-sdk-elasticbeanstalk 12 | - id: aws-java-sdk-iam 13 | - id: aws-java-sdk-logs 14 | - id: aws-java-sdk-minimal 15 | - id: aws-java-sdk-sns 16 | - id: aws-java-sdk-sqs 17 | - id: aws-java-sdk-ssm 18 | - id: blueocean-commons 19 | - id: bootstrap5-api 20 | - id: bouncycastle-api 21 | - id: caffeine-api 22 | - id: checks-api 23 | - id: cloudbees-administrative-monitors 24 | - id: cloudbees-analytics 25 | - id: cloudbees-assurance 26 | - id: cloudbees-blueocean-default-theme 27 | - id: cloudbees-casc-client 28 | - id: cloudbees-casc-items-api 29 | - id: cloudbees-casc-items-commons 30 | - id: cloudbees-casc-items-controller 31 | - id: cloudbees-folder 32 | - id: cloudbees-folders-plus 33 | - id: cloudbees-license 34 | - id: cloudbees-platform-common 35 | - id: cloudbees-platform-data 36 | - id: cloudbees-plugin-usage 37 | - id: cloudbees-uc-data-api 38 | - id: cloudbees-unified-ui 39 | - id: command-launcher 40 | - id: commons-lang3-api 41 | - id: commons-text-api 42 | - id: configuration-as-code 43 | - id: credentials 44 | - id: credentials-binding 45 | - id: display-url-api 46 | - id: ec2-fleet 47 | - id: echarts-api 48 | - id: email-ext 49 | - id: font-awesome-api 50 | - id: handy-uri-templates-2-api 51 | - id: instance-identity 52 | - id: ionicons-api 53 | - id: jackson2-api 54 | - id: jakarta-activation-api 55 | - id: jakarta-mail-api 56 | - id: javax-activation-api 57 | - id: javax-mail-api 58 | - id: jaxb 59 | - id: jdk-tool 60 | - id: jjwt-api 61 | - id: jquery3-api 62 | - id: junit 63 | - id: mailer 64 | - id: mapdb-api 65 | - id: matrix-project 66 | - id: metrics 67 | - id: mina-sshd-api-common 68 | - id: mina-sshd-api-core 69 | - id: mock-security-realm 70 | - id: nectar-license 71 | - id: nectar-rbac 72 | - id: okhttp-api 73 | - id: operations-center-agent 74 | - id: operations-center-client 75 | - id: operations-center-context 76 | - id: plain-credentials 77 | - id: plugin-util-api 78 | - id: scm-api 79 | - id: script-security 80 | - id: snakeyaml-api 81 | - id: ssh-credentials 82 | - id: ssh-slaves 83 | - id: sshd 84 | - id: structs 85 | - id: support-core 86 | - id: token-macro 87 | - id: trilead-api 88 | - id: user-activity-monitoring 89 | - id: variant 90 | - id: workflow-api 91 | - id: workflow-step-api 92 | - id: workflow-support 93 | -------------------------------------------------------------------------------- /examples/workflow-standard-steps/files/plugins-starter.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | # we want to keep this plugin regardless - src added manually 19 | - id: aws-credentials # cap dep src 20 | - id: aws-java-sdk # 3rd dep 21 | - id: aws-java-sdk-cloudformation # 3rd dep 22 | - id: aws-java-sdk-codebuild # 3rd dep 23 | - id: aws-java-sdk-ecr # 3rd dep 24 | - id: aws-java-sdk-ecs # 3rd dep 25 | - id: aws-java-sdk-efs # 3rd dep 26 | - id: aws-java-sdk-elasticbeanstalk # cap dep 27 | - id: aws-java-sdk-iam # 3rd dep 28 | - id: aws-java-sdk-logs # 3rd dep 29 | - id: aws-java-sdk-sns # 3rd dep 30 | - id: aws-java-sdk-sqs # 3rd dep 31 | - id: aws-java-sdk-ssm # 3rd dep 32 | - id: cloudbees-casc-client # cap src 33 | - id: cloudbees-casc-items-controller # cap src 34 | - id: configuration-as-code # cap src 35 | - id: ec2-fleet # 3rd src 36 | - id: email-ext # cap src 37 | - id: mock-security-realm # 3rd src 38 | - id: ssh-slaves # cap dep 39 | - id: sshd # cap src 40 | -------------------------------------------------------------------------------- /tests/README.md: -------------------------------------------------------------------------------- 1 | # Tests 2 | 3 | 4 | 5 | 6 | - [Running all tests](#running-all-tests) 7 | - [Running a single test](#running-a-single-test) 8 | - [Creating or correcting tests](#creating-or-correcting-tests) 9 | 10 | 11 | 12 | ## Running all tests 13 | 14 | Run the full test suite by running: 15 | 16 | ```sh 17 | ./tests/run.sh 18 | ``` 19 | 20 | ## Running a single test 21 | 22 | Run a single test by passing the test directory name. 23 | 24 | ```sh 25 | ./tests/run.sh simple 26 | ``` 27 | 28 | ## Creating or correcting tests 29 | 30 | Use the `CORRECT_TESTS=1` environment variable to re-align a test in the case of a feature changing the output of the resulting files. 31 | 32 | Create a test by: 33 | 34 | - creating the test directory 35 | - adding the appropriate `source-*.yaml` files 36 | - adding a `command.sh` file (see other files for inspiration) 37 | - perform an initial run with `CORRECT_TESTS=1` 38 | 39 | For example: 40 | 41 | ```sh 42 | # create the new test directory 43 | mkdir tests/my-new-test 44 | 45 | # using the simple test as a starting point 46 | cp tests/simple/source-plugins.yaml tests/my-new-test/source-plugins.yaml 47 | vim tests/my-new-test/source-plugins.yaml 48 | 49 | # using the simple test as a starting point 50 | cp tests/simple/command.sh tests/my-new-test/command.sh 51 | vim tests/my-new-test/command.sh 52 | 53 | # create the expected yamls 54 | CORRECT_TESTS=1 ./tests/run.sh my-new-test 55 | ``` 56 | -------------------------------------------------------------------------------- /tests/complex/command.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | cd "$(cd "$(dirname "$0")" && pwd)" 5 | 6 | "${RUN_CMD}" \ 7 | -v '2.387.3.5' \ 8 | -t mm \ 9 | -f "source-plugins.yaml" \ 10 | -F "actual/plugins.yaml" \ 11 | -c "actual/plugin-catalog.yaml" \ 12 | -C "actual/plugin-catalog-offline.yaml" \ 13 | -s \ 14 | -g "actual/plugins-minimal-for-generation-only.yaml" \ 15 | -G "actual/plugins-minimal.yaml" 16 | -------------------------------------------------------------------------------- /tests/complex/expected/plugin-catalog-offline.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog (offline)" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | ansicolor: 11 | url: "https://jenkins-updates.cloudbees.com/download/plugins/ansicolor/1.0.2/ansicolor.hpi" 12 | artifactory: 13 | url: "https://jenkins-updates.cloudbees.com/download/plugins/artifactory/4.0.6/artifactory.hpi" 14 | aws-java-sdk: 15 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk/1.12.406-374.v4cdf53953691/aws-java-sdk.hpi" 16 | aws-java-sdk-cloudformation: 17 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-cloudformation/1.12.406-374.v4cdf53953691/aws-java-sdk-cloudformation.hpi" 18 | aws-java-sdk-codebuild: 19 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-codebuild/1.12.406-374.v4cdf53953691/aws-java-sdk-codebuild.hpi" 20 | aws-java-sdk-ecr: 21 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-ecr/1.12.406-374.v4cdf53953691/aws-java-sdk-ecr.hpi" 22 | aws-java-sdk-ecs: 23 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-ecs/1.12.406-374.v4cdf53953691/aws-java-sdk-ecs.hpi" 24 | aws-java-sdk-efs: 25 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-efs/1.12.406-374.v4cdf53953691/aws-java-sdk-efs.hpi" 26 | aws-java-sdk-iam: 27 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-iam/1.12.406-374.v4cdf53953691/aws-java-sdk-iam.hpi" 28 | aws-java-sdk-logs: 29 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-logs/1.12.406-374.v4cdf53953691/aws-java-sdk-logs.hpi" 30 | aws-java-sdk-sns: 31 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-sns/1.12.406-374.v4cdf53953691/aws-java-sdk-sns.hpi" 32 | aws-java-sdk-sqs: 33 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-sqs/1.12.406-374.v4cdf53953691/aws-java-sdk-sqs.hpi" 34 | aws-java-sdk-ssm: 35 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-ssm/1.12.406-374.v4cdf53953691/aws-java-sdk-ssm.hpi" 36 | badge: 37 | url: "https://jenkins-updates.cloudbees.com/download/plugins/badge/1.9.1/badge.hpi" 38 | build-failure-analyzer: 39 | url: "https://jenkins-updates.cloudbees.com/download/plugins/build-failure-analyzer/2.4.1/build-failure-analyzer.hpi" 40 | build-monitor-plugin: 41 | url: "https://jenkins-updates.cloudbees.com/download/plugins/build-monitor-plugin/1.14-681.vd6817317a_2b_7/build-monitor-plugin.hpi" 42 | cobertura: 43 | url: "https://jenkins-updates.cloudbees.com/download/plugins/cobertura/1.17/cobertura.hpi" 44 | code-coverage-api: 45 | url: "https://jenkins-updates.cloudbees.com/download/plugins/code-coverage-api/4.4.0/code-coverage-api.hpi" 46 | configuration-as-code-groovy: 47 | url: "https://jenkins-updates.cloudbees.com/download/plugins/configuration-as-code-groovy/1.1/configuration-as-code-groovy.hpi" 48 | ec2-fleet: 49 | url: "https://jenkins-updates.cloudbees.com/download/plugins/ec2-fleet/3.2.0/ec2-fleet.hpi" 50 | envinject: 51 | url: "https://jenkins-updates.cloudbees.com/download/plugins/envinject/2.908.v66a_774b_31d93/envinject.hpi" 52 | envinject-api: 53 | url: "https://jenkins-updates.cloudbees.com/download/plugins/envinject-api/1.199.v3ce31253ed13/envinject-api.hpi" 54 | gerrit-trigger: 55 | url: "https://jenkins-updates.cloudbees.com/download/plugins/gerrit-trigger/2.39.0/gerrit-trigger.hpi" 56 | h2-api: 57 | url: "https://jenkins-updates.cloudbees.com/download/plugins/h2-api/11.1.4.199-12.v9f4244395f7a_/h2-api.hpi" 58 | hashicorp-vault-plugin: 59 | url: "https://jenkins-updates.cloudbees.com/download/plugins/hashicorp-vault-plugin/367.v8a_1ee1cccf3a/hashicorp-vault-plugin.hpi" 60 | ivy: 61 | url: "https://jenkins-updates.cloudbees.com/download/plugins/ivy/2.4/ivy.hpi" 62 | jersey2-api: 63 | url: "https://jenkins-updates.cloudbees.com/download/plugins/jersey2-api/2.39.1-1/jersey2-api.hpi" 64 | job-dsl: 65 | url: "https://jenkins-updates.cloudbees.com/download/plugins/job-dsl/1.83/job-dsl.hpi" 66 | parameterized-scheduler: 67 | url: "https://jenkins-updates.cloudbees.com/download/plugins/parameterized-scheduler/1.2/parameterized-scheduler.hpi" 68 | parameterized-trigger: 69 | url: "https://jenkins-updates.cloudbees.com/download/plugins/parameterized-trigger/2.45/parameterized-trigger.hpi" 70 | pipeline-maven: 71 | url: "https://jenkins-updates.cloudbees.com/download/plugins/pipeline-maven/1274.v870c8cb_fa_369/pipeline-maven.hpi" 72 | pipeline-utility-steps: 73 | url: "https://jenkins-updates.cloudbees.com/download/plugins/pipeline-utility-steps/2.15.1.1/pipeline-utility-steps.hpi" 74 | prometheus: 75 | url: "https://jenkins-updates.cloudbees.com/download/plugins/prometheus/2.2.3/prometheus.hpi" 76 | resource-disposer: 77 | url: "https://jenkins-updates.cloudbees.com/download/plugins/resource-disposer/0.23/resource-disposer.hpi" 78 | robot: 79 | url: "https://jenkins-updates.cloudbees.com/download/plugins/robot/3.5.1/robot.hpi" 80 | slack: 81 | url: "https://jenkins-updates.cloudbees.com/download/plugins/slack/664.vc9a_90f8b_c24a_/slack.hpi" 82 | swarm: 83 | url: "https://jenkins-updates.cloudbees.com/download/plugins/swarm/3.44/swarm.hpi" 84 | throttle-concurrents: 85 | url: "https://jenkins-updates.cloudbees.com/download/plugins/throttle-concurrents/2.13/throttle-concurrents.hpi" 86 | uno-choice: 87 | url: "https://jenkins-updates.cloudbees.com/download/plugins/uno-choice/2.7/uno-choice.hpi" 88 | ws-cleanup: 89 | url: "https://jenkins-updates.cloudbees.com/download/plugins/ws-cleanup/0.45/ws-cleanup.hpi" 90 | -------------------------------------------------------------------------------- /tests/complex/expected/plugin-catalog.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | ansicolor: 11 | version: "1.0.2" 12 | artifactory: 13 | version: "4.0.6" 14 | aws-java-sdk: 15 | version: "1.12.406-374.v4cdf53953691" 16 | aws-java-sdk-cloudformation: 17 | version: "1.12.406-374.v4cdf53953691" 18 | aws-java-sdk-codebuild: 19 | version: "1.12.406-374.v4cdf53953691" 20 | aws-java-sdk-ecr: 21 | version: "1.12.406-374.v4cdf53953691" 22 | aws-java-sdk-ecs: 23 | version: "1.12.406-374.v4cdf53953691" 24 | aws-java-sdk-efs: 25 | version: "1.12.406-374.v4cdf53953691" 26 | aws-java-sdk-iam: 27 | version: "1.12.406-374.v4cdf53953691" 28 | aws-java-sdk-logs: 29 | version: "1.12.406-374.v4cdf53953691" 30 | aws-java-sdk-sns: 31 | version: "1.12.406-374.v4cdf53953691" 32 | aws-java-sdk-sqs: 33 | version: "1.12.406-374.v4cdf53953691" 34 | aws-java-sdk-ssm: 35 | version: "1.12.406-374.v4cdf53953691" 36 | badge: 37 | version: "1.9.1" 38 | build-failure-analyzer: 39 | version: "2.4.1" 40 | build-monitor-plugin: 41 | version: "1.14-681.vd6817317a_2b_7" 42 | cobertura: 43 | version: "1.17" 44 | code-coverage-api: 45 | version: "4.4.0" 46 | configuration-as-code-groovy: 47 | version: "1.1" 48 | ec2-fleet: 49 | version: "3.2.0" 50 | envinject: 51 | version: "2.908.v66a_774b_31d93" 52 | envinject-api: 53 | version: "1.199.v3ce31253ed13" 54 | gerrit-trigger: 55 | version: "2.39.0" 56 | h2-api: 57 | version: "11.1.4.199-12.v9f4244395f7a_" 58 | hashicorp-vault-plugin: 59 | version: "367.v8a_1ee1cccf3a" 60 | ivy: 61 | version: "2.4" 62 | jersey2-api: 63 | version: "2.39.1-1" 64 | job-dsl: 65 | version: "1.83" 66 | parameterized-scheduler: 67 | version: "1.2" 68 | parameterized-trigger: 69 | version: "2.45" 70 | pipeline-maven: 71 | version: "1274.v870c8cb_fa_369" 72 | pipeline-utility-steps: 73 | version: "2.15.1.1" 74 | prometheus: 75 | version: "2.2.3" 76 | resource-disposer: 77 | version: "0.23" 78 | robot: 79 | version: "3.5.1" 80 | slack: 81 | version: "664.vc9a_90f8b_c24a_" 82 | swarm: 83 | version: "3.44" 84 | throttle-concurrents: 85 | version: "2.13" 86 | uno-choice: 87 | version: "2.7" 88 | ws-cleanup: 89 | version: "0.45" 90 | -------------------------------------------------------------------------------- /tests/complex/expected/plugins-minimal-for-generation-only.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: ansicolor # 3rd src 19 | - id: artifactory # 3rd src 20 | - id: badge # 3rd src 21 | - id: blueocean # cap src 22 | - id: build-failure-analyzer # 3rd src 23 | - id: build-monitor-plugin # 3rd src 24 | - id: cloudbees-casc-client # cap src 25 | - id: cloudbees-casc-items-controller # cap src 26 | - id: cloudbees-quiet-start # cap src 27 | - id: cobertura # 3rd src 28 | - id: configuration-as-code-groovy # 3rd src 29 | - id: ec2-fleet # 3rd src 30 | - id: email-ext # cap src 31 | - id: envinject # 3rd src 32 | - id: gerrit-trigger # 3rd src 33 | - id: hashicorp-vault-plugin # 3rd src 34 | - id: ivy # 3rd src 35 | - id: jacoco # cap src 36 | - id: job-dsl # 3rd src 37 | - id: parameterized-scheduler # 3rd src 38 | - id: parameterized-trigger # 3rd src 39 | - id: pipeline-maven # 3rd src 40 | - id: pipeline-stage-view # cap src 41 | - id: pipeline-utility-steps # 3rd src 42 | - id: prometheus # 3rd src 43 | - id: robot # 3rd src 44 | - id: saml # cap src 45 | - id: slack # 3rd src 46 | - id: ssh-agent # cap src 47 | - id: swarm # 3rd src 48 | - id: throttle-concurrents # 3rd src 49 | - id: timestamper # cap src 50 | - id: uno-choice # 3rd src 51 | - id: ws-cleanup # 3rd src 52 | -------------------------------------------------------------------------------- /tests/complex/expected/plugins-minimal.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: ansicolor # 3rd src 19 | - id: ant # cap dep 20 | - id: artifactory # 3rd src 21 | - id: aws-credentials # cap dep 22 | - id: aws-java-sdk # 3rd dep 23 | - id: aws-java-sdk-cloudformation # 3rd dep 24 | - id: aws-java-sdk-codebuild # 3rd dep 25 | - id: aws-java-sdk-ecr # 3rd dep 26 | - id: aws-java-sdk-ecs # 3rd dep 27 | - id: aws-java-sdk-efs # 3rd dep 28 | - id: aws-java-sdk-elasticbeanstalk # cap dep 29 | - id: aws-java-sdk-iam # 3rd dep 30 | - id: aws-java-sdk-logs # 3rd dep 31 | - id: aws-java-sdk-sns # 3rd dep 32 | - id: aws-java-sdk-sqs # 3rd dep 33 | - id: aws-java-sdk-ssm # 3rd dep 34 | - id: badge # 3rd src 35 | - id: blueocean # cap src 36 | - id: build-failure-analyzer # 3rd src 37 | - id: build-monitor-plugin # 3rd src 38 | - id: checks-api # cap dep 39 | - id: cloudbees-casc-client # cap src 40 | - id: cloudbees-casc-items-controller # cap src 41 | - id: cloudbees-quiet-start # cap src 42 | - id: cobertura # 3rd src 43 | - id: code-coverage-api # 3rd dep 44 | - id: config-file-provider # cap dep 45 | - id: configuration-as-code # cap dep 46 | - id: configuration-as-code-groovy # 3rd src 47 | - id: ec2-fleet # 3rd src 48 | - id: email-ext # cap src 49 | - id: envinject # 3rd src 50 | - id: envinject-api # 3rd dep 51 | - id: forensics-api # cap dep 52 | - id: gerrit-trigger # 3rd src 53 | - id: gradle # cap dep 54 | - id: h2-api # 3rd dep 55 | - id: hashicorp-vault-plugin # 3rd src 56 | - id: ivy # 3rd src 57 | - id: jacoco # cap src 58 | - id: jersey2-api # 3rd dep 59 | - id: job-dsl # 3rd src 60 | - id: maven-plugin # cap dep 61 | - id: parameterized-scheduler # 3rd src 62 | - id: parameterized-trigger # 3rd src 63 | - id: pipeline-maven # 3rd src 64 | - id: pipeline-stage-view # cap src 65 | - id: pipeline-utility-steps # 3rd src 66 | - id: prism-api # cap dep 67 | - id: prometheus # 3rd src 68 | - id: resource-disposer # 3rd dep 69 | - id: robot # 3rd src 70 | - id: saml # cap src 71 | - id: slack # 3rd src 72 | - id: ssh-agent # cap src 73 | - id: ssh-slaves # cap dep 74 | - id: swarm # 3rd src 75 | - id: throttle-concurrents # 3rd src 76 | - id: timestamper # cap src 77 | - id: uno-choice # 3rd src 78 | - id: ws-cleanup # 3rd src 79 | -------------------------------------------------------------------------------- /tests/complex/expected/plugins.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: ansicolor # 3rd src 19 | - id: ant # cap dep 20 | - id: antisamy-markup-formatter # cap dep 21 | - id: artifactory # 3rd src 22 | - id: aws-credentials # cap dep 23 | - id: aws-java-sdk # 3rd dep 24 | - id: aws-java-sdk-cloudformation # 3rd dep 25 | - id: aws-java-sdk-codebuild # 3rd dep 26 | - id: aws-java-sdk-ec2 # cap dep 27 | - id: aws-java-sdk-ecr # 3rd dep 28 | - id: aws-java-sdk-ecs # 3rd dep 29 | - id: aws-java-sdk-efs # 3rd dep 30 | - id: aws-java-sdk-elasticbeanstalk # cap dep 31 | - id: aws-java-sdk-iam # 3rd dep 32 | - id: aws-java-sdk-logs # 3rd dep 33 | - id: aws-java-sdk-minimal # cap dep 34 | - id: aws-java-sdk-sns # 3rd dep 35 | - id: aws-java-sdk-sqs # 3rd dep 36 | - id: aws-java-sdk-ssm # 3rd dep 37 | - id: badge # 3rd src 38 | - id: blueocean # cap src 39 | - id: bootstrap5-api # cap dep 40 | - id: branch-api # cap dep 41 | - id: build-failure-analyzer # 3rd src 42 | - id: build-monitor-plugin # 3rd src 43 | - id: checks-api # cap dep 44 | - id: cloudbees-casc-client # cap src 45 | - id: cloudbees-casc-items-api # cap dep 46 | - id: cloudbees-casc-items-commons # cap dep 47 | - id: cloudbees-casc-items-controller # cap src 48 | - id: cloudbees-quiet-start # cap src 49 | - id: cobertura # 3rd src 50 | - id: code-coverage-api # 3rd dep 51 | - id: config-file-provider # cap dep 52 | - id: configuration-as-code # cap dep 53 | - id: configuration-as-code-groovy # 3rd src 54 | - id: data-tables-api # cap dep 55 | - id: ec2-fleet # 3rd src 56 | - id: echarts-api # cap dep 57 | - id: email-ext # cap src 58 | - id: envinject # 3rd src 59 | - id: envinject-api # 3rd dep 60 | - id: favorite # cap dep 61 | - id: font-awesome-api # cap dep 62 | - id: forensics-api # cap dep 63 | - id: gerrit-trigger # 3rd src 64 | - id: git # cap dep 65 | - id: git-client # cap dep 66 | - id: github # cap dep 67 | - id: github-api # cap dep 68 | - id: github-branch-source # cap dep 69 | - id: gradle # cap dep 70 | - id: h2-api # 3rd dep 71 | - id: hashicorp-vault-plugin # 3rd src 72 | - id: htmlpublisher # cap dep 73 | - id: ivy # 3rd src 74 | - id: jacoco # cap src 75 | - id: jersey2-api # 3rd dep 76 | - id: job-dsl # 3rd src 77 | - id: junit # cap dep 78 | - id: mailer # cap bst 79 | - id: matrix-project # cap dep 80 | - id: maven-plugin # cap dep 81 | - id: parameterized-scheduler # 3rd src 82 | - id: parameterized-trigger # 3rd src 83 | - id: pipeline-maven # 3rd src 84 | - id: pipeline-rest-api # cap dep 85 | - id: pipeline-stage-view # cap src 86 | - id: pipeline-utility-steps # 3rd src 87 | - id: plugin-util-api # cap dep 88 | - id: prism-api # cap dep 89 | - id: prometheus # 3rd src 90 | - id: resource-disposer # 3rd dep 91 | - id: robot # 3rd src 92 | - id: saml # cap src 93 | - id: slack # 3rd src 94 | - id: ssh-agent # cap src 95 | - id: ssh-slaves # cap dep 96 | - id: swarm # 3rd src 97 | - id: throttle-concurrents # 3rd src 98 | - id: timestamper # cap src 99 | - id: uno-choice # 3rd src 100 | - id: workflow-multibranch # cap dep 101 | - id: ws-cleanup # 3rd src 102 | -------------------------------------------------------------------------------- /tests/complex/source-plugins.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - id: ansicolor 3 | - id: ant 4 | - id: artifactory 5 | - id: aws-credentials 6 | - id: aws-java-sdk 7 | - id: aws-java-sdk-cloudformation 8 | - id: aws-java-sdk-codebuild 9 | - id: aws-java-sdk-ec2 10 | - id: aws-java-sdk-ecr 11 | - id: aws-java-sdk-ecs 12 | - id: aws-java-sdk-efs 13 | - id: aws-java-sdk-elasticbeanstalk 14 | - id: aws-java-sdk-iam 15 | - id: aws-java-sdk-logs 16 | - id: aws-java-sdk-minimal 17 | - id: aws-java-sdk-sns 18 | - id: aws-java-sdk-sqs 19 | - id: aws-java-sdk-ssm 20 | - id: badge 21 | - id: blueocean 22 | - id: branch-api 23 | - id: build-failure-analyzer 24 | - id: build-monitor-plugin 25 | - id: cobertura 26 | - id: code-coverage-api 27 | - id: config-file-provider 28 | - id: configuration-as-code 29 | - id: configuration-as-code-groovy 30 | - id: cloudbees-casc-client 31 | - id: cloudbees-casc-items-api 32 | - id: cloudbees-casc-items-commons 33 | - id: cloudbees-casc-items-controller 34 | - id: ec2-fleet 35 | - id: data-tables-api 36 | - id: email-ext 37 | - id: envinject 38 | - id: envinject-api 39 | - id: favorite 40 | - id: forensics-api 41 | - id: gerrit-trigger 42 | - id: git 43 | - id: git-client 44 | - id: github 45 | - id: github-api 46 | - id: github-branch-source 47 | - id: gradle 48 | - id: hashicorp-vault-plugin 49 | - id: htmlpublisher 50 | - id: jacoco 51 | - id: job-dsl 52 | - id: mailer 53 | - id: matrix-project 54 | - id: maven-plugin 55 | - id: parameterized-scheduler 56 | - id: parameterized-trigger 57 | - id: pipeline-stage-view 58 | - id: prism-api 59 | - id: prometheus 60 | - id: cloudbees-quiet-start 61 | - id: resource-disposer 62 | - id: robot 63 | - id: saml 64 | - id: slack 65 | - id: ssh-agent 66 | - id: ssh-slaves 67 | - id: swarm 68 | - id: throttle-concurrents 69 | - id: timestamper 70 | - id: uno-choice 71 | - id: workflow-multibranch 72 | - id: ws-cleanup 73 | - id: ivy 74 | - id: junit 75 | - id: pipeline-utility-steps 76 | - id: pipeline-maven 77 | - id: h2-api -------------------------------------------------------------------------------- /tests/multi-files/command.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | cd "$(cd "$(dirname "$0")" && pwd)" 5 | 6 | "${RUN_CMD}" \ 7 | -v '2.387.3.5,2.401.2.3' \ 8 | -t mm \ 9 | -f "source-plugins-core.yaml" \ 10 | -f "source-plugins-additional.yaml" \ 11 | -s \ 12 | -G "actual/plugins-minimal.yaml" \ 13 | && die "TEST ERROR: Should have failed with a 'duplicate plugins' exception" \ 14 | || echo "TEST INFO: the error above is expected. Now running with deduplication." 15 | 16 | "${RUN_CMD}" \ 17 | -v '2.387.3.5,2.401.2.3' \ 18 | -t mm \ 19 | -M \ 20 | -f "source-plugins-core.yaml" \ 21 | -f "source-plugins-additional.yaml" \ 22 | -F "actual/plugins.yaml" \ 23 | -c "actual/plugin-catalog.yaml" \ 24 | -C "actual/plugin-catalog-offline.yaml" \ 25 | -s \ 26 | -g "actual/plugins-minimal-for-generation-only.yaml" \ 27 | -G "actual/plugins-minimal.yaml" 28 | -------------------------------------------------------------------------------- /tests/multi-files/expected/plugin-catalog-offline.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog (offline)" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | beer: 11 | url: "https://jenkins-updates.cloudbees.com/download/plugins/beer/42.v776b_04d96de3/beer.hpi" 12 | job-dsl: 13 | url: "https://jenkins-updates.cloudbees.com/download/plugins/job-dsl/1.83/job-dsl.hpi" 14 | - description: "These are Non-CAP plugins for version 2.401.2.3" 15 | prerequisites: 16 | productVersion: "[2.401.2.3]" 17 | includePlugins: 18 | beer: 19 | url: "https://jenkins-updates.cloudbees.com/download/plugins/beer/42.v776b_04d96de3/beer.hpi" 20 | job-dsl: 21 | url: "https://jenkins-updates.cloudbees.com/download/plugins/job-dsl/1.87/job-dsl.hpi" 22 | -------------------------------------------------------------------------------- /tests/multi-files/expected/plugin-catalog.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | beer: 11 | version: "42.v776b_04d96de3" 12 | job-dsl: 13 | version: "1.83" 14 | - description: "These are Non-CAP plugins for version 2.401.2.3" 15 | prerequisites: 16 | productVersion: "[2.401.2.3]" 17 | includePlugins: 18 | beer: 19 | version: "42.v776b_04d96de3" 20 | job-dsl: 21 | version: "1.87" 22 | -------------------------------------------------------------------------------- /tests/multi-files/expected/plugins-minimal-for-generation-only.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: beer # 3rd src 19 | - id: git-client # cap src 20 | - id: job-dsl # 3rd src 21 | -------------------------------------------------------------------------------- /tests/multi-files/expected/plugins-minimal.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: beer # 3rd src 19 | - id: branch-api # cap dep 20 | - id: git-client # cap src 21 | - id: job-dsl # 3rd src 22 | -------------------------------------------------------------------------------- /tests/multi-files/expected/plugins.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: beer # 3rd src 19 | - id: branch-api # cap dep 20 | - id: git-client # cap src 21 | - id: job-dsl # 3rd src 22 | - id: mina-sshd-api-common # cap dep 23 | - id: mina-sshd-api-core # cap dep 24 | -------------------------------------------------------------------------------- /tests/multi-files/source-plugins-additional.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - id: beer 3 | - id: job-dsl 4 | -------------------------------------------------------------------------------- /tests/multi-files/source-plugins-core.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - id: job-dsl 3 | - id: git-client 4 | - id: mina-sshd-api-common 5 | - id: mina-sshd-api-core 6 | -------------------------------------------------------------------------------- /tests/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | # echo to stderr and exit 1 6 | function die() { 7 | errorMe "$@" 8 | exit 1 9 | } 10 | function errorMe() { 11 | cat <<< "ERROR: $*" 1>&2 12 | } 13 | export -f die errorMe 14 | 15 | # tool vars 16 | SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" 17 | CURRENT_DIR=$(pwd) 18 | BASE_DIR=$(dirname "$SCRIPT_DIR") 19 | export RUN_CMD="$BASE_DIR/run.sh" 20 | export TARGET_BASE_DIR="$BASE_DIR/target" 21 | export CACHE_BASE_DIR="$BASE_DIR/.cache" 22 | 23 | # test vars 24 | ALL_TESTS=$(find "$SCRIPT_DIR" -mindepth 1 -maxdepth 1 -type d -printf '%f\n') 25 | TESTS="${1:-$ALL_TESTS}" 26 | CORRECT_TESTS="${CORRECT_TESTS:-0}" 27 | 28 | addSummary() { 29 | TEST_SUMMARY="${TEST_SUMMARY:-Test Summary:\n}$*\n" 30 | } 31 | 32 | DIFF_FOUND_SOMEWHERE='' 33 | for testName in $TESTS; do 34 | testDir="${SCRIPT_DIR}/$testName" 35 | testName=$(basename "$testDir") 36 | echo "=====================================================" 37 | echo "TEST INFO: Testing $testName..." 38 | echo "=====================================================" 39 | expectedDir="${testDir}/expected" 40 | expectedPluginsYaml="${expectedDir}/plugins.yaml" 41 | expectedPluginsYamlMinimal="${expectedDir}/plugins-minimal.yaml" 42 | expectedPluginsYamlMinimalGen="${expectedDir}/plugins-minimal-for-generation-only.yaml" 43 | expectedPluginCatalog="${expectedDir}/plugin-catalog.yaml" 44 | expectedPluginCatalogOffline="${expectedDir}/plugin-catalog-offline.yaml" 45 | actualDir="${testDir}/actual" 46 | actualPluginsYaml="${actualDir}/plugins.yaml" 47 | actualPluginsYamlMinimal="${actualDir}/plugins-minimal.yaml" 48 | actualPluginsYamlMinimalGen="${actualDir}/plugins-minimal-for-generation-only.yaml" 49 | actualPluginCatalog="${actualDir}/plugin-catalog.yaml" 50 | actualPluginCatalogOffline="${actualDir}/plugin-catalog-offline.yaml" 51 | 52 | # ensure files exist 53 | rm -rf "${actualDir}" 54 | mkdir -p "${actualDir}" 55 | mkdir -p "${expectedDir}" 56 | touch \ 57 | "${expectedPluginsYaml}" \ 58 | "${expectedPluginsYamlMinimal}" \ 59 | "${expectedPluginsYamlMinimalGen}" \ 60 | "${expectedPluginCatalog}" \ 61 | "${expectedPluginCatalogOffline}" 62 | 63 | # run command 64 | "${testDir}/command.sh" 65 | 66 | # resulting files exist? 67 | [ -f "${actualPluginsYaml}" ] || die "Resulting file '$actualPluginsYaml' doesn't exist." 68 | [ -f "${actualPluginsYamlMinimal}" ] || die "Resulting file '$actualPluginsYamlMinimal' doesn't exist." 69 | [ -f "${actualPluginsYamlMinimalGen}" ] || die "Resulting file '$actualPluginsYamlMinimalGen' doesn't exist." 70 | [ -f "${actualPluginCatalog}" ] || die "Resulting file '$actualPluginCatalog' doesn't exist." 71 | [ -f "${actualPluginCatalogOffline}" ] || die "Resulting file '$actualPluginCatalogOffline' doesn't exist." 72 | 73 | # compare 74 | echo "Running diff -s ${expectedDir} ${actualDir}" 75 | diff -s "${expectedDir}" "${actualDir}" && DIFF_FOUND='' || DIFF_FOUND="y" 76 | if [ -n "${DIFF_FOUND:-}" ]; then 77 | DIFF_FOUND_SOMEWHERE='y' 78 | if [[ $CORRECT_TESTS -eq 1 ]]; then 79 | echo "Diff found. Correcting the expected files..." 80 | cp -v "${actualDir}/"* "${expectedDir}" 81 | addSummary "Test '$testName' corrected" 82 | else 83 | addSummary "Test '$testName' failed." 84 | addSummary " Analyze: diff -s ${expectedDir#"${CURRENT_DIR}"/} ${actualDir#"${CURRENT_DIR}"/}" 85 | addSummary " Correct: cp ${actualDir#"${CURRENT_DIR}"/}/* ${expectedDir#"${CURRENT_DIR}"/}" 86 | echo "=====================================================" 87 | echo "Using: diff -s ${expectedDir#"${CURRENT_DIR}"/} ${actualDir#"${CURRENT_DIR}"/}" 88 | errorMe "TEST ERROR: Test $testName failed. See above." 89 | fi 90 | else 91 | addSummary "Test '$testName' successful" 92 | echo "=====================================================" 93 | echo "TEST INFO: Test $testName was SUCCESSFUL." 94 | echo "=====================================================" 95 | fi 96 | done 97 | echo -e "$TEST_SUMMARY" 98 | if [ -z "$DIFF_FOUND_SOMEWHERE" ]; then echo "TEST INFO: All tests successful."; else die "Some tests failed."; fi -------------------------------------------------------------------------------- /tests/simple-annotations-override/command.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | cd "$(cd "$(dirname "$0")" && pwd)" 5 | 6 | "${RUN_CMD}" \ 7 | -v '2.387.3.5' \ 8 | -t mm \ 9 | -f "source-plugins.yaml" \ 10 | -f "source-plugins-v2.yaml" \ 11 | -F "actual/plugins.yaml" \ 12 | -c "actual/plugin-catalog.yaml" \ 13 | -C "actual/plugin-catalog-offline.yaml" \ 14 | -s \ 15 | -M \ 16 | -g "actual/plugins-minimal-for-generation-only.yaml" \ 17 | -G "actual/plugins-minimal.yaml" -------------------------------------------------------------------------------- /tests/simple-annotations-override/expected/plugin-catalog-offline.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog (offline)" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | beer: 11 | url: "https://www.brewery.com/download/beer.jpi" 12 | -------------------------------------------------------------------------------- /tests/simple-annotations-override/expected/plugin-catalog.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | beer: 11 | url: "https://www.brewery.com/download/beer.jpi" 12 | -------------------------------------------------------------------------------- /tests/simple-annotations-override/expected/plugins-minimal-for-generation-only.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | # tag:custom:url=https://www.brewery.com/download/beer.jpi 19 | - id: beer # 3rd src 20 | -------------------------------------------------------------------------------- /tests/simple-annotations-override/expected/plugins-minimal.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | # tag:custom:url=https://www.brewery.com/download/beer.jpi 19 | - id: beer # 3rd src 20 | -------------------------------------------------------------------------------- /tests/simple-annotations-override/expected/plugins.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | # tag:custom:url=https://www.brewery.com/download/beer.jpi 19 | - id: beer # 3rd src 20 | -------------------------------------------------------------------------------- /tests/simple-annotations-override/source-plugins-v2.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | # tag:custom:url=https://www.brewery.com/download/beer.jpi 3 | - id: beer 4 | -------------------------------------------------------------------------------- /tests/simple-annotations-override/source-plugins.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | # tag:custom:url=https://www.brewery.com/download/beer-OLD-VERSION.jpi 3 | - id: beer -------------------------------------------------------------------------------- /tests/simple-annotations/command.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | cd "$(cd "$(dirname "$0")" && pwd)" 5 | 6 | "${RUN_CMD}" \ 7 | -v '2.387.3.5' \ 8 | -t mm \ 9 | -f "source-plugins.yaml" \ 10 | -F "actual/plugins.yaml" \ 11 | -c "actual/plugin-catalog.yaml" \ 12 | -C "actual/plugin-catalog-offline.yaml" \ 13 | -s \ 14 | -g "actual/plugins-minimal-for-generation-only.yaml" \ 15 | -G "actual/plugins-minimal.yaml" -------------------------------------------------------------------------------- /tests/simple-annotations/expected/plugin-catalog-offline.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog (offline)" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | beer: 11 | url: "https://www.brewery.com/download/beer.jpi" 12 | -------------------------------------------------------------------------------- /tests/simple-annotations/expected/plugin-catalog.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | beer: 11 | url: "https://www.brewery.com/download/beer.jpi" 12 | -------------------------------------------------------------------------------- /tests/simple-annotations/expected/plugins-minimal-for-generation-only.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | # tag:custom:url=https://www.brewery.com/download/beer.jpi 19 | - id: beer # 3rd src 20 | - id: git-client # cap src 21 | -------------------------------------------------------------------------------- /tests/simple-annotations/expected/plugins-minimal.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | # tag:custom:url=https://www.brewery.com/download/beer.jpi 19 | - id: beer # 3rd src 20 | - id: git-client # cap src 21 | -------------------------------------------------------------------------------- /tests/simple-annotations/expected/plugins.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | # tag:custom:url=https://www.brewery.com/download/beer.jpi 19 | - id: beer # 3rd src 20 | - id: git-client # cap src 21 | - id: mina-sshd-api-common # cap dep 22 | - id: mina-sshd-api-core # cap dep 23 | -------------------------------------------------------------------------------- /tests/simple-annotations/source-plugins.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | # tag:custom:url=https://www.brewery.com/download/beer.jpi 3 | - id: beer 4 | - id: git-client 5 | - id: mina-sshd-api-common 6 | - id: mina-sshd-api-core 7 | -------------------------------------------------------------------------------- /tests/simple-download/command.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | cd "$(cd "$(dirname "$0")" && pwd)" 5 | 6 | "${RUN_CMD}" \ 7 | -v '2.387.3.5' \ 8 | -t mm \ 9 | -f "source-plugins.yaml" \ 10 | -F "actual/plugins.yaml" \ 11 | -c "actual/plugin-catalog.yaml" \ 12 | -C "actual/plugin-catalog-offline.yaml" \ 13 | -s \ 14 | -g "actual/plugins-minimal-for-generation-only.yaml" \ 15 | -G "actual/plugins-minimal.yaml" \ 16 | -d \ 17 | -D 'http://plugin-catalog/plugins/PNAME/PVERSION/PNAME.hpi' 18 | -------------------------------------------------------------------------------- /tests/simple-download/expected/plugin-catalog-offline.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog (offline)" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | beer: 11 | url: "http://plugin-catalog/plugins/beer/42.v776b_04d96de3/beer.hpi" 12 | -------------------------------------------------------------------------------- /tests/simple-download/expected/plugin-catalog.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | beer: 11 | version: "42.v776b_04d96de3" 12 | -------------------------------------------------------------------------------- /tests/simple-download/expected/plugins-minimal-for-generation-only.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: beer # 3rd src 19 | -------------------------------------------------------------------------------- /tests/simple-download/expected/plugins-minimal.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: beer # 3rd src 19 | -------------------------------------------------------------------------------- /tests/simple-download/expected/plugins.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: beer # 3rd src 19 | -------------------------------------------------------------------------------- /tests/simple-download/source-plugins.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - id: beer 3 | -------------------------------------------------------------------------------- /tests/simple-generation-only/command.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | cd "$(cd "$(dirname "$0")" && pwd)" 5 | 6 | "${RUN_CMD}" \ 7 | -v '2.387.3.5' \ 8 | -t mm \ 9 | -f "source-plugins.yaml" \ 10 | -F "actual/plugins.yaml" \ 11 | -c "actual/plugin-catalog.yaml" \ 12 | -C "actual/plugin-catalog-offline.yaml" \ 13 | -s \ 14 | -g "actual/plugins-minimal-for-generation-only.yaml" \ 15 | -G "actual/plugins-minimal.yaml" \ 16 | && die "TEST ERROR: Should have failed with a 'plugin not found' exception" \ 17 | || echo "TEST INFO: the error above is expected. Now running with '-A' (generation only plugins)." 18 | 19 | 20 | "${RUN_CMD}" \ 21 | -v '2.387.3.5' \ 22 | -t mm \ 23 | -f "source-plugins.yaml" \ 24 | -F "actual/plugins.yaml" \ 25 | -c "actual/plugin-catalog.yaml" \ 26 | -C "actual/plugin-catalog-offline.yaml" \ 27 | -s \ 28 | -A \ 29 | -g "actual/plugins-minimal-for-generation-only.yaml" \ 30 | -G "actual/plugins-minimal.yaml" -------------------------------------------------------------------------------- /tests/simple-generation-only/expected/plugin-catalog-offline.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog (offline)" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | aws-java-sdk: 11 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk/1.12.406-374.v4cdf53953691/aws-java-sdk.hpi" 12 | aws-java-sdk-cloudformation: 13 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-cloudformation/1.12.406-374.v4cdf53953691/aws-java-sdk-cloudformation.hpi" 14 | aws-java-sdk-codebuild: 15 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-codebuild/1.12.406-374.v4cdf53953691/aws-java-sdk-codebuild.hpi" 16 | aws-java-sdk-ecr: 17 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-ecr/1.12.406-374.v4cdf53953691/aws-java-sdk-ecr.hpi" 18 | aws-java-sdk-ecs: 19 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-ecs/1.12.406-374.v4cdf53953691/aws-java-sdk-ecs.hpi" 20 | aws-java-sdk-efs: 21 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-efs/1.12.406-374.v4cdf53953691/aws-java-sdk-efs.hpi" 22 | aws-java-sdk-iam: 23 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-iam/1.12.406-374.v4cdf53953691/aws-java-sdk-iam.hpi" 24 | aws-java-sdk-logs: 25 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-logs/1.12.406-374.v4cdf53953691/aws-java-sdk-logs.hpi" 26 | aws-java-sdk-sns: 27 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-sns/1.12.406-374.v4cdf53953691/aws-java-sdk-sns.hpi" 28 | aws-java-sdk-sqs: 29 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-sqs/1.12.406-374.v4cdf53953691/aws-java-sdk-sqs.hpi" 30 | aws-java-sdk-ssm: 31 | url: "https://jenkins-updates.cloudbees.com/download/plugins/aws-java-sdk-ssm/1.12.406-374.v4cdf53953691/aws-java-sdk-ssm.hpi" 32 | beer: 33 | url: "https://jenkins-updates.cloudbees.com/download/plugins/beer/42.v776b_04d96de3/beer.hpi" 34 | ec2-fleet: 35 | url: "https://jenkins-updates.cloudbees.com/download/plugins/ec2-fleet/3.2.0/ec2-fleet.hpi" 36 | -------------------------------------------------------------------------------- /tests/simple-generation-only/expected/plugin-catalog.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | aws-java-sdk: 11 | version: "1.12.406-374.v4cdf53953691" 12 | aws-java-sdk-cloudformation: 13 | version: "1.12.406-374.v4cdf53953691" 14 | aws-java-sdk-codebuild: 15 | version: "1.12.406-374.v4cdf53953691" 16 | aws-java-sdk-ecr: 17 | version: "1.12.406-374.v4cdf53953691" 18 | aws-java-sdk-ecs: 19 | version: "1.12.406-374.v4cdf53953691" 20 | aws-java-sdk-efs: 21 | version: "1.12.406-374.v4cdf53953691" 22 | aws-java-sdk-iam: 23 | version: "1.12.406-374.v4cdf53953691" 24 | aws-java-sdk-logs: 25 | version: "1.12.406-374.v4cdf53953691" 26 | aws-java-sdk-sns: 27 | version: "1.12.406-374.v4cdf53953691" 28 | aws-java-sdk-sqs: 29 | version: "1.12.406-374.v4cdf53953691" 30 | aws-java-sdk-ssm: 31 | version: "1.12.406-374.v4cdf53953691" 32 | beer: 33 | version: "42.v776b_04d96de3" 34 | ec2-fleet: 35 | version: "3.2.0" 36 | -------------------------------------------------------------------------------- /tests/simple-generation-only/expected/plugins-minimal-for-generation-only.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: beer # 3rd src 19 | - id: ec2-fleet # 3rd src 20 | -------------------------------------------------------------------------------- /tests/simple-generation-only/expected/plugins-minimal.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: aws-credentials # cap dep 19 | - id: aws-java-sdk # 3rd dep 20 | - id: aws-java-sdk-cloudformation # 3rd dep 21 | - id: aws-java-sdk-codebuild # 3rd dep 22 | - id: aws-java-sdk-ecr # 3rd dep 23 | - id: aws-java-sdk-ecs # 3rd dep 24 | - id: aws-java-sdk-efs # 3rd dep 25 | - id: aws-java-sdk-elasticbeanstalk # cap dep 26 | - id: aws-java-sdk-iam # 3rd dep 27 | - id: aws-java-sdk-logs # 3rd dep 28 | - id: aws-java-sdk-sns # 3rd dep 29 | - id: aws-java-sdk-sqs # 3rd dep 30 | - id: aws-java-sdk-ssm # 3rd dep 31 | - id: beer # 3rd src 32 | - id: ec2-fleet # 3rd src 33 | - id: ssh-slaves # cap dep 34 | -------------------------------------------------------------------------------- /tests/simple-generation-only/expected/plugins.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: aws-credentials # cap dep 19 | - id: aws-java-sdk # 3rd dep 20 | - id: aws-java-sdk-cloudformation # 3rd dep 21 | - id: aws-java-sdk-codebuild # 3rd dep 22 | - id: aws-java-sdk-ec2 # cap dep 23 | - id: aws-java-sdk-ecr # 3rd dep 24 | - id: aws-java-sdk-ecs # 3rd dep 25 | - id: aws-java-sdk-efs # 3rd dep 26 | - id: aws-java-sdk-elasticbeanstalk # cap dep 27 | - id: aws-java-sdk-iam # 3rd dep 28 | - id: aws-java-sdk-logs # 3rd dep 29 | - id: aws-java-sdk-minimal # cap dep 30 | - id: aws-java-sdk-sns # 3rd dep 31 | - id: aws-java-sdk-sqs # 3rd dep 32 | - id: aws-java-sdk-ssm # 3rd dep 33 | - id: beer # 3rd src 34 | - id: ec2-fleet # 3rd src 35 | - id: ssh-slaves # cap dep 36 | -------------------------------------------------------------------------------- /tests/simple-generation-only/source-plugins.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - id: beer # src 3 | - id: ec2-fleet # src 4 | # this plugin doesn't exist in the CI version 2.387.3.5 5 | # if we didn't use '-A' (plugins for generation only) the script would fail 6 | - id: aws-java-sdk-kinesis 7 | -------------------------------------------------------------------------------- /tests/simple-sha/command.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | cd "$(cd "$(dirname "$0")" && pwd)" 5 | 6 | export WITH_SHA256=1 7 | 8 | "${RUN_CMD}" \ 9 | -v '2.387.3.5' \ 10 | -t mm \ 11 | -f "source-plugins.yaml" \ 12 | -F "actual/plugins.yaml" \ 13 | -c "actual/plugin-catalog.yaml" \ 14 | -C "actual/plugin-catalog-offline.yaml" \ 15 | -s \ 16 | -g "actual/plugins-minimal-for-generation-only.yaml" \ 17 | -G "actual/plugins-minimal.yaml" -------------------------------------------------------------------------------- /tests/simple-sha/expected/plugin-catalog-offline.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog (offline)" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | beer: 11 | url: "https://jenkins-updates.cloudbees.com/download/plugins/beer/42.v776b_04d96de3/beer.hpi" 12 | sha256: "d+zYx5gk0d4MPxbY0SX2wA0Wt2TVQ5pfklK0fCVzCak=" 13 | -------------------------------------------------------------------------------- /tests/simple-sha/expected/plugin-catalog.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | beer: 11 | version: "42.v776b_04d96de3" 12 | sha256: "d+zYx5gk0d4MPxbY0SX2wA0Wt2TVQ5pfklK0fCVzCak=" 13 | -------------------------------------------------------------------------------- /tests/simple-sha/expected/plugins-minimal-for-generation-only.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: beer # 3rd src 19 | - id: git-client # cap src 20 | -------------------------------------------------------------------------------- /tests/simple-sha/expected/plugins-minimal.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: beer # 3rd src 19 | - id: git-client # cap src 20 | -------------------------------------------------------------------------------- /tests/simple-sha/expected/plugins.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: beer # 3rd src 19 | - id: git-client # cap src 20 | - id: mina-sshd-api-common # cap dep 21 | - id: mina-sshd-api-core # cap dep 22 | -------------------------------------------------------------------------------- /tests/simple-sha/source-plugins.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - id: beer 3 | - id: git-client 4 | - id: mina-sshd-api-common 5 | - id: mina-sshd-api-core 6 | -------------------------------------------------------------------------------- /tests/simple/command.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | cd "$(cd "$(dirname "$0")" && pwd)" 5 | 6 | "${RUN_CMD}" \ 7 | -v '2.387.3.5' \ 8 | -t mm \ 9 | -f "source-plugins.yaml" \ 10 | -F "actual/plugins.yaml" \ 11 | -c "actual/plugin-catalog.yaml" \ 12 | -C "actual/plugin-catalog-offline.yaml" \ 13 | -s \ 14 | -g "actual/plugins-minimal-for-generation-only.yaml" \ 15 | -G "actual/plugins-minimal.yaml" -------------------------------------------------------------------------------- /tests/simple/expected/plugin-catalog-offline.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog (offline)" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | beer: 11 | url: "https://jenkins-updates.cloudbees.com/download/plugins/beer/42.v776b_04d96de3/beer.hpi" 12 | -------------------------------------------------------------------------------- /tests/simple/expected/plugin-catalog.yaml: -------------------------------------------------------------------------------- 1 | type: "plugin-catalog" 2 | version: "1" 3 | name: "my-plugin-catalog" 4 | displayName: "My Plugin Catalog" 5 | configurations: 6 | - description: "These are Non-CAP plugins for version 2.387.3.5" 7 | prerequisites: 8 | productVersion: "[2.387.3.5]" 9 | includePlugins: 10 | beer: 11 | version: "42.v776b_04d96de3" 12 | -------------------------------------------------------------------------------- /tests/simple/expected/plugins-minimal-for-generation-only.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: beer # 3rd src 19 | - id: git-client # cap src 20 | -------------------------------------------------------------------------------- /tests/simple/expected/plugins-minimal.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: beer # 3rd src 19 | - id: git-client # cap src 20 | -------------------------------------------------------------------------------- /tests/simple/expected/plugins.yaml: -------------------------------------------------------------------------------- 1 | # This file is automatically generated - please do not edit manually. 2 | 3 | # Annotations (given as a comment above the plugin in question): 4 | # tag:custom:version=... - set a custom version (e.g. 1.0) 5 | # tag:custom:url=... - sets a custom url (e.g. https://artifacts.acme.test/my-plugin/1.0/my-plugin.jpi) 6 | # tag:custom:requires=... - spaced separated list of required dependencies (e.g. badge envinject) 7 | 8 | # Plugin Categories: 9 | # cap - is this a CAP plugin? 10 | # 3rd - is this a 3rd party plugin? 11 | # old - is this a deprecated plugin? 12 | # cve - are there open security issues? 13 | # bst - installed by default 14 | # dep - installed as dependency 15 | # src - used as a source plugin for this list 16 | 17 | plugins: 18 | - id: beer # 3rd src 19 | - id: git-client # cap src 20 | - id: mina-sshd-api-common # cap dep 21 | - id: mina-sshd-api-core # cap dep 22 | -------------------------------------------------------------------------------- /tests/simple/source-plugins.yaml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - id: beer 3 | - id: git-client 4 | - id: mina-sshd-api-common 5 | - id: mina-sshd-api-core 6 | -------------------------------------------------------------------------------- /version-check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script checks the versions dependencies of plugins in the update center 4 | # and compares them with the versions published by the update center. 5 | # If the version of a dependency is lower than the required version, it will be printed. 6 | # 7 | # Usage: ./version-check.sh 8 | # Example: ./version-check.sh 2.289.1 9 | 10 | set -euo pipefail 11 | 12 | # Pre-requisites 13 | command -v jq >/dev/null || { echo "jq is required but it's not installed. Aborting." >&2; exit 1; } 14 | if [ "$#" -ne 1 ]; then 15 | echo "Usage: $0 " 16 | exit 1 17 | fi 18 | 19 | echo "Checking dependencies for version $1" 20 | # Online Extract dependencies with versions 21 | UC_JSON=$(curl -sL "https://jenkins-updates.cloudbees.com/update-center/envelope-core-mm/update-center.json?version=${1}" | head -n-1 | tail -n+2) 22 | versions=$(jq -r '.plugins[] | "\(.name):\(.version)"' <<< "$UC_JSON") 23 | dependencies=$(jq -r '.plugins[] | .name as $plugin | .dependencies[] | "\($plugin):\(.name):\(.version)"' <<< "$UC_JSON") 24 | # Offline Extract dependencies with versions 25 | # DEPENDENCIES_JSON="target/${1}/mm/generated/update-center-online.json" 26 | # versions=$(jq -r '.plugins[] | "\(.name):\(.version)"' "$DEPENDENCIES_JSON") 27 | # dependencies=$(jq -r '.plugins[] | .name as $plugin | .dependencies[] | "\($plugin):\(.name):\(.version)"' "$DEPENDENCIES_JSON") 28 | 29 | declare -A plugin_versions 30 | while IFS=: read -r plugin version; do 31 | plugin_versions["$plugin"]="$version" 32 | done <<< "$versions" 33 | 34 | # Need to remove the .v from the version to compare since sort -V takes the .v* as a string 35 | normalize_version() { 36 | sed -E "s/([0-9])\.v/\1-v/g" <<< "$1" 37 | } 38 | # Compare versions 39 | output_all="" 40 | while IFS=: read -r plugin dependency dep_version; do 41 | if [[ -n "${plugin_versions[$dependency]:-}" ]]; then 42 | provided_version="${plugin_versions[$dependency]}" 43 | # echo "Checking $plugin -> $dependency ($provided_version vs $dep_version)" 44 | provided_version_normalized=$(normalize_version "$provided_version") 45 | dep_version_normalized=$(normalize_version "$dep_version") 46 | if [[ "$(printf '%s\n%s' "${provided_version_normalized}" "${dep_version_normalized}" | sort -V | tail -n1)" != "${provided_version_normalized}" ]]; then 47 | output="Dependency: $dependency (offered version $provided_version < $dep_version from the dependency) - from plugin $plugin" 48 | [ -z "$output_all" ] && output_all="$output" || output_all="$output_all\n$output" 49 | fi 50 | fi 51 | done <<< "$dependencies" 52 | # sort the output 53 | [ -z "$output_all" ] || echo -e "$output_all" | sort -u --------------------------------------------------------------------------------