Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to use source in commit message #1132

Merged
merged 14 commits into from
Feb 2, 2023

Conversation

olblak
Copy link
Member

@olblak olblak commented Feb 2, 2023

Fix #1129

Updatecli relies on Go template to read Updatecli manifest and works in two steps:

  1. Load manifest based on information known at start time and ignore information known a runtime such as source output
  2. Then after each source/condition/target, Updatecli re-load the manifest.

The problem here is that the manifest spec is correctly updated but not the pipeline.
The current pull request add a new function named "pipeline.Update() error" to do exactly that

Test

To test this pull request, you can run the following commands:
I used the following manifest for my tests

Manifest
name: Test Commit message
scms:
  default:
    kind: git 
    spec:
      url: https://github.com/updatecli-test/cargo-lab.git
      commitmessage:
        title: 'Bump to {{ source "default" }}'
      branch: main

sources:
  default:
    kind: jenkins
    spec:
      ##release: stable
      release: weekly
  test3:
    name: 'update cargo to {{ source "default" }}'
    kind: shell
    dependson:
      - default
    spec:
      command: "true"

conditions:
  test4:
    name: 'update cargo to {{ source "default" }}'
    disablesourceinput: true
    kind: shell
    spec:
      command: "true"

targets:
  test5:
    name: 'update cargo to {{ source "default" }}'
    disablesourceinput: true
    kind: file
    scmid: default
    spec:
      file: "Cargo.toml"    

Then I run the following commands

go build -o bin/updatecli
./bin/updatecli apply --config updatecli/updatecli.d/testcommit.yaml --push=false --debug
cd /tmp/updatecli/github_com_updatecli-test_cargo-lab_git/ 
git log --pretty=format:%s -n1
# Return chore: Bump to 2.389

Additional Information

Tradeoff

Potential improvement

The HCL library provides a way to use both information known a start time and runtime and seems to be a better approach https://pkg.go.dev/github.com/hashicorp/hcl/v2

@olblak olblak added the bug Something isn't working label Feb 2, 2023
@olblak olblak added this to the 0.44.0 milestone Feb 2, 2023
@ghost
Copy link

ghost commented Feb 2, 2023

👇 Click on the image for a new way to code review
  • Make big changes easier — review code in small groups of related files

  • Know where to start — see the whole change at a glance

  • Take a code tour — explore the change with an interactive tour

  • Make comments and review — all fully sync’ed with github

    Try it now!

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Add the ability to use source in commit message
1 participant