Skip to content

Commit be2747b

Browse files
Catalin-Stratulat-EricssonefiacorliamfallonJamesMcDermottrendre-greyling
authored
Docs main placeholder pr concept (#1026)
* Adding concept for main/placeholder PackageRevision Signed-off-by: Catalin-Stratulat-Ericsson <catalin.stratulat@ericsson.com> * missed newline Signed-off-by: Catalin-Stratulat-Ericsson <catalin.stratulat@ericsson.com> * Apply suggestions from code review Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> Co-authored-by: JamesMcDermott <james.j.mcdermott@ericsson.com> Co-authored-by: Rendre Greyling <rendre.greyling@nokia.com> Signed-off-by: Catalin Stratulat <159934629+Catalin-Stratulat-Ericsson@users.noreply.github.com> * addressing comments about main deletion + summary table amends Signed-off-by: Catalin-Stratulat-Ericsson <catalin.stratulat@ericsson.com> * removing dangerous statement about user modification of packages inside git without porch on front page Signed-off-by: Catalin-Stratulat-Ericsson <catalin.stratulat@ericsson.com> * Apply suggestions from code review applied the last of the suggestions Co-authored-by: JamesMcDermott <james.j.mcdermott@ericsson.com> Signed-off-by: Catalin Stratulat <159934629+Catalin-Stratulat-Ericsson@users.noreply.github.com> --------- Signed-off-by: Catalin-Stratulat-Ericsson <catalin.stratulat@ericsson.com> Signed-off-by: Catalin Stratulat <159934629+Catalin-Stratulat-Ericsson@users.noreply.github.com> Co-authored-by: Fiachra Corcoran <fiachra.corcoran@est.tech> Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> Co-authored-by: JamesMcDermott <james.j.mcdermott@ericsson.com> Co-authored-by: Rendre Greyling <rendre.greyling@nokia.com>
1 parent cb1ba1c commit be2747b

3 files changed

Lines changed: 121 additions & 13 deletions

File tree

docs/content/en/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ All package changes are committed to Git with full history. Works seamlessly wit
4545
Packages move through lifecycle stages (Draft → Proposed → Published → DeletionProposed) with explicit approval gates.
4646
{{% /blocks/feature %}}
4747
{{% blocks/feature icon="fas fa-cube" title="Standard kpt Packages" %}}
48-
Manages standard kpt packages with no vendor lock-in. Packages can be edited through Porch or directly in Git.
48+
Manages standard kpt packages with no vendor lock-in.
4949
{{% /blocks/feature %}}
5050
{{% blocks/feature icon="fas fa-code-branch" title="Package Cloning & Upgrades" %}}
5151
Clone packages from upstream sources and automatically upgrade when new versions are published. Three-way merge handles local customizations.

docs/content/en/docs/2_concepts/_index.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,9 @@ This section introduces some core concepts of Porch's package orchestration:
7575
package revision is created with its workspace name given a value of "V2", it could very well end up with a Revision
7676
of `4` once published
7777

78-
* ***Placeholder package revision***: A dummy package revision reference that points at a package's latest package revision.
79-
The placeholder package revision is created by Porch simultaneously with the first package revision for a particular
80-
package. Each time a new package revision is published on the package, the placeholder package revision is updated (actually
81-
deleted and recreated).
82-
83-
The following rules apply:
84-
* there is always at most one placeholder package revision for a package
85-
* it always has a revision number of `-1`
86-
* its workspace name is always the branch in the Git repository on which the package revision exists - usually (though
87-
not always) `main`
88-
* its naming comvention is `{repository-name}.{package-name}.{branch-name}`, where {branch-name} is the branch in Git
89-
on which the package revision exists
78+
* ***[Placeholder package revision]({{% relref "placeholder-package-revision" %}})***: A package revision that tracks
79+
the most recent content of a package in its repository. It is created automatically when the first revision
80+
of a package is published and updated on each subsequent publish.
9081

9182
* ***[Upstream and Downstream]({{% relref "upstream-downstream" %}})***: source-and-derivation relationships between
9283
package revisions. When a package revision is cloned, it becomes the **upstream** (source) in its relationship to the
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
title: "Placeholder Package Revision"
3+
type: docs
4+
weight: 4
5+
description: |
6+
The placeholder package revision tracks the most recent content of a package in its repository. This page explains its behaviour, lifecycle interactions, and how it relates to GitOps workflows.
7+
---
8+
9+
## Overview
10+
11+
The placeholder package revision is a special PackageRevision that Porch creates automatically as a reference to the latest released version of a package. It acts as a "branch-tracking" reference: the placeholder package revision points at the version of the package at the HEAD of the branch of the repository where the package revision is stored.
12+
13+
**Identifying a placeholder:**
14+
15+
| Property | Value |
16+
|----------|-------|
17+
| Revision number | `-1` |
18+
| Workspace name | The branch configured on the Repository CR (`spec.git.branch`), commonly `main` |
19+
| Naming convention | `{repository-name}.{package-name}.{branch-name}` |
20+
| Lifecycle | `Published` |
21+
22+
There is one and only one placeholder package revision per package.
23+
24+
## When Is It Created?
25+
26+
The placeholder package revision is created automatically when the **first revision** of a package is published (transitions from Proposed to Published). You cannot create it manually.
27+
28+
For example, publishing `example-repository.my-package.v1` (revision 1) will also create `example-repository.my-package.main` (revision -1) with the same content.
29+
30+
## When Is It Updated?
31+
32+
Each time a **new revision** of the same package is published, the placeholder is updated to reflect that revision's content and tasks.
33+
34+
For example:
35+
1. Publish v1 (revision 1): placeholder is **created** with v1's content
36+
2. Publish v2 (revision 2): placeholder is **updated** with v2's content
37+
38+
The placeholder **only moves forward** on each explicit publish operations.
39+
40+
## What Happens When the Latest Package Revision Is Deleted?
41+
42+
Deleting the latest published package revision does **not** cause the placeholder to roll back to a previous revision. The placeholder retains the content it had at the time of the last publish. It still refers to the version of the Package Revision at the HEAD of the branch in git.
43+
44+
This is intentional. Consider the scenario:
45+
46+
1. v1 is published (placeholder reflects v1)
47+
2. v2 is published (placeholder reflects v2)
48+
3. v2 is deleted
49+
50+
After step 3, the placeholder **still reflects v2's content**. It does not fall back to v1.
51+
52+
**This occurs because** the deletion of a PackageRevision in Porch:
53+
54+
- Removes the tag/branch reference from Git
55+
- Removes the Porch metadata
56+
57+
However, it does **not** perform a `git revert` on the tracked branch. The actual content on that branch in Git is unchanged. The placeholder remains consistent with the real Git state.
58+
59+
## How to Roll Back a Package
60+
61+
Since the placeholder only moves forward, the intended way to "roll back" is to publish a new revision with the desired content:
62+
63+
1. Copy the older revision to create a new draft:
64+
65+
```bash
66+
porchctl rpkg copy example-repository.my-package.v1 \
67+
--namespace=default --workspace=v3
68+
```
69+
70+
2. Propose and approve it:
71+
72+
```bash
73+
porchctl rpkg propose example-repository.my-package.v3 --namespace=default
74+
porchctl rpkg approve example-repository.my-package.v3 --namespace=default
75+
```
76+
77+
3. The placeholder now reflects v3 (which has v1's content)
78+
79+
This preserves linear Git history and makes the intent **explicit**.
80+
81+
## Relationship to GitOps
82+
83+
In a GitOps workflow, a reconciler (such as Flux or ArgoCD) watches a branch in Git for changes. The placeholder package revision references this branch.
84+
85+
The branch is configured via `spec.git.branch` on the Repository CR. This is commonly `main` but can be any branch name (e.g. `production`, `release`, `staging`). The placeholder's workspace name will match whatever branch is configured.
86+
87+
Because the placeholder mirrors the real state of that branch:
88+
89+
- What the reconciler sees in Git is what the placeholder represents in Porch
90+
- There is no divergence between Porch's view and the deployed state
91+
- Deleting a PackageRevision in Porch does not cause unexpected changes in the deployed environment
92+
93+
## Can the Placeholder Be Deleted?
94+
95+
Yes. The placeholder is **not immutable**. It can be deleted via `porchctl` like any other PackageRevision. This is useful during package cleanup (e.g. removing a package entirely from a repository).
96+
97+
Deleting the placeholder **removes the package content from the configured Git branch**. A commit is made to the branch (e.g. `main`) that deletes the package directory and its files. This means any GitOps reconciler watching that branch will also see the removal.
98+
99+
## Summary
100+
101+
| Action | Effect on Placeholder |
102+
|--------|----------------------|
103+
| First revision published | Placeholder **created** |
104+
| Subsequent revision published | Placeholder **updated** to new content |
105+
| Published revision deleted | Placeholder **unchanged** (no rollback) |
106+
| Placeholder itself deleted | Removed from Porch and content deleted from Git branch |
107+
| New revision published after placeholder deletion | Placeholder **recreated** with contents of the new revision |
108+
109+
## Restrictions
110+
111+
The placeholder cannot be used as a source for certain operations:
112+
113+
- **Clone**: cannot clone from a placeholder
114+
- **Edit/Copy**: cannot edit or copy a placeholder
115+
- **Upgrade**: cannot upgrade a placeholder or use a placeholder as the target upstream of an upgrade
116+
117+
These operations require a specific published revision with a concrete revision number.

0 commit comments

Comments
 (0)