1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00
Commit graph

17283 commits

Author SHA1 Message Date
epriestley
13a37282bc Formalize some more Drydock conditions and bookkeeping
Summary:
Ref T13677. Track which resources a given lease has begun allocating or reclaiming in a more formal way, and add logging for waiting actions.

The "allocating" mechanism is new. This will replace an existing similar "reclaiming" mechanism in a future change.

Test Plan: See followup changes.

Subscribers: yelirekim, PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13677

Differential Revision: https://secure.phabricator.com/D21806
2022-05-09 10:40:08 -07:00
epriestley
1b6727ac3d Add "--all" flags to "release-lease" and "release-resource" workflows in "bin/drydock"
Summary: Ref T13677. These flags increase the convenience of testing in a development environment.

Test Plan: Used new "--all" flags to release all resources and leases.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13677

Differential Revision: https://secure.phabricator.com/D21805
2022-05-09 10:40:08 -07:00
epriestley
6417e950f6 Don't reclaim resources that have a destroyed lease less than 3 minutes old
Summary:
Ref T13676. The 3-minute grace period when a resource can not be reclaimed after its leases are released currently doesn't work reliably because the Resource object usually isn't actually updated when a lease is released.

Add an additional check for recently-destroyed leases, and extend the grace period if we find any.

Test Plan:
  - See T13676. Ran reproduction sequence there, observed immediate resource reclamation.
  - Applied patch.
  - Ran sequence again, observed repository B wait 3 minutes to reclaim a repository A resource.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13676

Differential Revision: https://secure.phabricator.com/D21803
2022-05-03 15:57:16 -07:00
epriestley
dfdbe7a6be Allow "bin/drydock lease ..." to select particular blueprints with "--blueprint"
Summary: Ref T13676. See discussion in that task.

Test Plan: Tried nonsense blueprint identifiers, duplicate identifiers, incompatible identifiers, and valid identifiers. Got apparently sensible behavior in all cases.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13676

Differential Revision: https://secure.phabricator.com/D21802
2022-05-03 15:57:16 -07:00
epriestley
25cf955a89 Use the same logic in "bin/drydock lease" and LeaseUpdateWorker to identify candidate blueprints
Summary:
Ref T13676. Currently, "bin/drydock lease" just creates a lease that permits any blueprint.

To prepare for "use specific blueprint X", unify the logic between this workflow and LeaseUpdateWorker so we select only blueprints which at least have coarse compatibility (e.g., if we're leasing a host, only select enabled blueprints of classes that can allocate hosts).

Test Plan: Used `bin/drydock lease` to try to lease a nonsense type, got sensible error. Leased a host.

Subscribers: yelirekim, PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13676

Differential Revision: https://secure.phabricator.com/D21801
2022-05-03 15:57:16 -07:00
epriestley
30c3d1e929 Allow "bin/drydock lease" to acquire many identical leases with "--count N"
Summary: Ref T13676. This makes it easier to create resource pressure without juggling a big pile of terminals.

Test Plan: Used `bin/drydock lease --count 5 ...` to acquire 5 leases.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13676

Differential Revision: https://secure.phabricator.com/D21800
2022-05-03 15:57:15 -07:00
epriestley
9ec6677c02 Update "bin/drydock command" help text to use more standard quoting
Summary: Ref T13676. Modern conventions quote flags in help text.

Test Plan: Read text.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13676

Differential Revision: https://secure.phabricator.com/D21797
2022-05-03 15:57:15 -07:00
epriestley
d1fd2975b0 Fail in a more comprehensible way when a WorkingCopy lease omits or mangles "repositories.map"
Summary: Ref T13676. When the required "repositories.map" attribute is omitted, `bin/drydock lease` currently fatals in an unhelpful way when trying to lease a working copy.

Test Plan:
Ran `bin/drydock lease --type working-copy` with no attributes, after following steps in T13676.

```
<Allocation Failed> One or more blueprints promised a new resource, but failed when allocating: [PhutilAggregateException] All blueprints failed to allocate a suitable new resource when trying to allocate lease ("PHID-DRYL-orbtwtlinksm3xqpyhmw").
    - Exception: Working copy lease is missing required attribute "repositories.map".

      Attribute "repositories.map" should be a map of repository specifications.
```

Subscribers: yelirekim, PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13676

Differential Revision: https://secure.phabricator.com/D21796
2022-05-03 15:57:15 -07:00
epriestley
00a20d3cdc Fix various "strlen(null)" PHP 8.1 issues on "bin/phd" and "bin/drydock" pathways
Summary: Ref T13676. Ref T13588. Fix some issues that prevent "bin/phd" and "bin/drydock" from executing under PHP 8.1, broadly because `null` is being passed to `strlen()`.

Test Plan: Ran `bin/phd debug task` and `bin/drydock ...` under PHP 8.1.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13676, T13588

Differential Revision: https://secure.phabricator.com/D21795
2022-05-03 15:57:15 -07:00
epriestley
c415622923 Remove the "Phragment" application
Summary:
Ref T5479. Ref T13658. This was a contributed application from the early days of Phabricator which never had customers or users in the wild. The contributor moved on from the project many years ago.

Any capabilities in this general role would look different today. It also has one or two product name literal strings, so this is as good a time as any to remove it.

This change does not remove storage; I'll issue upgrade guidance and do that separately after some time.

Test Plan: Grepped for "phragment", got no relevant hits.

Subscribers: hach-que, PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13658, T5479

Differential Revision: https://secure.phabricator.com/D21793
2022-04-25 16:46:27 -07:00
epriestley
84b0c5a669 Remove the "Releeph" application
Summary:
Ref T9530. Ref T13658. The "Releeph" application was never useful outside of Facebook and any application providing release support would not resemble it much.

It has some product name literal strings, so now is as good a time as any to get rid of it.

This application never left prototype and I'm not aware of any install in the wild that uses it (or has ever used it).

I did not destroy the database itself. I'll issue upgrade guidance and destroy the database in some future release, just in case.

Test Plan: Grepped for "releeph", found no relevant/removable hits.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13658, T9530

Differential Revision: https://secure.phabricator.com/D21792
2022-04-25 16:46:27 -07:00
epriestley
27b512e284 Remove product literal strings in "pht()", part 25
Summary: Ref T13658.

Test Plan: Static checks only.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21791
2022-04-25 16:46:26 -07:00
epriestley
bc7f87591f Remove product literal strings in "pht()", part 24
Summary: Ref T13658.

Test Plan: Static checks only.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21790
2022-04-25 16:46:26 -07:00
epriestley
0c5ab2c164 Remove product literal strings in "pht()", part 23
Summary: Ref T13658.

Test Plan: Static checks only.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21789
2022-04-25 16:46:26 -07:00
epriestley
7fd8263185 Remove product literal strings in "pht()", part 22
Summary: Ref T13658.

Test Plan: Static checks only.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21788
2022-04-25 16:46:26 -07:00
epriestley
b1079b79e5 Remove product literal strings in "pht()", part 21
Summary: Ref T13658.

Test Plan: Static checks only.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21787
2022-04-25 16:46:26 -07:00
epriestley
07723b4627 Remove product literal strings in "pht()", part 20
Summary: Ref T13658.

Test Plan: Static checks only.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21786
2022-04-25 16:46:25 -07:00
epriestley
2f4ac2a804 Remove product literal strings in "pht()", part 19
Summary: Ref T13658.

Test Plan: Static checks only.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21785
2022-04-25 16:46:25 -07:00
epriestley
2f95330c5a Remove product literal strings in "pht()", part 18
Summary: Ref T13658.

Test Plan: Static checks only.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21784
2022-04-25 16:46:25 -07:00
epriestley
55770a2ca8 Remove product literal strings in "pht()", part 17
Summary: Ref T13658.

Test Plan:
This is non-exhaustive.

  - Viewed "diffusion.looksoon" Conduit API method page.
  - Viewed config settings.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21783
2022-04-25 16:46:25 -07:00
epriestley
9df1bbd31d Remove product literal strings in "pht()", part 16
Summary: Ref T13658.

Test Plan:
This plan is non-exhaustive.

  - Looked at config options.
  - Ran `bin/phd`.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21782
2022-04-25 16:46:25 -07:00
epriestley
ce1972bfae Remove product literal strings in "pht()", part 15
Summary: Ref T13658.

Test Plan: Static checks only, these are all reachable only by breaking your install in weird ways.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21781
2022-04-25 16:46:24 -07:00
epriestley
67e580be65 Remove product literal strings in "pht()", part 14
Summary: Ref T13658.

Test Plan: Static checks only, these are mostly obscure or require breaking the install in unusual ways.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21780
2022-04-25 16:46:24 -07:00
epriestley
0eddc1a62c Remove product literal strings in "pht()", part 13
Summary: Ref T13658.

Test Plan:
This is non-exhaustive.

  - Started a JIRA auth provider creation workflow.
  - Same for LDAP.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21779
2022-04-25 16:46:24 -07:00
epriestley
4d70e9d400 Remove product literal strings in "pht()", part 12
Summary: Ref T13658.

Test Plan:
This is non-exhuastive.

  - Poked around "Auth": edited a provider, toggled a provider.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21778
2022-04-25 16:46:24 -07:00
epriestley
039cbec155 Remove product literal strings in "pht()", part 11
Summary: Ref T13658.

Test Plan: Static checks only, none of these looked easily reachable.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21777
2022-04-25 16:46:24 -07:00
epriestley
adcc063242 Fix a PHP 8.1 string strictness issue in repositories
Summary: Ref T13588. This is a little too strict, as `$line` may be an integer.

Test Plan: Will deploy

Maniphest Tasks: T13588

Differential Revision: https://secure.phabricator.com/D21775
2022-04-25 12:30:45 -07:00
epriestley
297c0bbfcf Remove product literal strings in "pht()", part 10
Summary: Ref T13658. This one is a little silly since I used `split` to divide the list of files up, and only ended up with one file in the last partition.

Test Plan: Viewed Phabricator.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21774
2022-04-25 12:22:30 -07:00
epriestley
57469db22e Remove product literal strings in "pht()", part 9
Summary: Ref T13658.

Test Plan:
This test plan is non-exhaustive.

  - Ran `bin/storage databases`.
  - Viewed Badges UI exmaples page.
  - Used eval rule for `strings.platform.server.name`, got "Phabricator".

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21773
2022-04-25 12:22:29 -07:00
epriestley
4d3f0dc7c7 Remove product literal strings in "pht()", part 8
Summary: Ref T13658.

Test Plan:
This test plan is non-exhaustive.

  - Viewed "remarkup.process" Conduit method API page.
  - Viewed URIs in a Diffusion repository.
  - Viewed editor protocol configuration in Settings.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21772
2022-04-25 12:22:29 -07:00
epriestley
67795a46eb Remove product literal strings in "pht()", part 7
Summary: Ref T13658.

Test Plan: None of these strings look trivially testable, just relied on static tools.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21771
2022-04-25 12:22:28 -07:00
epriestley
b3557796fe Remove product literal strings in "pht()", part 6
Summary: Ref T13658.

Test Plan:
This test plan is non-exhaustive.

  - Ran `bin/mail`.
  - Uninstalled and reinstalled an application.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21770
2022-04-25 12:22:28 -07:00
epriestley
ad880491e8 Remove product literal strings in "pht()", part 5
Summary: Ref T13658

Test Plan:
This test plan is non-exhaustive.

  - Looked at some of the config.
  - Looked at guides.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21769
2022-04-25 12:22:27 -07:00
epriestley
d69da878d2 Remove product literal strings in "pht()", part 4
Summary: Ref T13658.

Test Plan:
This is non-exhaustive.

  - Looked at some (most?) of the config values in Config.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21768
2022-04-25 12:22:27 -07:00
epriestley
b1b3fe0ff0 Remove product literal strings in "pht()", part 3
Summary: Ref T13658.

Test Plan:
This is non-exhaustive.

  - Ran all setup checks.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21767
2022-04-25 12:22:26 -07:00
epriestley
b8b392481f Remove product literal strings in "pht()", part 2
Summary: Ref T13658.

Test Plan:
This test plan is non-exhaustive.

  - Used Auth to start an "another copy of Phabricator" OAuth server workflow.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21766
2022-04-25 12:22:26 -07:00
epriestley
3e82ab5adb Remove product literal strings in "pht()", part 1
Summary: Ref T13658. I used the linter in D21763 to identify these and `split` them into arbitrary groups of 10 files.

Test Plan:
This test plan is non-exhaustive, because some of these strings are difficult to reach.

  - Looked at "Create Service" in Almanac.
  - Used "bin/auth" to go through a one-time auth workflow (not all related strings can be hit on a single workflow).
  - Started the "Generate Keypair" worfklow in "SSH Public Keys".

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21765
2022-04-25 12:22:25 -07:00
epriestley
de980cc54e Fix an issue where Herald may fail to extract content from an empty commit
Summary:
Ref T13667. The Herald "content added" rule (and other similar rules) do not correctly extract content from empty commits.

When we load an empty raw diff, return an empty changed content map.

Ref T13588. Also fix some PHP8.1 null/string stuff

Test Plan:
  - Ran "bin/repository reparse --publish <commit>", with an empty commit hash and a nonempty commit hash.
  - Reviewed Herald transcripts for general sanity.

Maniphest Tasks: T13667, T13588

Differential Revision: https://secure.phabricator.com/D21761
2022-04-20 13:04:00 -07:00
epriestley
2188473fa7 Fix an issue where we may "min()" an empty array when viewing a revision with no changesets
Summary:
Ref T13667. When a revision's diff has no changesets (usually because Diffusion performed an automatic update with an empty commit), the UI currently tries to "min()" an empty array and fatals.

Handle this case properly.

Test Plan:
  - Created a revision with a diff with no changesets ("git commit --allow-empty" + copy-paste into web UI).
  - Viewed revision.
    - Before: "min()" fatal.
    - After: UI isn't perfect, but works without fataling.

Subscribers: cspeckmim

Maniphest Tasks: T13667

Differential Revision: https://secure.phabricator.com/D21760
2022-04-20 13:03:59 -07:00
epriestley
52df4ff515 Fix an issue where "git" may be unable to read a temporary file in Diffusion
Summary:
Ref T13673. After the changes in that task, we may execute "git config -l ..." as a user other than the user we used to write this temporary file.

Use "--file -" to pass the data instead, avoiding use of temporary files. This makes us agnostic to filesystem permissions.

Test Plan: Viewed a Git repository with submodules in Diffusion with "ssh.user" configured as a user relatively isolated from the webserver user.

Maniphest Tasks: T13673

Differential Revision: https://secure.phabricator.com/D21759
2022-04-20 13:03:59 -07:00
epriestley
21b1a304b6 Improve some PHP 8.1 behavior in "bin/auth recover"
Summary: Ref T13588. Fix a couple of argument parsing issues here.

Test Plan: Ran "bin/auth recover" under PHP 8.1.

Maniphest Tasks: T13588

Differential Revision: https://secure.phabricator.com/D21757
2022-04-19 14:55:19 -07:00
epriestley
3125d7a5f4 In Git, always "sudo" to the daemon user if a daemon user is configured
Summary:
See T13673. Recent versions of Git (and older versions with backported security patches) now refuse to run Git commands if the top-level repository directory is not owned by the user running the command.

Currently, we "sudo" to that user only when performing writes, so upgrading Git can aggressively break a Phabricator system by knocking out essentially all Diffusion/Conduit read pathways.

As an immediate mitigation, just "sudo" in all cases where a daemon user is available. This fixes the problem, and seems like the least-bad approach. The downside is that the web user may theoretically have fewer privileges than the daemon user and this could reduce the number of layers an attacker armed with some other Git vulnerability might have to get through to do something dangerous (e.g., perform a write on a pathway where only reads are expected), but any separation between the web and daemon accounts is essentially theoretical and has never been enforced.

Test Plan: Applied patch to impacted Phacility shard, saw Diffusion work properly again.

Differential Revision: https://secure.phabricator.com/D21756
2022-04-13 11:23:55 -07:00
epriestley
4dae3e7e1f Improve some UI/language for Phame posts when viewer doesn't have CAN_INTERACT
Summary: Ref T13661. Fix up some UI and language so it's more clear that this is about disabling blog comments.

Test Plan: Viewed UIs, saw some more usable strings.

Maniphest Tasks: T13661

Differential Revision: https://secure.phabricator.com/D21755
2022-04-01 12:52:58 -07:00
epriestley
aae23f0204 Give Phame blog posts configurable interact policies, with a default policy of "Same as Blog"
Summary: Ref T13661. This allows posts to have comments disabled (or restricted) on a per-post basis, and makes them inherit the containing blog policy by default.

Test Plan: Locked a post by editing its policy explicitly; locked a post by editing the containing blog policy.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13661

Differential Revision: https://secure.phabricator.com/D21754
2022-04-01 12:52:58 -07:00
epriestley
f555fbcb50 Remove unused "MARKUP_FIELD_SUMMARY" for Phame posts
Summary: Ref T13661. This ancient "RemarkupInterface" constant has no references.

Test Plan: Grepped for references, found none. Viewed a blog, viewed a post.

Maniphest Tasks: T13661

Differential Revision: https://secure.phabricator.com/D21753
2022-04-01 12:52:57 -07:00
epriestley
a9822a37aa Fix a PHP 8.1 unit test failure in Projects
Summary: Ref T13588. This field may be "null" (and is probably never the empty string, but that's a more ambitious fix).

Test Plan: Ran unit tests, got a pass.

Maniphest Tasks: T13588

Differential Revision: https://secure.phabricator.com/D21752
2022-04-01 12:52:57 -07:00
epriestley
c25595417f Give Phame blogs mutable interact policies
Summary:
Ref T13661.

I'm fairly sure these policies don't actually do anything (you can't "interact" with a blog) but the primarily support a Phame Post object policy of "Same as Parent Blog", which is the "natural" interact policy for a post.

Most of this is infrastructure support for mutable interact policies: today, only Maniphest has interact mutability and only via indirect effects (locking tasks), not through a directly mutable "Can Interact" policy.

Test Plan:
Ran storage upgrade, edited interact policy of a blog, saw appropriate persistence and transactions.

Created and edited a task to make sure there's no weird fallout from increasing what can be done with interact policies.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13661

Differential Revision: https://secure.phabricator.com/D21751
2022-04-01 12:52:56 -07:00
epriestley
5ce7f803f9 Fix double-bordered breadcrumbs in Phame blogs
Summary: Ref T13661. The Phame blog main page has a double breadcrumb border in non-live mode.

Test Plan: Viewed a blog page in internal and live modes, saw single border in both cases (previously: double border for internal mode).

Maniphest Tasks: T13661

Differential Revision: https://secure.phabricator.com/D21750
2022-04-01 12:52:56 -07:00
epriestley
6c2c80a373 Remove ancient Remarkup constants from Phame and Maniphest
Summary: Ref T13661. These constants are no longer used.

Test Plan:
For a blog with a nonempty description, viewed the "Manage" page and the home page; saw properly rendered description.

Grepped for removed constants, no hits.

Maniphest Tasks: T13661

Differential Revision: https://secure.phabricator.com/D21749
2022-04-01 12:52:55 -07:00
epriestley
28b12fb3cd Make Phame blog policies non-nullable
Summary: Ref T6203. Ref T13661. These policies are incorrectly nullable, although it's likely that no pathway exists in the application to write NULL into them. Fix the schema.

Test Plan: Ran `bin/storage upgrade`.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13661, T6203

Differential Revision: https://secure.phabricator.com/D21748
2022-04-01 12:52:55 -07:00