### Basic Usage Example Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/api-reference/create-final-release.md A basic example of how to use the create-final-release task. ```yaml - task: create-final-release file: bosh-shared-ci/tasks/release/create-final-release.yml input_mapping: release_repo: my-bosh-release-repo version: release-version params: GIT_USER_NAME: "Release Automation" GIT_USER_EMAIL: "releases@example.com" PRIVATE_YML: | blobstore: provider: s3 options: access_key_id: ((blobstore_access_key)) secret_access_key: ((blobstore_secret_key)) bucket_name: my-blobstore region: us-east-1 RELEASE_TARBALL_BASE_NAME: "my-product" ``` -------------------------------- ### Output Mapping Example Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/configuration.md Example of how to use `output_mapping` to rename task outputs for subsequent steps. ```yaml - task: create-final-release file: bosh-shared-ci/tasks/release/create-final-release.yml output_mapping: release_repo: updated-repo # Git repo with release commit release_metadata: release-info # Version, tag, tarball - put: github-release params: repository: updated-repo tag: release-info/tag-name body: release-info/release-notes.md globs: - release-info/*.tgz ``` -------------------------------- ### PACKAGES Parameter Example (Concourse YAML) Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/configuration.md Provides an example of setting the PACKAGES parameter in Concourse YAML. ```yaml params: PACKAGES: '["golang", "postgres"]' ``` -------------------------------- ### Release Notes Format Example Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/api-reference/check-for-updated-blobs.md Example of the markdown format for release notes generated by the task. ```markdown ### Updates: * Updates golang/go from 1.20.0 to 1.21.0 * Updates postgres/postgresql from 15.1 to 15.2 * Adds nginx/nginx 1.24.0 ``` -------------------------------- ### Input Mapping Example (Concourse YAML) Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/configuration.md An example demonstrating how to use `input_mapping` in Concourse YAML to clarify input-to-parameter correspondence for a task. ```yaml - task: check-for-patched-cves file: bosh-shared-ci/tasks/release/check-for-patched-cves.yml input_mapping: input_repo: my-release-repo # The repo to scan version: release-version # Version resource with version file release-notes: previous-notes # (Optional) prior release notes params: SEVERITY: CRITICAL,HIGH SOURCE_PATH: src ``` -------------------------------- ### ensure-task-succeeded Input Mapping Example Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/errors.md Example of correctly mapping the task-output-folder input. ```yaml input_mapping: task-output-folder: patched_cves ``` -------------------------------- ### YAML Parameters Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/INDEX.md Example of a multiline YAML string parameter for blobstore configuration. ```yaml # Blobstore configuration (multiline YAML string) PRIVATE_YML: | blobstore: provider: s3 options: access_key_id: ((key)) secret_access_key: ((secret)) bucket_name: my-bucket ``` -------------------------------- ### Concourse Try Step Example Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/errors.md Example of a Concourse 'try' step wrapping a task. ```yaml - try: task: check-for-patched-cves # task exits 1 when no CVEs found → try step succeeds anyway ``` -------------------------------- ### Minimal Release Pipeline Example Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/configuration.md A basic YAML configuration for a minimal release pipeline job. ```yaml jobs: - name: create-release plan: - get: my-release-repo trigger: true - get: bosh-shared-ci - task: create-final-release file: bosh-shared-ci/tasks/release/create-final-release.yml input_mapping: release_repo: my-release-repo params: GIT_USER_NAME: "Release Bot" GIT_USER_EMAIL: "release@example.com" PRIVATE_YML: | blobstore: options: credentials_source: static json_key: '((blobstore_creds))' ``` -------------------------------- ### Example Package Structure Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/api-reference/check-for-updated-vendored-packages.md Demonstrates the expected directory structure for vendored packages. ```bash packages/ golang/ spec packaging postgres/ spec packaging nginx/ spec packaging ``` -------------------------------- ### Concourse Pipeline Configuration Example Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/README.md Example of how to reference tasks from pipelines using the bosh-shared-ci repository. ```yaml - task: task-name file: bosh-shared-ci/tasks/release/TASKNAME.yml input_mapping: release_repo: my-resource params: PARAM: value ``` -------------------------------- ### String Parameters Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/INDEX.md Examples of string parameters used for configuration values like user information, severity levels, and source paths. ```yaml # User information GIT_USER_NAME: "Release Bot" GIT_USER_EMAIL: "release@myorg.com" # CVE severity levels SEVERITY: CRITICAL,HIGH # Optional source path for CVE scanning SOURCE_PATH: src ``` -------------------------------- ### Check Resource Outputs Example Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/errors.md Commands to inspect task outputs after execution. ```bash tree release_metadata/ ``` ```bash cat release_metadata/version ``` -------------------------------- ### Version Stripping Example Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/api-reference/check-for-updated-blobs.md An example illustrating the version stripping logic where duplicate version segments are removed from version strings. ```yaml current_version: "1.2.3.4" containing "1.2.3" previous_version: "1.2.3" result: "1.2.3" -> "1.2.3.4" ``` -------------------------------- ### Concourse On_success / On_failure Hooks Example Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/errors.md Example of using 'on_success' and 'on_failure' hooks in Concourse. ```yaml on_success: put: trigger-resource on_failure: put: alert-slack ``` -------------------------------- ### Example Commit Messages Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/api-reference/check-for-updated-vendored-packages.md Shows examples of commit messages that correctly and incorrectly include version numbers for package updates. ```bash Update golang to 1.21.0 ✓ (extracts 1.21.0) Bump: golang 1.21.0 ✓ (extracts 1.21.0) Update golang ✗ (no version, package update not detected) Update golang version ✗ (no version, package update not detected) ``` -------------------------------- ### Outputs after task success Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/api-reference/create-final-release.md Example of how to use the outputs from the create-final-release task. ```yaml - put: git-release-repo params: repository: release_repo tag: release_metadata/tag-name - put: s3-release-tarball params: file: release_metadata/my-product-*.tgz ``` -------------------------------- ### Using the outputs Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/api-reference/create-dev-release.md Example of how to use the outputs (release_tarball and release_metadata) from the create-dev-release task in a subsequent task. ```yaml - task: upload-release config: platform: linux image_resource: type: registry-image source: repository: bosh/cli inputs: - name: release_tarball - name: release_metadata run: path: /bin/bash args: - -c - | version=$(cat release_metadata/version) echo "Uploading release version: $version" # Further processing of the tarball ``` -------------------------------- ### String Parameter Escaping Example Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/configuration.md Demonstrates correct quoting and escaping for parameters requiring YAML content, such as PRIVATE_YML. ```yaml # ✓ Valid multi-line YAML params: PRIVATE_YML: | blobstore: provider: s3 options: bucket: my-bucket # ✓ Valid single-line with escaping params: PRIVATE_YML: 'blobstore:\n provider: s3' # ✗ Invalid (YAML won't parse) params: PRIVATE_YML: unquoted: yaml: content ``` -------------------------------- ### Multi-Artifact Release Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/api-reference/create-final-release.md Example of releasing to multiple artifact stores. ```yaml jobs: - name: distribute-release plan: - get: release-repo - get: bosh-shared-ci - task: create-final-release file: bosh-shared-ci/tasks/release/create-final-release.yml input_mapping: release_repo: release-repo params: GIT_USER_NAME: "Release Bot" GIT_USER_EMAIL: "release@myorg.com" PRIVATE_YML: ((private_yml_content)) RELEASE_TARBALL_BASE_NAME: my-release # Push to git - put: github-release params: name: release_metadata/tag-name tag: release_metadata/tag-name globs: - release_metadata/my-release-*.tgz # Distribute to S3 - put: s3-releases params: file: release_metadata/my-release-*.tgz acl: public-read # Upload to blobstore - put: blobstore params: file: release_metadata/my-release-*.tgz # Notify release registry - task: register-release config: platform: linux image_resource: type: registry-image source: repository: curlimages/curl inputs: - name: release_metadata run: path: /bin/bash args: - -c - | version=$(cat release_metadata/version) curl -X POST https://release-registry/releases \ -H "Content-Type: application/json" \ -d "{\"name\": \"my-release\", \"version\": \"$version\", \"timestamp\": \"$(date -u +%s)\"}" ``` -------------------------------- ### Individual Task Usage Example Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/README.md An example of how to configure a single BOSH Shared CI task, specifically 'create-dev-release', within a Concourse pipeline, including input mapping and parameters. ```yaml - task: create-dev-release file: bosh-shared-ci/tasks/release/create-dev-release.yml input_mapping: release_repo: my-release params: PRIVATE_YML: | blobstore: options: credentials_source: static json_key: '((creds))' ``` -------------------------------- ### JSON Array Parameters Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/INDEX.md Examples of how to define JSON array parameters in YAML for tasks that check multiple items. ```yaml # Blobs to check BLOBS: '["golang/go", "postgres/postgresql"]' # Packages to check PACKAGES: '["golang", "postgres"]' ``` -------------------------------- ### BLOBS Parameter Example (Concourse Variable Interpolation) Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/configuration.md Demonstrates using Concourse variable interpolation for the BLOBS parameter. ```yaml params: BLOBS: ((blob_list)) # ((blob_list)) = '["golang/go", ...]' ``` -------------------------------- ### Multi-Stage Release Pipeline Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/api-reference/create-final-release.md Example of a multi-stage release pipeline with a staged approval process. ```yaml jobs: - name: release-with-approval plan: - get: release-repo - get: bosh-shared-ci # Create release for review - task: create-final-release file: bosh-shared-ci/tasks/release/create-final-release.yml input_mapping: release_repo: release-repo params: GIT_USER_NAME: "Release Bot" GIT_USER_EMAIL: "release@myorg.com" PRIVATE_YML: ((private_yml_content)) # Save for approval review - task: prepare-approval-package config: platform: linux image_resource: type: registry-image source: repository: alpine inputs: - name: release_metadata outputs: - name: approval-info run: path: /bin/sh args: - -c - | version=$(cat release_metadata/version) cat > approval-info/release-info.txt < release-notes/release-notes.md cat check-blobs/release-notes/release-notes.md >> release-notes/release-notes.md ``` -------------------------------- ### Version File Missing - Solution Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/errors.md YAML configuration to provide the 'version' input. ```yaml inputs: - name: version input_mapping: version: release-version ``` -------------------------------- ### Simple Release Creation Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/USAGE_PATTERNS.md Minimal pipeline that creates a final release on manual trigger. ```yaml resources: - name: release-repo type: git source: uri: git@github.com:myorg/my-release.git branch: main private_key: ((github_private_key)) - name: bosh-shared-ci type: git source: uri: https://github.com/cloudfoundry/bosh-shared-ci.git jobs: - name: manual-release plan: - get: release-repo - get: bosh-shared-ci - task: create-final-release file: bosh-shared-ci/tasks/release/create-final-release.yml input_mapping: release_repo: release-repo params: GIT_USER_NAME: "Release Bot" GIT_USER_EMAIL: "release@myorg.com" PRIVATE_YML: | blobstore: options: credentials_source: static json_key: '((blobstore_credentials))' RELEASE_TARBALL_BASE_NAME: my-release - put: release-repo params: repository: release_repo tag: release_metadata/tag-name tag_only: true ``` -------------------------------- ### Multiple Dev Releases in CI/CD Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/api-reference/create-dev-release.md Example of creating development releases on each commit to test infrastructure. ```yaml jobs: - name: build-and-test plan: - get: release-repo trigger: true - get: bosh-shared-ci - task: create-dev-release file: bosh-shared-ci/tasks/release/create-dev-release.yml input_mapping: release_repo: release-repo - task: deploy-to-test-env config: platform: linux image_resource: type: registry-image source: repository: bosh/cli inputs: - name: release_tarball - name: release_metadata run: path: /bin/bash args: - -c - | version=$(cat release_metadata/version) echo "Deploying dev release: $version" bosh upload-release release_tarball/release.tgz bosh deploy manifests/test-deployment.yml ``` -------------------------------- ### Comparison of Release Types Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/api-reference/create-dev-release.md A comparison between development and final release types, detailing versioning, usage, frequency, retention, and deployment environments. ```text Development Release: - Version: 1.2.3+dev.0.20240101T120000Z - Use: Testing in sandboxes - Frequency: Multiple per day possible - Retention: Temporary, for dev/test only - Deployment: To development/test environments Final Release: - Version: 1.2.3 - Use: Production deployment - Frequency: One per release cycle - Retention: Permanent in release repository - Deployment: To production environments ``` -------------------------------- ### Verify BOSH Repository Structure Commands Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/errors.md Commands to inspect BOSH release tarballs and manifests. ```bash bosh inspect-release-tarball path/to/tarball.tgz ``` ```bash bosh validate-release manifests/release.yml ``` -------------------------------- ### Basic development release (public blobstore) Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/api-reference/create-dev-release.md Example of how to use the create-dev-release task for a public blobstore. ```yaml - task: create-dev-release file: bosh-shared-ci/tasks/release/create-dev-release.yml input_mapping: release_repo: my-bosh-release-repo ``` -------------------------------- ### PRIVATE_YML Structure (S3 Blobstore) Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/configuration.md Example structure for the PRIVATE_YML parameter when using an S3 blobstore. ```yaml blobstore: provider: s3 options: access_key_id: ((blobstore_access_key)) secret_access_key: ((blobstore_secret_key)) bucket_name: my-bucket region: us-east-1 ``` -------------------------------- ### Version Extraction Regex and Logic Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/api-reference/create-final-release.md This snippet shows the regex pattern used to extract version numbers from release manifest filenames and the logic applied to select the final version. ```bash # Pattern: [0-9.]+[0-9] # Applied to release manifest filenames like: my-release-1.2.3.yml # Result: Finds all version-like numbers and takes the last (largest) one # Example: # releases/my-release-1.2.3.yml → extracts 1.2.3 # releases/my-release-2.0.0.yml → extracts 2.0.0 # Latest (sorted) is used: 2.0.0 ``` -------------------------------- ### create-final-release Task: Missing or Invalid Parameters - PRIVATE_YML Source: https://github.com/cloudfoundry/bosh-shared-ci/blob/main/_autodocs/errors.md Example of how to provide the PRIVATE_YML parameter with blobstore credentials. ```yaml params: PRIVATE_YML: | blobstore: options: credentials_source: static json_key: '((blobstore_credentials))' ```