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

Validate migration files #18203

Merged
merged 6 commits into from
Jan 26, 2022
Merged

Validate migration files #18203

merged 6 commits into from
Jan 26, 2022

Conversation

realaravinth
Copy link
Contributor

@realaravinth realaravinth commented Jan 7, 2022

On behalf of @dachary from the forgefriends project:

JSON Schema validation for data used by Gitea during migrations
Discussion at https://forum.forgefriends.org/t/common-json-schema-for-repository-information/563


source

@realaravinth realaravinth marked this pull request as draft January 7, 2022 04:53
@6543 6543 added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Jan 8, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jan 9, 2022

Codecov Report

❗ No coverage uploaded for pull request base (main@8c647bf). Click here to learn what that means.
The diff coverage is 65.62%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #18203   +/-   ##
=======================================
  Coverage        ?   45.66%           
=======================================
  Files           ?      832           
  Lines           ?    92097           
  Branches        ?        0           
=======================================
  Hits            ?    42052           
  Misses          ?    43299           
  Partials        ?     6746           
Impacted Files Coverage Δ
cmd/restore_repo.go 0.00% <0.00%> (ø)
modules/migration/issue.go 100.00% <ø> (ø)
modules/private/restore_repo.go 0.00% <0.00%> (ø)
routers/private/restore_repo.go 0.00% <0.00%> (ø)
modules/migration/file_format.go 71.42% <71.42%> (ø)
modules/migration/schemas_dynamic.go 81.81% <81.81%> (ø)
services/migrations/dump.go 30.54% <100.00%> (ø)
services/migrations/restore.go 33.54% <100.00%> (ø)

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 8c647bf...4718117. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 9, 2022
@realaravinth realaravinth marked this pull request as ready for review January 9, 2022 18:54
@lunny
Copy link
Member

lunny commented Jan 10, 2022

I think it's unnecessary to increment the binary size for a test purpose.

@realaravinth
Copy link
Contributor Author

I think it's unnecessary to increment the binary size for a test purpose.

The bindata keyword that was added to .drone.yml and Makefile was removed. Thanks for the quick review :-)


source

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 11, 2022
@lunny lunny added type/enhancement An improvement of existing functionality and removed type/feature Completely new functionality. Can only be merged if feature freeze is not active. labels Jan 11, 2022
@realaravinth
Copy link
Contributor Author

The PR was updated to remove the conflicting changes in the vendor directory.


source

@singuliere singuliere requested a review from a team January 21, 2022 13:10
@6543 6543 added this to the 1.17.0 milestone Jan 21, 2022
modules/migration/file_format.go Outdated Show resolved Hide resolved
modules/migration/file_format.go Outdated Show resolved Hide resolved
modules/migration/file_format.go Outdated Show resolved Hide resolved
modules/migration/schemas/issue.json Outdated Show resolved Hide resolved
modules/migration/schemas/issue.json Show resolved Hide resolved
@6543
Copy link
Member

6543 commented Jan 22, 2022

CI fail related:

+ make lint-backend
golangci-lint run --timeout 10m
services/migrations/dump.go:155:3: not enough arguments in call to git.Clone (typecheck)
	})
	 ^
services/migrations/dump.go:162:56: not enough arguments in call to repository.WikiRemoteURL (typecheck)
		wikiRemotePath := repository.WikiRemoteURL(remoteAddr)
		                                                     ^
services/migrations/dump.go:173:5: not enough arguments in call to git.Clone (typecheck)
			}); err != nil {
			 ^
make: *** [Makefile:754: golangci-lint] Error 1

@realaravinth
Copy link
Contributor Author

@Gusted thanks for your review. I addressed your comments, hopefully to your satisfaction


source

@realaravinth
Copy link
Contributor Author

realaravinth commented Jan 24, 2022

@6543 thanks for highlighting the CI failure. The PR was rebased against today's main branch to resolve them.


source

Copy link
Contributor

@Gusted Gusted left a comment

Choose a reason for hiding this comment

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

Only a small nit, otherwise it looks good to me.

modules/migration/schemas_bindata.go Show resolved Hide resolved
Copy link
Contributor

@Gusted Gusted left a comment

Choose a reason for hiding this comment

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

LGTM!

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 24, 2022
go get github.com/santhosh-tekuri/jsonschema/v5

Signed-off-by: Loïc Dachary <loic@dachary.org>
Loïc Dachary added 3 commits January 25, 2022 19:33
Signed-off-by: Loïc Dachary <loic@dachary.org>
Signed-off-by: Loïc Dachary <loic@dachary.org>
@6543
Copy link
Member

6543 commented Jan 25, 2022

please dont force-push I cant easily check what was changed

Copy link
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

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

force push after 2 lgtms - need 👀

@6543 6543 added status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR and removed status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR labels Jan 25, 2022
@realaravinth
Copy link
Contributor Author

@6543: Apologies, we'll avoid force pushing next time

@6543
Copy link
Member

6543 commented Jan 26, 2022

well we squash-merge so its better to not force-push to see the progress

@6543 6543 merged commit 3bb028c into go-gitea:main Jan 26, 2022
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jan 27, 2022
* giteaoffical/main:
  [skip ci] Updated translations via Crowdin
  Only view milestones from current repo (go-gitea#18414)
  Validate migration files (go-gitea#18203)
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
JSON Schema validation for data used by Gitea during migrations

Discussion at https://forum.forgefriends.org/t/common-json-schema-for-repository-information/563

Co-authored-by: Loïc Dachary <loic@dachary.org>
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants