es-entity 0.12.21

Event Sourcing Entity Framework
Documentation
#@ load("@ytt:data", "data")

#@ load("vendor/pipeline-fragments.lib.yml",
#@   "repo_resource",
#@   "version_resource",
#@   "pipeline_tasks_resource",
#@   "release_task_image_config",
#@   "rust_task_image_config",
#@   "gh_release_resource",
#@   "nix_task_image_config",
#@   "fuzz_job",
#@   "fuzz_time_resource",
#@   "zenduty_notification_resource",
#@   "zenduty_resource_type",
#@ )

#@ def retry_task():
task: wait-and-retry
config:
  platform: linux
  image_resource: #@ release_task_image_config()
  run:
    path: sh
    args:
    - "-c"
    - "sleep 5"
#@ end

groups:
- name: es-entity
  jobs:
  - check-code
  - tests
  - release
  - set-dev-version
  - fuzz

jobs:
#! Coverage-guided fuzzing (cargo-fuzz / libFuzzer), from galoy-concourse-shared.
#! Self-bootstrapping (first run fuzzes from scratch — no manual seed), corpus
#! persisted to GCS, Zenduty fires on crash. Default cadence: weekly Saturday
#! 06:00 UTC for 24h; override via fuzz_job(fuzz_seconds="...").
- #@ fuzz_job()

- name: check-code
  serial: true
  plan:
  - in_parallel:
    - { get: repo, trigger: true }
    - { get: pipeline-tasks }
  - task: check-code
    config:
      platform: linux
      image_resource: #@ nix_task_image_config()
      inputs:
      - name: pipeline-tasks
      - name: repo
      caches:
      - path: /nix-cache
      run:
        path: pipeline-tasks/ci/vendor/tasks/with-nix-cache.sh
        args:
          - sh
          - -exc
          - |
            set -euo pipefail
            cd repo
            nix flake check

- name: tests
  plan:
    - in_parallel:
      - get: repo
        trigger: true
      - { get: pipeline-tasks }
    - task: tests
      attempts: 2
      config:
        platform: linux
        image_resource: #@ nix_task_image_config()
        inputs:
          - name: pipeline-tasks
          - name: repo
        caches:
          - path: /nix-cache
        run:
          path: pipeline-tasks/ci/vendor/tasks/with-nix-cache.sh
          args:
            - sh
            - -exc
            - |
              set -euo pipefail
              cd repo
              nix run .#nextest
- name: release
  serial: true
  plan:
  - in_parallel:
    - get: repo
      passed:
      - check-code
      - tests
    - get: pipeline-tasks
    - get: version
  - task: prep-release
    config:
      platform: linux
      image_resource: #@ release_task_image_config()
      inputs:
      - name: pipeline-tasks
      - name: repo
      - name: version
      outputs:
      - name: version
      - name: artifacts
      run:
        path: pipeline-tasks/ci/vendor/tasks/prep-release-src.sh
  - task: update-repo
    config:
      platform: linux
      image_resource: #@ rust_task_image_config()
      inputs:
      - name: artifacts
      - name: pipeline-tasks
      - name: repo
      - name: version
      outputs:
      - name: repo
      run:
        path: pipeline-tasks/ci/tasks/update-repo.sh
  - task: publish-to-crates
    config:
      image_resource: #@ rust_task_image_config()
      platform: linux
      inputs:
      - name: version
      - name: pipeline-tasks
      - name: repo
      params:
        CRATES_API_TOKEN: #@ data.values.crates_api_token
      caches:
      - path: cargo-home
      - path: cargo-target-dir
      run:
        path: pipeline-tasks/ci/tasks/publish-to-crates.sh
  - put: repo
    attempts: 3
    params:
      tag: artifacts/gh-release-tag
      repository: repo
      merge: true
    on_failure: #@ retry_task()
  - put: gh-release
    params:
      name: artifacts/gh-release-name
      tag: artifacts/gh-release-tag
      body: artifacts/gh-release-notes.md
  - put: version
    attempts: 3
    params:
      file: version/version
    on_failure: #@ retry_task()

- name: set-dev-version
  plan:
  - in_parallel:
    - { get: repo, passed: [release] }
    - { get: pipeline-tasks }
    - get: version
      trigger: true
      params: { bump: patch }
      passed: [release]
  - task: set-dev-version
    config:
      image_resource: #@ rust_task_image_config()
      platform: linux
      inputs:
      - name: version
      - name: repo
      - name: pipeline-tasks
      outputs:
      - name: repo
      run:
        path: pipeline-tasks/ci/tasks/set-dev-version.sh
      params:
        BRANCH: #@ data.values.git_branch
  - put: repo
    params:
      repository: repo
      rebase: true


resources:
- #@ repo_resource(True)
- #@ gh_release_resource()
- #@ pipeline_tasks_resource()
- #@ version_resource()
- #@ fuzz_time_resource()
- #@ zenduty_notification_resource()

resource_types:
- #@ zenduty_resource_type()