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

bazel build fails with error loading package '' when invoked in a git submodule foreach command #6358

Closed
dpursehouse opened this issue Oct 11, 2018 · 9 comments
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. untriaged

Comments

@dpursehouse
Copy link
Contributor

Description of the problem / feature request:

When invoking bazel build from within a git submodule foreach command, it fails with error loading package ''

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

git clone --recurse-submodules --branch=stable-2.14 https://github.com/dpursehouse/gerrit-plugins
cd gerrit-plugins
git submodule foreach 'bazel build $sm_path'

What operating system are you running Bazel on?

OSX 10.14

What's the output of bazel info release?

release 0.17.2

If bazel info release returns "development version" or "(@non-git)", tell us how you built Bazel.

N/A

What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?

N/A

Have you found anything relevant by searching the web?

Could not find anything related to this.

Any other information, logs, or outputs that you want to share?

gerrit-plugins $ git submodule foreach 'bazel build $sm_path'
Entering 'admin-console'
Starting local Bazel server and connecting to it...
ERROR: error loading package '': Encountered error while reading extension file 'gerrit_api.bzl': no such package '@com_googlesource_gerrit_bazlets//': Creating directories for /Users/dpursehouse/temp/gerrit-plugins/admin-console/.git failed
ERROR: error loading package '': Encountered error while reading extension file 'gerrit_api.bzl': no such package '@com_googlesource_gerrit_bazlets//': Creating directories for /Users/dpursehouse/temp/gerrit-plugins/admin-console/.git failed
INFO: Elapsed time: 0.402s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
fatal: run_command returned non-zero status for admin-console
.
@irengrig irengrig added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. untriaged labels Oct 11, 2018
@dkelmer
Copy link
Contributor

dkelmer commented Oct 11, 2018

I don't know what the root cause is, but switching to using the skylark git_repository rule in bazlets.bzl fixes the problem. Since we are deprecating the native git rules, I'm not going to keep investigating at the moment. If this is blocking you right now and you can't switch, please reopen the bug.

@dkelmer dkelmer closed this as completed Oct 11, 2018
@dpursehouse
Copy link
Contributor Author

Thanks, that works. Is there also a replacement for native.local_repository?

lucamilanesio pushed a commit to GerritCodeReview/plugins_delete-project that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I336ec65f6751ee526c95ea46c9ccb4905f5b6fc3
lucamilanesio pushed a commit to GerritCodeReview/plugins_gitiles that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: Icd5a41d45155fb5607ae488cee58d6e654c490c5
lucamilanesio pushed a commit to GerritCodeReview/plugins_go-import that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I3515b757c3486fbe1d0e9a57a375b4bb6492baaf
lucamilanesio pushed a commit to GerritCodeReview/plugins_high-availability that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I2f84ff7b7150cb5cb0dd586096e2b339025703b1
lucamilanesio pushed a commit to GerritCodeReview/plugins_importer that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I1862ed62df1018df30fabcaeb818020cbf3f97cf
lucamilanesio pushed a commit to GerritCodeReview/plugins_admin-console that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: Icbbc0a747b48132a75ca20edcc6b24972e16b014
lucamilanesio pushed a commit to GerritCodeReview/plugins_javamelody that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I84939718b13ee53f14e856e3f1d5d5edef005562
lucamilanesio pushed a commit to GerritCodeReview/plugins_reviewers that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I82019e1b7613a58fbf0ec0bcc3149587677bf182
lucamilanesio pushed a commit to GerritCodeReview/plugins_verify-status that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: Ib1ce615f283ed89f55a6ce6df0b04e6b26148e39
lucamilanesio pushed a commit to GerritCodeReview/plugins_webhooks that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: If1dedab49babafa15b3dfda424b3bc92b6f1afba
@dkelmer
Copy link
Contributor

dkelmer commented Oct 12, 2018

There isn't (and there aren't currently plans to replace it). Are you seeing failures with local_repository as well?

@dkelmer
Copy link
Contributor

dkelmer commented Oct 12, 2018

And thanks for migrating the git rules so quickly! :)

lucamilanesio pushed a commit to GerritCodeReview/plugins_lfs that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I99a329bbae59187b815af3411758c54ee80c4989
lucamilanesio pushed a commit to GerritCodeReview/plugins_oauth that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I3591e1e38a3d9333f4fb50224555ee49b488f788
lucamilanesio pushed a commit to GerritCodeReview/plugins_owners that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: Ia84224369f21596ebb0aadb02f39627bc5c21c39
lucamilanesio pushed a commit to GerritCodeReview/plugins_uploadvalidator that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: Id3aa0fef419f1745faf5aa6986925d803460b669
@dpursehouse
Copy link
Contributor Author

Are you seeing failures with local_repository as well?

Yes, but I'm not sure what is causing it. If I switch to use native.local_repository pointing to my local clone of bazlets, i.e. with a diff like this:

admin-console $ git diff
diff --git a/WORKSPACE b/WORKSPACE
index 4e30c88..1269528 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -4,7 +4,7 @@ load("//:bazlets.bzl", "load_bazlets")

 load_bazlets(
     commit = "0cdf281f110834b71ae134afe0a7e3fe346f0078",
-    #    local_path = "/home/<user>/projects/bazlets",
+    local_path = "/Users/dpursehouse/git/bazlets",
 )

 #Snapshot Plugin API

where the local repo contains the same sha1 as I was using with the remote repo (i.e. it is exactly the same contents), then the build starts failing with java compilation errors that look like being caused by the wrong Gerrit API:

admin-console $ bazel build admin-console
Starting local Bazel server and connecting to it...
INFO: Analysed target //:admin-console (18 packages loaded).
INFO: Found 1 target...
ERROR: /Users/dpursehouse/git/gerrit-plugins/admin-console/BUILD:3:1: Building libadmin-console__plugin-class.jar (6 source files) failed (Exit 1)
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java:25: error: cannot find symbol
import com.google.gerrit.reviewdb.client.AccountExternalId;
                                        ^
  symbol:   class AccountExternalId
  location: package com.google.gerrit.reviewdb.client
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ListUsersCommand.java:51: error: cannot find symbol
    ResultSet<Account> accounts = db.accounts().all();
                                    ^
  symbol:   method accounts()
  location: variable db of type ReviewDb
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ListUsersCommand.java:82: error: method find in class AccountResolver cannot be applied to given types;
    Account accountFromResolver = accountResolver.find(db, id);
                                                 ^
  required: String
  found: ReviewDb,String
  reason: actual and formal argument lists differ in length
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java:96: error: method findAll in class AccountResolver cannot be applied to given types;
      Set<Id> idList = accountResolver.findAll(db, name);
                                      ^
  required: String
  found: ReviewDb,String
  reason: actual and formal argument lists differ in length
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java:116: error: method find in class AccountResolver cannot be applied to given types;
        account = accountResolver.find(db, id.toString());
                                 ^
  required: String
  found: ReviewDb,String
  reason: actual and formal argument lists differ in length
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java:131: error: cannot find symbol
            db.accountExternalIds().byAccount(account.getId())) {
              ^
  symbol:   method accountExternalIds()
  location: variable db of type ReviewDb
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java:130: error: cannot find symbol
        for (AccountExternalId accountExternalId :
             ^
  symbol:   class AccountExternalId
  location: class ShowAccountCommand
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java:108: error: method findAll in class AccountResolver cannot be applied to given types;
      Set<Id> idList = accountResolver.findAll(db, name);
                                      ^
  required: String
  found: ReviewDb,String
  reason: actual and formal argument lists differ in length
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java:129: error: method find in class AccountResolver cannot be applied to given types;
          account = accountResolver.find(db, id.toString());
                                   ^
  required: String
  found: ReviewDb,String
  reason: actual and formal argument lists differ in length
Target //:admin-console failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 9.428s, Critical Path: 3.21s
INFO: 2 processes: 2 darwin-sandbox.
FAILED: Build did NOT complete successfully

@davido can you confirm if you also see this?

And thanks for migrating the git rules so quickly! :)

Well, it was for my own benefit, so... :)

I hope you didn't get spammed with notifications from all those commits. I didn't realise it would add comments here.

lucamilanesio pushed a commit to GerritCodeReview/plugins_its-base that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: Id8bd40142965c2f9fa8f656c5c8cdee1d3eddba0
lucamilanesio pushed a commit to GerritCodeReview/plugins_project-group-structure that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I7c0804ae8c5a7a6012c39cd6ea652c1ed9c0c2e8
lucamilanesio pushed a commit to GerritCodeReview/plugins_quota that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: Ieb19e848b277d600f85e7a0f184b3d3f56b06348
lucamilanesio pushed a commit to GerritCodeReview/plugins_readonly that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I507f87081889bc1fbd68dcc637c69928a58a2224
lucamilanesio pushed a commit to GerritCodeReview/plugins_rename-project that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I5d6bf9427566c49081da12eb15db34cf3d921bdc
lucamilanesio pushed a commit to GerritCodeReview/plugins_slack-integration that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: Ie67a0e6c2f59e03d592e0345f4a1b62ae75a8f18
lucamilanesio pushed a commit to GerritCodeReview/plugins_events-log that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I9ef82fe22d60857d10c33894c586912093693df6
lucamilanesio pushed a commit to GerritCodeReview/plugins_slack-integration that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: Ie67a0e6c2f59e03d592e0345f4a1b62ae75a8f18
lucamilanesio pushed a commit to GerritCodeReview/plugins_delete-project that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I336ec65f6751ee526c95ea46c9ccb4905f5b6fc3
lucamilanesio pushed a commit to GerritCodeReview/plugins_verify-status that referenced this issue Oct 12, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: Ib1ce615f283ed89f55a6ce6df0b04e6b26148e39
@irengrig
Copy link
Contributor

@dpursehouse As I see, the local repository variant of load_bazlets does not use the passed checksum.
So you are using whatever local version you pointed to. Seems it is not the version you expected:)

@dpursehouse
Copy link
Contributor Author

@irengrig thanks, I hadn't thought of that. But it's strange that I never saw this problem before. It seemed to only start after edited the bzl file to use the git_repository skylark rule, although I don't understand how that could be. I'll try it again later.

@davido
Copy link
Contributor

davido commented Oct 15, 2018

local_repository doesn't have sha1 parameter.

lucamilanesio pushed a commit to GerritCodeReview/plugins_force-draft that referenced this issue Oct 15, 2018
The native.git_repository rule does not work properly when invoked in a
`git submodule foreach` command. Bazel will deprecate the native rules
anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I97492855b99991e9812b07ed2851a31d67be3aea
lucamilanesio pushed a commit to GerritCodeReview/plugins_changemessage that referenced this issue Oct 15, 2018
The native.git_repository rule does not work properly when invoked in a
`git submodule foreach` command. Bazel will deprecate the native rules
anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I671b0d2a136367ad74d4a6f0aa14f2ae0cf01cc3
@dpursehouse
Copy link
Contributor Author

I guess when I used it before I always had the same revision checked out locally in the bazlets repo. Sorry for the noise.

spearce pushed a commit to google/gitiles that referenced this issue Oct 16, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I938a7c55793f294461d3517556aa13e029012936
lucamilanesio pushed a commit to GerritCodeReview/plugins_verify-status that referenced this issue Nov 14, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: Ib1ce615f283ed89f55a6ce6df0b04e6b26148e39
lucamilanesio pushed a commit to GerritCodeReview/plugins_messageoftheday that referenced this issue Nov 14, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I374e45dc1d4a010396f9aedada21f890ec60e717
lucamilanesio pushed a commit to GerritCodeReview/plugins_batch that referenced this issue Nov 16, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: Ib9efda267c5545f73fcbacbf7ac4ffcfd28d3216
lucamilanesio pushed a commit to GerritCodeReview/plugins_webhooks that referenced this issue Nov 21, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: If1dedab49babafa15b3dfda424b3bc92b6f1afba
lucamilanesio pushed a commit to GerritCodeReview/plugins_slack-integration that referenced this issue Dec 5, 2018
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: Ie67a0e6c2f59e03d592e0345f4a1b62ae75a8f18
openstack-gerrit pushed a commit to openstack-infra/gerrit that referenced this issue Dec 9, 2018
* Update plugins/delete-project from branch 'master'
  to e0618f3dff8fcc1c36861a99b2162ac611e707c6
  - Merge branch 'stable-2.16'
    
    * stable-2.16:
      Bazel: Include eclipse-out directory in .bazelignore
      Add explanatory comment to empty BUILD file(s)
      Update mockito to 2.23.4
      Upgrade bazlets to latest stable-2.16 to build with 2.16 API
      Always pass ALLOW_INSECURE to MoreFiles.deleteRecursively
      ArchiveRepositoryRemoverTest: Refactor assertions on repo content
      Format external_plugin_deps.bzl with buildifier
      Upgrade bazlets to latest stable-2.14 to build with 2.14.17 API
      Upgrade bazlets to latest stable-2.14 to build with 2.14.16 API
      Align Eclipse compiler settings with core Gerrit's
      WORKSPACE: Make commented out lines spaces indent consistent
      Add IT test
      FilesystemDeleteHandler: Use more readable name for trash folder
      Configure whether to allow user to select preserve
      Introduce an archiving mechanism for deleted repos
      bazlets: Replace native.git_repository with skylark rule
      Harmonize external dependency names to use hyphen
      Upgrade mockito to 2.23.0
      Update bazlets to latest stable-2.14 to build with 2.14.15 API
      Update bazlets to latest stable-2.14 to build with 2.14.14 API
      Update bazlets to latest stable-2.14 to build with 2.14.13 API
      FilesystemDeleteHandler: Don't instantiate event if there are no listeners
      FilesystemDeleteHandler: Rename deletedListener to deletedListeners
      DatabaseDeleteHandler.java: Remove unused Provider<InternalChangeQuery>
      Add RecursiveDeleteOption.ALLOW_INSECURE for recursive deletion
      Simplify DeleteTrashFolder
      DeleteTrashFolders: Extract predicate to its own class
      Add unit test for DeleteTrashFolders
      Update bazlets to latest stable-2.14 to use 2.14.12 API
      Migrate `tools/bazel.rc` to `.bazelrc`
      Tidy up FilesystemDeleteHandler
      Add unit tests for FilesystemDeleteHandler
      Extract deletion preconditions to its own class
    
    Adapt DeleteProjectIT to master's AbstractDaemonTest
    createProjectOverAPI method, replacing the pre-master createProject
    ones.
    
    Change-Id: Ib0fb7be6160c3aabfa763b751bcb682fe2c54346
    
  - Merge branch 'stable-2.15' into stable-2.16
    
    * stable-2.15:
      Bazel: Include eclipse-out directory in .bazelignore
      Add explanatory comment to empty BUILD file(s)
    
    Change-Id: Ie99d742ec161ecf675bed674fdc939fb6ced71f2
    
  - Merge branch 'stable-2.14' into stable-2.15
    
    * stable-2.14:
      Bazel: Include eclipse-out directory in .bazelignore
    
    Change-Id: I8a7b1bbb90361fa99d9f32fb8b444a0004502897
    
  - Bazel: Include eclipse-out directory in .bazelignore
    
    Since [1] (included since 0.17) Bazel added support for a .bazelignore
    file, allowing to specify directories that should be ignored.
    
    [1] bazelbuild/bazel#4888
    
    Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
    
  - Merge branch 'stable-2.14' into stable-2.15
    
    * stable-2.14:
      Add explanatory comment to empty BUILD file(s)
    
    Change-Id: I26811188253cc4d73bd0470bafad6fb0f5edbb61
    
  - Add explanatory comment to empty BUILD file(s)
    
    Change-Id: Ifc4e5146672ffa35ba45882cafaae82bf9ea5751
    
  - Merge branch 'stable-2.15' into stable-2.16
    
    * stable-2.15:
      Update mockito to 2.23.4
      Always pass ALLOW_INSECURE to MoreFiles.deleteRecursively
      ArchiveRepositoryRemoverTest: Refactor assertions on repo content
      Format external_plugin_deps.bzl with buildifier
      Upgrade bazlets to latest stable-2.14 to build with 2.14.17 API
      Upgrade bazlets to latest stable-2.14 to build with 2.14.16 API
      Align Eclipse compiler settings with core Gerrit's
      WORKSPACE: Make commented out lines spaces indent consistent
      Add IT test
      FilesystemDeleteHandler: Use more readable name for trash folder
      Configure whether to allow user to select preserve
      Introduce an archiving mechanism for deleted repos
      bazlets: Replace native.git_repository with skylark rule
      Harmonize external dependency names to use hyphen
      Upgrade mockito to 2.23.0
      Update bazlets to latest stable-2.14 to build with 2.14.15 API
      Update bazlets to latest stable-2.14 to build with 2.14.14 API
      Update bazlets to latest stable-2.14 to build with 2.14.13 API
      FilesystemDeleteHandler: Don't instantiate event if there are no listeners
      FilesystemDeleteHandler: Rename deletedListener to deletedListeners
      DatabaseDeleteHandler.java: Remove unused Provider<InternalChangeQuery>
      Add RecursiveDeleteOption.ALLOW_INSECURE for recursive deletion
      Simplify DeleteTrashFolder
      DeleteTrashFolders: Extract predicate to its own class
      Add unit test for DeleteTrashFolders
      Update bazlets to latest stable-2.14 to use 2.14.12 API
      Migrate `tools/bazel.rc` to `.bazelrc`
      Tidy up FilesystemDeleteHandler
      Add unit tests for FilesystemDeleteHandler
      Extract deletion preconditions to its own class
    
    Change-Id: Id48037c00116b10ca809835d03f915ae231a629d
    
  - Merge branch 'stable-2.14' into stable-2.15
    
    * stable-2.14:
      Update mockito to 2.23.4
      Always pass ALLOW_INSECURE to MoreFiles.deleteRecursively
      ArchiveRepositoryRemoverTest: Refactor assertions on repo content
      Format external_plugin_deps.bzl with buildifier
      Upgrade bazlets to latest stable-2.14 to build with 2.14.17 API
      Upgrade bazlets to latest stable-2.14 to build with 2.14.16 API
    
    Change-Id: Ie45390df44f13bf66234cf8b41f3e51eb405701d
    
  - Merge branch 'stable-2.14' into stable-2.15
    
    * stable-2.14:
      Align Eclipse compiler settings with core Gerrit's
      WORKSPACE: Make commented out lines spaces indent consistent
      Add IT test
      FilesystemDeleteHandler: Use more readable name for trash folder
      Configure whether to allow user to select preserve
      Introduce an archiving mechanism for deleted repos
      bazlets: Replace native.git_repository with skylark rule
      Harmonize external dependency names to use hyphen
      Upgrade mockito to 2.23.0
      Update bazlets to latest stable-2.14 to build with 2.14.15 API
      Update bazlets to latest stable-2.14 to build with 2.14.14 API
      Update bazlets to latest stable-2.14 to build with 2.14.13 API
      FilesystemDeleteHandler: Don't instantiate event if there are no listeners
      FilesystemDeleteHandler: Rename deletedListener to deletedListeners
      DatabaseDeleteHandler.java: Remove unused Provider<InternalChangeQuery>
      Add RecursiveDeleteOption.ALLOW_INSECURE for recursive deletion
      Simplify DeleteTrashFolder
      DeleteTrashFolders: Extract predicate to its own class
      Add unit test for DeleteTrashFolders
      Update bazlets to latest stable-2.14 to use 2.14.12 API
      Migrate `tools/bazel.rc` to `.bazelrc`
      Tidy up FilesystemDeleteHandler
      Add unit tests for FilesystemDeleteHandler
      Extract deletion preconditions to its own class
    
    Change-Id: Iba2e175783cf18ace0329efe81fc417640f77aa0
    
  - Update mockito to 2.23.4
    
    Also update its dependency byte buddy to 1.9.3.
    
    Change-Id: I23d224db808e8620ac136c428f75a467065e0528
    
  - Upgrade bazlets to latest stable-2.16 to build with 2.16 API
    
    Change-Id: I9f565aba3467ca7fab9036d201b4d901002b45f0
    
  - Always pass ALLOW_INSECURE to MoreFiles.deleteRecursively
    
    If ALLOW_INSECURE is not set, it fails on OSX with:
    
      unable to guarantee security of recursive delete
    
    See change Ic0894b88e for previous fix.
    
    Change-Id: I0e323230542174a14c5d2038df838052af6fc5be
    
  - ArchiveRepositoryRemoverTest: Refactor assertions on repo content
    
    The current assertion for an empty folder only checks if there is
    any content and fails if there is. Refactor it so that when it fails
    it includes a message listing the actual content that was unexpected.
    
    Change-Id: Ie974690cf90f98bb517a9b4dc195b09076c3a076
    
  - Format external_plugin_deps.bzl with buildifier
    
    Change-Id: Ic654b81b5f91726fecc0599d96ff06f75d0e8c07
    
  - Upgrade bazlets to latest stable-2.14 to build with 2.14.17 API
    
    Change-Id: Ib8f6629f514119d6cbdb445bb3654a66c98168a5
    
  - Upgrade bazlets to latest stable-2.14 to build with 2.14.16 API
    
    Change-Id: I1b17a3692ad762861d19affc7fb46afca9387432
    
  - Align Eclipse compiler settings with core Gerrit's
    
    Having the same compiler settings as core Gerrit means that when
    the project is opened in its standalone Eclipse project, the same
    warnings appear as when opened within the Gerrit tree (i.e. as a
    bundled plugin).
    
    Change-Id: I72ee1b550db591655370952a1465ad1fdf4acb9b
    
  - WORKSPACE: Make commented out lines spaces indent consistent
    
    Change-Id: Idf671f1e4699123f991502763a5a3e530addaf5a
    
  - Merge "bazlets: Replace native.git_repository with skylark rule" into stable-2.14
  - Merge changes I28300bd3,I2028c0db,I62985e8f into stable-2.14
    
    * changes:
      Add IT test
      Configure whether to allow user to select preserve
      Introduce an archiving mechanism for deleted repos
    
  - Merge "FilesystemDeleteHandler: Use more readable name for trash folder" into stable-2.14
  - Add IT test
    
    Change-Id: I28300bd3e1a606b99f1f902eccc691f8681900d8
    
  - Configure whether to allow user to select preserve
    
    In some cases, it could be desirable to prevent users from choosing the
    "Preserve git repository" option when deleting a project. For example,
    when the administrators have choose to archive a repository instead of
    deleting it and the preserve option is selected, the repository will be
    present twice on the file system.
    
    Add a new configuration, enablePreserveOption, to control whether to
    enable the preserve option on the UI and the ssh command.
    
    In order to keep the current behaviour, the default value of this option
    is set to true. If this configuration is set to be false, the deleted
    git repository will not be preserved.
    
    Change-Id: I2028c0dbe126a56d4b71f44742bd5fc734465631
    
  - Introduce an archiving mechanism for deleted repos
    
    So far, if the preserveGitRepository option was set to false, once a
    repository was deleted, there was no way to recover it. Even if this
    makes sense, mistakes happen and it could be handy to have a backup
    mechanism when they occur. Besides, in some environments it could be
    desirable to give end users the permission to delete their own projects
    as this reduces the administrative tasks. In this case, being able to
    recover mistakenly deleted repositories could be even more critical.
    
    Introduce a new option to archive a repository instead of deleting it.
    This will allow the administrators to recover the git repositories in
    case of deletion by mistake. From the user point of view, and even for
    Gerrit, the repository is deleted as it is no longer available given it
    is moved to a different name and under a different, configurable named,
    folder.
    
    The archived repositories are kept for a configurable amount of time
    after which they are deleted; the auto-cleaning of the archived git
    repositories is done periodically, i.e., once a day.
    
    Three new configuration fields are added to customize the behaviour of
    this feature:
    
      - archiveDeletedRepos: whether to enable this feature. By default
        false.
      - archiveFolder: the path of the target archive folder. By default,
        the plugin data folder.
      - deleteArchivedReposAfter: the time period to keep the archived git
        repositories. By default, 180 days. If archiveDeletedRepos is true
        but this values is set to 0, the periodic task will not run and the
        archived repositories need to be cleaned manually or using an
        external task.
    
    Change-Id: I62985e8ffa5e3300c6927507e793dffd7aa2e54c
    
  - FilesystemDeleteHandler: Use more readable name for trash folder
    
    Some users consider more readable to use a time format that includes the
    date and time the repository was moved to the trash rather than an epoch
    number.
    
    Change-Id: I7d9733373a6d2ddd01905b6e44084d9cfdfc67fd
    
  - bazlets: Replace native.git_repository with skylark rule
    
    The native.git_repository rule does not work properly when invoked
    in a `git submodule foreach` command. Bazel will deprecate the
    native rules anyway, so replace with skylark's git_repository.
    
    See [1] for context.
    
    [1] bazelbuild/bazel#6358 (comment)
    
    Change-Id: I336ec65f6751ee526c95ea46c9ccb4905f5b6fc3
    
  - Harmonize external dependency names to use hyphen
    
    Change-Id: Ica25b94672a11e9cc2001b5a9d68fe981f22b7e0
    
  - Upgrade mockito to 2.23.0
    
    Change-Id: I2e629c54b842cae3f36f48f7c86e2348b8d7a68f
    
  - Update bazlets to latest stable-2.14 to build with 2.14.15 API
    
    Change-Id: Ib402205ea2d20aeccd6d45cb52dbcba540b5a867
    
  - Update bazlets to latest stable-2.14 to build with 2.14.14 API
    
    Change-Id: I2b558fcdedde748dc8b781218277cf1618b6c3ce
    
  - Update bazlets to latest stable-2.14 to build with 2.14.13 API
    
    Change-Id: I4a7d001ae9314d51ee6166c2429746b51679d2da
    
  - FilesystemDeleteHandler: Don't instantiate event if there are no listeners
    
    If there are no ProjectDeletedListener instances registered, it is
    not necessary to instantiate an Event object that will not be used.
    
    Check if there are any listeners, and early exit when there are none.
    
    Change-Id: Ib036920e2c2d07507748fcc182db7568dbdb96f4
    
  - FilesystemDeleteHandler: Rename deletedListener to deletedListeners
    
    Change-Id: I126266d0105aa3f51a78107b428ce47b8e286816
    
  - DatabaseDeleteHandler.java: Remove unused Provider<InternalChangeQuery>
    
    Change-Id: Iff67e58fee00a1f7fd3a9259e1f914ef2216f882
    Signed-off-by: Jacek Centkowski <jcentkowski@collab.net>
    
  - Add RecursiveDeleteOption.ALLOW_INSECURE for recursive deletion
    
    Otherwise unit tests are failing on osx with the following error:
    JUnit4 Test Runner
    ...............log4j:WARN No appenders could be found for logger
      (org.eclipse.jgit.util.FS).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig
      for more info.
    E......
    Time: 1.255
    There was 1 failure:
    1) testStart(com.googlesource.gerrit.plugins.deleteproject.fs
      .DeleteTrashFoldersTest)
    java.lang.AssertionError: The subject was expected to be false,
      but was true
        at com.googlesource.gerrit.plugins.deleteproject.fs
          .DeleteTrashFoldersTest.testStart(DeleteTrashFoldersTest.java:63)
          ...
    
    which is caused by:
    [2018-09-18 15:23:01,351] [DeleteTrashFolders] ERROR com.googlesource.gerrit
        .plugins.deleteproject.fs.DeleteTrashFolders :
      Failed to delete /.../repo.1234567890123.deleted
      com.google.common.io.InsecureRecursiveDeleteException:
        /.../repo.1234567890123.deleted:
        unable to guarantee security of recursive delete
        at com.google.common.io.MoreFiles
          .checkAllowsInsecure(MoreFiles.java:739)
        at com.google.common.io.MoreFiles
          .deleteRecursively(MoreFiles.java:525)
        at com.googlesource.gerrit.plugins.deleteproject.fs
          .DeleteTrashFolders
            .recursivelyDelete(DeleteTrashFolders.java:102)
    
    Change-Id: Ic0894b88e912ef538796f6817065d974b28bc0a4
    Signed-off-by: Jacek Centkowski <jcentkowski@collab.net>
    
  - Simplify DeleteTrashFolder
    
    Replace inner class with Java 8 stream, Files.walkFileTree() with Files.
    walk() and for recursive removal of subtree, use Guava's MoreFiles.
    deleteRecursively.
    
    Change-Id: I3007bb608ab27920627d016943b1de67682fd590
    
  - DeleteTrashFolders: Extract predicate to its own class
    
    Change-Id: If6f754ecccd5313bb46e71b366eb2264487e3432
    
  - Add unit test for DeleteTrashFolders
    
    Change-Id: I1873f5e9e748b33edd42bd40d31a9ca8e7cf6d48
    
  - Merge "Tidy up FilesystemDeleteHandler" into stable-2.14
  - Update bazlets to latest stable-2.14 to use 2.14.12 API
    
    Change-Id: Ie46bb591a5e2577c60a83bfead7aa3ea06bdd1e6
    
  - Migrate `tools/bazel.rc` to `.bazelrc`
    
    Since: [1] Bazel changed the list of resource file locations.
    Adapt to that list and move `%workspace%/tools/bazelrc` to
    `%workspace%/.bazelrc`.
    
    [1] bazelbuild/bazel@ec83598
    
    Change-Id: I3d2c05691b757684ba8f816cf2669c754dd77888
    (cherry picked from commit b31596bb73cc8a67481ba3439f44384341bd15e4)
    
  - Tidy up FilesystemDeleteHandler
    
    * Inline one-time use variables
    * Remove final from method parameters
    * Rename, reorder and extract additional methods to improve readability
    * Use Guava's MoreFiles.deleteRecursively instead of Path walkers
    
    Change-Id: I3808c3e78e3a572c158a88abe8cb77d3f2168b6e
    
  - Add unit tests for FilesystemDeleteHandler
    
    Change-Id: I6016003bc8938e6389e17cb96bd5a439f803b4c0
    
  - Extract deletion preconditions to its own class
    
    Instead of spreading the assertions done before deleting a change in
    several classes, extract them in a dedicated class, DeletePreconditions.
    This eases the unit testing of the now simplified classes and better
    reflects the fact that some of these assertions do not belong anymore to
    the class where they were hosted. One example: the check for submodules
    was in the DatabaseDeleteHandler class because this information used to
    be in the database, but this is no longer the case.
    
    Additional test coverage for this class will be provided in an upcoming
    change adding IT tests.
    
    Change-Id: Ie1f513f5981035aba217200f608c6ca6e6357cb1
@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
@philwo philwo removed the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Nov 29, 2021
gitworkflows pushed a commit to khulnasoft-lab/gitiles that referenced this issue May 15, 2024
The native.git_repository rule does not work properly when invoked
in a `git submodule foreach` command. Bazel will deprecate the
native rules anyway, so replace with skylark's git_repository.

See [1] for context.

[1] bazelbuild/bazel#6358 (comment)

Change-Id: I938a7c55793f294461d3517556aa13e029012936
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. untriaged
Projects
None yet
Development

No branches or pull requests

5 participants