Repository: google/osv.dev

Issue:
indexer: version matching regex not broad enough.
Noticed that we were missing some indexes for c-ares. and our indexer logs show:

```
failed to extract version for repo: https://github.com/c-ares/c-ares.git tag/branch: refs/tags/cares-1_5_0
```

We should should make the [indexer version extraction logic](https://github.com/google/osv.dev/blob/e756517994e3f250c5426e765a1287608b4e6174/docker/indexer/stages/preparation/preparation.go#L46) match our Python one here: https://github.com/google/osv.dev/blob/master/osv/bug.py

We should also just delete the config setting from most of our indexer yaml configs as well as just use this single generic one. 


Discussion:
@another-rex mind making this quick fix? 

Resolving patch:
diff --git a/gcp/api/server.py b/gcp/api/server.py
--- a/gcp/api/server.py
+++ b/gcp/api/server.py
@@ -188,7 +188,7 @@ def build_determine_version_result(
       continue
 
     if idx.empty_bucket_bitmap is None:
-      logging.warning('No empty bucket bitmap: %s@%s', idx.name, idx.version)
+      logging.warning('No empty bucket bitmap for: %s@%s', idx.name, idx.tag)
       continue
 
     # Byte order little is how the bitmap is stored in the indexer originally
@@ -212,6 +212,11 @@ def build_determine_version_result(
         abs(idx.file_count - max_files)  # The difference in file count
     )
 
+    version = osv.normalize_tag(idx.tag.removeprefix(_TAG_PREFIX))
+    version = version.replace('-', '.')
+    if not version:  # This tag actually isn't a version (rare)
+      continue
+
     version_match = osv_service_v1_pb2.VersionMatch(
         score=(max_files - estimated_diff_files) / max_files,
         minimum_file_matches=file_matches_by_proj[idx.key],
@@ -221,8 +226,8 @@ def build_determine_version_result(
             address=idx.repo_addr,
             commit=idx.commit.hex(),
             tag=idx.tag.removeprefix(_TAG_PREFIX),
-        ),
-    )
+            version=version,
+        ))
 
     if version_match.score < _DETERMINE_VER_MIN_SCORE_CUTOFF:
       continue
diff --git a/osv/models.py b/osv/models.py
--- a/osv/models.py
+++ b/osv/models.py
@@ -659,8 +659,6 @@ class RepoIndex(ndb.Model):
   commit = ndb.BlobProperty()
   # The source address
   repo_addr = ndb.StringProperty()
-  # The identified version
-  version = ndb.StringProperty()
   # The scanned file extensions
   file_exts = ndb.StringProperty(repeated=True)
   # The hash algorithm used


Test patch:
diff --git a/docker/indexer/config/config_test.go b/docker/indexer/config/config_test.go
--- a/docker/indexer/config/config_test.go
+++ b/docker/indexer/config/config_test.go
@@ -1,17 +1,17 @@
 /*
 Copyright 2022 Google LLC
 
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+	Licensed under the Apache License, Version 2.0 (the "License");
+	you may not use this file except in compliance with the License.
+	You may obtain a copy of the License at
 
-     http://www.apache.org/licenses/LICENSE-2.0
+	    http://www.apache.org/licenses/LICENSE-2.0
 
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+	Unless required by applicable law or agreed to in writing, software
+	distributed under the License is distributed on an "AS IS" BASIS,
+	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	See the License for the specific language governing permissions and
+	limitations under the License.
 */
 package config
 
@@ -26,7 +26,6 @@ address: "example.com/abc"
 name: "abc"
 type: "GIT"
 base_cpe: "cpe"
-version_regex: ".*"
 hash_all_commits: true
 branch_versioning: true
 file_extensions:
@@ -40,7 +39,6 @@ func TestParseConfig(t *testing.T) {
 		Name:             "abc",
 		Type:             "GIT",
 		BaseCPE:          "cpe",
-		VersionRE:        ".*",
 		HashAllCommits:   true,
 		BranchVersioning: true,
 		FileExts:         []string{".c", ".cc"},