Skip to content

feat: function version migrations#664

Merged
knative-prow-robot merged 5 commits into
knative:mainfrom
lkingland:lkingland/migrations
Nov 24, 2021
Merged

feat: function version migrations#664
knative-prow-robot merged 5 commits into
knative:mainfrom
lkingland:lkingland/migrations

Conversation

@lkingland

@lkingland lkingland commented Nov 17, 2021

Copy link
Copy Markdown
Member
  • 🎁 function version migrations

Introduces the concept of Function versions and associated migrations. Includes a single migration which initializes version and creation fields for Functions <=v0.19.0.

PR #641 takes advantage of function creation timestamp to determine if a Function has been initialized. Functions created prior to this stamp being introduced (forthcoming v0.20.0) should have their Creation stamp initialized to maintain backwards compatibility.

Migrations are applied when a Function is instantiated (read from func.yaml) in the order in which they are registered.

Currently the only migration is that which takes a Function from unversioned to versioned, and initialized a creation timestamp. The version written to func.yaml is the latest migration applied, indicating migrations can be skipped on subsequent loads until a new migration is added to the codebase.

Fixes #674

/kind enhancement

@knative-prow-robot knative-prow-robot added the kind/enhancement Feature additions or improvements to existing label Nov 17, 2021
@google-cla google-cla Bot added the cla: yes 🤖 PR author has signed the CLA. label Nov 17, 2021
@knative-prow-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lkingland

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added size/XL 🤖 PR changes 500-999 lines, ignoring generated files. approved 🤖 PR has been approved by an approver from all required OWNERS files. labels Nov 17, 2021
@codecov

codecov Bot commented Nov 17, 2021

Copy link
Copy Markdown

Codecov Report

Merging #664 (3ab03ec) into main (a0bfc3e) will increase coverage by 0.10%.
The diff coverage is 65.51%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #664      +/-   ##
==========================================
+ Coverage   37.93%   38.03%   +0.10%     
==========================================
  Files          41       42       +1     
  Lines        3872     3917      +45     
==========================================
+ Hits         1469     1490      +21     
- Misses       2212     2225      +13     
- Partials      191      202      +11     
Impacted Files Coverage Δ
repository.go 67.74% <ø> (ø)
function.go 54.13% <58.33%> (-6.55%) ⬇️
client.go 61.50% <64.70%> (-1.51%) ⬇️
function_migrations.go 80.00% <80.00%> (ø)
templates.go 78.46% <100.00%> (+0.68%) ⬆️
cmd/root.go 47.66% <0.00%> (+0.93%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a0bfc3e...3ab03ec. Read the comment docs.

@lkingland
lkingland force-pushed the lkingland/migrations branch 2 times, most recently from b7b7600 to 72348b1 Compare November 17, 2021 06:02
@knative-prow-robot knative-prow-robot added the needs-rebase Cannot be merged due to conflicts with HEAD. label Nov 17, 2021

@lance lance left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a nice addition. Thanks!
/lgtm

Comment thread testdata/migrations/README.md Outdated
Comment thread function_migrations.go Outdated
Comment thread function_migrations.go Outdated
Comment thread function_migrations.go
Comment thread function_migrations_unit_test.go Outdated
Comment thread function_migrations_unit_test.go
@knative-prow-robot knative-prow-robot added the lgtm 🤖 PR is ready to be merged. label Nov 17, 2021
@lkingland
lkingland force-pushed the lkingland/migrations branch from 72348b1 to bf648bb Compare November 18, 2021 02:49
@knative-prow-robot knative-prow-robot added size/XXL 🤖 PR changes 1000+ lines, ignoring generated files. and removed lgtm 🤖 PR is ready to be merged. needs-rebase Cannot be merged due to conflicts with HEAD. size/XL 🤖 PR changes 500-999 lines, ignoring generated files. labels Nov 18, 2021
@lkingland
lkingland force-pushed the lkingland/migrations branch 2 times, most recently from ccead95 to 46d008e Compare November 18, 2021 03:39
@lkingland

Copy link
Copy Markdown
Member Author

Tests have (thankfully, though a bit begrudgingly) uncovered a logical inconsistency in Function instantiation. Marking this as draft until I can get it sorted out.

@lkingland
lkingland marked this pull request as draft November 18, 2021 04:55
@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress 🤖 PR should not merge because it is a work in progress. label Nov 18, 2021
@lkingland
lkingland force-pushed the lkingland/migrations branch 2 times, most recently from 0b22d7c to 29bd550 Compare November 18, 2021 08:36
* adds new test confirming name is properly defaulted in new Functions.
@lkingland
lkingland marked this pull request as ready for review November 24, 2021 03:35
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress 🤖 PR should not merge because it is a work in progress. label Nov 24, 2021

@zroubalik zroubalik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

Looking good!

@knative-prow-robot knative-prow-robot added the lgtm 🤖 PR is ready to be merged. label Nov 24, 2021
@knative-prow-robot
knative-prow-robot merged commit ccf0015 into knative:main Nov 24, 2021
@lkingland
lkingland deleted the lkingland/migrations branch September 20, 2022 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved 🤖 PR has been approved by an approver from all required OWNERS files. cla: yes 🤖 PR author has signed the CLA. kind/enhancement Feature additions or improvements to existing lgtm 🤖 PR is ready to be merged. size/XXL 🤖 PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support pre-v0.19 Functions

4 participants