Skip to content

Conversation

@ecrupper
Copy link
Contributor

@ecrupper ecrupper commented May 22, 2023

When using any compiler function which does not involve instantiating the compiler with a build (compiler.FromContext(c).WithBuild(b)), any time a lite compilation is requested (many pipeline API endpoints), the compiler fails to grab the correct template from the SCM due to this line. This change addresses the bug by adding a commit field to the compiler engine, which felt like the least invasive way of holding the commit SHA during compilation / template fetching. Open to other ideas as well.

Steps to recreate bug if interested:

  1. define a pipeline that calls a template of the file type on the default branch of a repository
  2. checkout a new branch, edit the template that is called
  3. run pipeline
  4. build will compile and run as expected, but requesting {{ base_url }}/api/v1/pipelines/{{ org }}/{{ repo }}/{{ pipeline }}/expand will show you the expanded version as pulling in the template version from the default branch.

@ecrupper ecrupper self-assigned this May 22, 2023
@ecrupper ecrupper requested a review from a team as a code owner May 22, 2023 22:17
@codecov
Copy link

codecov bot commented May 22, 2023

Codecov Report

Merging #859 (c26967b) into main (afd00ce) will decrease coverage by 0.01%.
The diff coverage is 70.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #859      +/-   ##
==========================================
- Coverage   66.78%   66.78%   -0.01%     
==========================================
  Files         283      283              
  Lines       14120    14129       +9     
==========================================
+ Hits         9430     9436       +6     
- Misses       4244     4247       +3     
  Partials      446      446              
Impacted Files Coverage Δ
api/build.go 1.34% <0.00%> (-0.01%) ⬇️
api/webhook.go 0.00% <0.00%> (ø)
compiler/native/expand.go 72.41% <100.00%> (ø)
compiler/native/native.go 85.26% <100.00%> (+0.81%) ⬆️
router/middleware/pipeline/pipeline.go 77.77% <100.00%> (+0.35%) ⬆️

Copy link
Member

@cognifloyd cognifloyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

Copy link
Member

@wass3rw3rk wass3rw3rk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's go to the moon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants