diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 3772efa..1980168 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -61,9 +61,18 @@ After resolving conflicts, you can commit using the commit message of the origin Then call `stg repair` to let Stg fix and create the new patch for us. ```shell +# get the commit message from the patch COMMIT_MESSAGE=$(cat ../patches-argo-cd-v2.2/01 | head -1) + +# check the commit message +echo $COMMIT_MESSAGE + +# do commit and convert into stg patch git commit -s -am "${COMMIT_MESSAGE}" stg repair + +# double check +stg series ``` Then we can export all patches. @@ -72,3 +81,152 @@ Then we can export all patches. cd .. make export-patches ``` + +## Here's another example: + +```shell +$ git apply -3 ../patches-argo-cd-v2.7/05-ui-show-kstatus-in-ui.patch +Applied patch to 'ui/src/app/applications/components/application-node-info/application-node-info.tsx' with conflicts. +U ui/src/app/applications/components/application-node-info/application-node-info.tsx + +$ git status +On branch workspace +Unmerged paths: + (use "git restore --staged ..." to unstage) + (use "git add ..." to mark resolution) + both modified: ui/src/app/applications/components/application-node-info/application-node-info.tsx + + +... We then resolved conflicts + + +$ COMMIT_MESSAGE=$(cat ../patches-argo-cd-v2.7/05-ui-show-kstatus-in-ui.patch | head -1) +$ echo $COMMIT_MESSAGE +ui: show kstatus in ui + +$ git commit -s -am "${COMMIT_MESSAGE}" +[workspace 71623a0b0] ui: show kstatus in ui + 1 file changed, 13 insertions(+) + +$ stg repair +Reading commit DAG ... done +Creating 1 new patch ... + Creating patch ui-show-kstatus-in-ui from commit 71623a0b03bcfb0b39fae3090cc1a365f2c22e76 +done +Checking patch appliedness ... + ui-show-kstatus-in-ui is now applied +done + +$ stg series ++ build-with-local-gitops-engine ++ implement-loopback ++ allow-flux-and-oci-schemes ++ ui-fix-find-leaf-pod-bug +> ui-show-kstatus-in-ui + + +... We continud with the remaining patches + +$ stg import -t ../patches-argo-cd-v2.7/06-show-custom-info.patch +Checking for changes in the working directory ... done +Importing patch "show-custom-info" ... done +Now at patch "show-custom-info" + +$ stg import -t ../patches-argo-cd-v2.7/07-ui-add-resource-icons.patch +Checking for changes in the working directory ... done +Importing patch "ui-add-resource-icons" ... done +Now at patch "ui-add-resource-icons" + +$ stg import -t ../patches-argo-cd-v2.7/08-ui-implement-health-checks-and.patch +Checking for changes in the working directory ... done +Importing patch "ui-implement-health-checks-and" ... done +Now at patch "ui-implement-health-checks-and" + +$ stg import -t ../patches-argo-cd-v2.7/09-auto-create-flux-resources.patch +Checking for changes in the working directory ... done +Importing patch "auto-create-flux-resources" ... done +Now at patch "auto-create-flux-resources" + +$ stg import -t ../patches-argo-cd-v2.7/10-add-flux-options-to-the-ui.patch +Checking for changes in the working directory ... done +Importing patch "add-flux-options-to-the-ui" ... done +Now at patch "add-flux-options-to-the-ui" + +$ stg import -t ../patches-argo-cd-v2.7/11-support-helm-oci-and.patch +Checking for changes in the working directory ... done +Importing patch "support-helm-oci-and" ... done +Now at patch "support-helm-oci-and" + +... Now it broke at patch no 12 + +$ stg import -t ../patches-argo-cd-v2.7/12-change-logo-to-flamingo.patch +Checking for changes in the working directory ... done +Importing patch "change-logo-to-flamingo" ... error: patch failed: ui/src/app/sidebar/sidebar.tsx:47 +error: ui/src/app/sidebar/sidebar.tsx: patch does not apply +stg import: Diff does not apply cleanly + + +... Let's git apply -3 + + +$ git apply -3 ../patches-argo-cd-v2.7/12-change-logo-to-flamingo.patch +Applied patch to 'ui/src/app/login/components/login.scss' cleanly. +Applied patch to 'ui/src/app/login/components/login.tsx' cleanly. +Applied patch to 'ui/src/app/sidebar/sidebar.tsx' with conflicts. +Applied patch to 'ui/src/assets/images/argo.png' cleanly. +Applied patch to 'ui/src/assets/images/argo_o.svg' cleanly. +Applied patch to 'ui/src/assets/images/argologo.svg' cleanly. +Falling back to direct application... +U ui/src/app/sidebar/sidebar.tsx + +$ git status +On branch workspace +Changes to be committed: + (use "git restore --staged ..." to unstage) + modified: ui/src/app/login/components/login.scss + modified: ui/src/app/login/components/login.tsx + modified: ui/src/assets/images/argo.png + modified: ui/src/assets/images/argo_o.svg + modified: ui/src/assets/images/argologo.svg + new file: ui/src/assets/images/flamingo.png + +Unmerged paths: + (use "git restore --staged ..." to unstage) + (use "git add ..." to mark resolution) + both modified: ui/src/app/sidebar/sidebar.tsx + +... We then fix to resolve conflicts again, then commit + +$ COMMIT_MESSAGE=$(cat ../patches-argo-cd-v2.7/12-change-logo-to-flamingo.patch | head -1) +$ git commit -s -am "${COMMIT_MESSAGE}" +[workspace b04e1fe44] change logo to flamingo + 7 files changed, 261 insertions(+), 26 deletions(-) + create mode 100644 ui/src/assets/images/flamingo.png + +$ stg repair +Reading commit DAG ... done +Creating 1 new patch ... + Creating patch change-logo-to-flamingo from commit b04e1fe44e569996319e04755593bca02bd74bdf +done +Checking patch appliedness ... + change-logo-to-flamingo is now applied +done + +$ stg import -t ../patches-argo-cd-v2.7/13-add-open-in-weave-gitops.patch +Checking for changes in the working directory ... done +Importing patch "add-open-in-weave-gitops" ... done +Now at patch "add-open-in-weave-gitops" + +$ stg import -t ../patches-argo-cd-v2.7/14-upgrade-to-flux-v2-0-0-rc-1.patch +Checking for changes in the working directory ... done +Importing patch "upgrade-to-flux-v2-0-0-rc-1" ... done +Now at patch "upgrade-to-flux-v2-0-0-rc-1" + +$ stg import -t ../patches-argo-cd-v2.7/15-fix-branch-and-rev-info-of.patch +Checking for changes in the working directory ... done +Importing patch "fix-branch-and-rev-info-of" ... done +Now at patch "fix-branch-and-rev-info-of" + +$ cd .. +$ make export-patches +``` diff --git a/patches-argo-cd-v2.7/01-build-with-local-gitops-engine.patch b/patches-argo-cd-v2.7/01-build-with-local-gitops-engine.patch index 377377c..93edd2c 100644 --- a/patches-argo-cd-v2.7/01-build-with-local-gitops-engine.patch +++ b/patches-argo-cd-v2.7/01-build-with-local-gitops-engine.patch @@ -20,10 +20,10 @@ index 869bb876f..e05fdda3e 100644 + +gitops-engine/ diff --git a/Dockerfile b/Dockerfile -index 3a434bc3b..6d69cfc51 100644 +index 1e6393773..e19d11e4b 100644 --- a/Dockerfile +++ b/Dockerfile -@@ -103,7 +103,9 @@ FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.18 AS argocd-build +@@ -105,7 +105,9 @@ FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.19.6@sha256:7ce31d15a3 WORKDIR /go/src/github.com/argoproj/argo-cd @@ -33,7 +33,7 @@ index 3a434bc3b..6d69cfc51 100644 RUN go mod download # Perform the build -@@ -117,9 +119,16 @@ RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make argocd-all +@@ -119,9 +121,16 @@ RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make argocd-all # Final image #################################################################################################### FROM argocd-base @@ -51,10 +51,10 @@ index 3a434bc3b..6d69cfc51 100644 ln -s /usr/local/bin/argocd /usr/local/bin/argocd-repo-server && \ ln -s /usr/local/bin/argocd /usr/local/bin/argocd-cmp-server && \ diff --git a/go.mod b/go.mod -index 9a3876f4f..9a26192c5 100644 +index 7bc3dc688..7f3f5ec2e 100644 --- a/go.mod +++ b/go.mod -@@ -296,4 +296,6 @@ replace ( +@@ -297,4 +297,6 @@ replace ( k8s.io/mount-utils => k8s.io/mount-utils v0.24.2 k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.24.2 k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.24.2 diff --git a/patches-argo-cd-v2.7/02-implement-loopback.patch b/patches-argo-cd-v2.7/02-implement-loopback.patch index 7c9a0b5..2430483 100644 --- a/patches-argo-cd-v2.7/02-implement-loopback.patch +++ b/patches-argo-cd-v2.7/02-implement-loopback.patch @@ -10,7 +10,7 @@ Signed-off-by: Chanwit Kaewkasi create mode 100644 controller/state_fsa.go diff --git a/controller/state.go b/controller/state.go -index 4f2a8d2f6..20cfe89a7 100644 +index 6323993e3..423bc039d 100644 --- a/controller/state.go +++ b/controller/state.go @@ -411,11 +411,17 @@ func (m *appStateManager) CompareAppState(app *v1alpha1.Application, project *ap diff --git a/patches-argo-cd-v2.7/03-allow-flux-and-oci-schemes.patch b/patches-argo-cd-v2.7/03-allow-flux-and-oci-schemes.patch index e420e82..a8b6d98 100644 --- a/patches-argo-cd-v2.7/03-allow-flux-and-oci-schemes.patch +++ b/patches-argo-cd-v2.7/03-allow-flux-and-oci-schemes.patch @@ -10,10 +10,10 @@ Signed-off-by: Chanwit Kaewkasi 3 files changed, 14 insertions(+) diff --git a/reposerver/repository/repository.go b/reposerver/repository/repository.go -index ad5a7ab2c..81b842060 100644 +index 7bf36865d..2b0d277a5 100644 --- a/reposerver/repository/repository.go +++ b/reposerver/repository/repository.go -@@ -2435,6 +2435,11 @@ func (s *Service) TestRepository(ctx context.Context, q *apiclient.TestRepositor +@@ -2437,6 +2437,11 @@ func (s *Service) TestRepository(ctx context.Context, q *apiclient.TestRepositor } check := checks[repo.Type] apiResp := &apiclient.TestRepositoryResponse{VerifiedRepository: false} @@ -26,10 +26,10 @@ index ad5a7ab2c..81b842060 100644 if err != nil { return apiResp, fmt.Errorf("error testing repository connectivity: %w", err) diff --git a/server/application/application.go b/server/application/application.go -index 1ae8412fc..8c8113e81 100644 +index 24758281a..184cfae19 100644 --- a/server/application/application.go +++ b/server/application/application.go -@@ -1857,6 +1857,10 @@ func (s *Server) resolveRevision(ctx context.Context, app *appv1.Application, sy +@@ -1929,6 +1929,10 @@ func (s *Server) resolveRevision(ctx context.Context, app *appv1.Application, sy // If it's already a commit SHA, then no need to look it up return ambiguousRevision, ambiguousRevision, nil } @@ -41,10 +41,10 @@ index 1ae8412fc..8c8113e81 100644 resolveRevisionResponse, err := repoClient.ResolveRevision(ctx, &apiclient.ResolveRevisionRequest{ diff --git a/util/argo/argo.go b/util/argo/argo.go -index e8384bcf7..388ce92c4 100644 +index a9d5a0bc9..3f203b0bf 100644 --- a/util/argo/argo.go +++ b/util/argo/argo.go -@@ -190,6 +190,11 @@ func ValidateRepo( +@@ -286,6 +286,11 @@ func ValidateRepo( conditions := make([]argoappv1.ApplicationCondition, 0) diff --git a/patches-argo-cd-v2.7/04-ui-fix-find-leaf-pod-bug.patch b/patches-argo-cd-v2.7/04-ui-fix-find-leaf-pod-bug.patch index 4bd08bb..fbe4a53 100644 --- a/patches-argo-cd-v2.7/04-ui-fix-find-leaf-pod-bug.patch +++ b/patches-argo-cd-v2.7/04-ui-fix-find-leaf-pod-bug.patch @@ -9,10 +9,10 @@ Signed-off-by: Chanwit Kaewkasi 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ui/src/app/applications/components/resource-details/resource-details.tsx b/ui/src/app/applications/components/resource-details/resource-details.tsx -index 90a521f3a..9b4fe4b03 100644 +index 647750937..a440f3db1 100644 --- a/ui/src/app/applications/components/resource-details/resource-details.tsx +++ b/ui/src/app/applications/components/resource-details/resource-details.tsx -@@ -276,10 +276,12 @@ export const ResourceDetails = (props: ResourceDetailsProps) => { +@@ -271,10 +271,12 @@ export const ResourceDetails = (props: ResourceDetailsProps) => { if (selectedNode.kind === 'Pod') { podState = liveState; } else { @@ -30,10 +30,10 @@ index 90a521f3a..9b4fe4b03 100644 const settings = await services.authService.settings(); diff --git a/ui/src/app/applications/components/utils.tsx b/ui/src/app/applications/components/utils.tsx -index 45c8aba56..dc5f03c65 100644 +index 7e4fed73c..c13f6eff4 100644 --- a/ui/src/app/applications/components/utils.tsx +++ b/ui/src/app/applications/components/utils.tsx -@@ -462,7 +462,8 @@ function getActionItems( +@@ -457,7 +457,8 @@ function getActionItems( }); } @@ -43,7 +43,7 @@ index 45c8aba56..dc5f03c65 100644 items.push({ title: 'Logs', iconClassName: 'fa fa-align-left', -@@ -891,6 +892,16 @@ export const OperationState = ({app, quiet}: {app: appModels.Application; quiet? +@@ -872,6 +873,16 @@ export const OperationState = ({app, quiet}: {app: appModels.Application; quiet? ); }; diff --git a/patches-argo-cd-v2.7/05-ui-show-kstatus-in-ui.patch b/patches-argo-cd-v2.7/05-ui-show-kstatus-in-ui.patch index 15615e5..18183da 100644 --- a/patches-argo-cd-v2.7/05-ui-show-kstatus-in-ui.patch +++ b/patches-argo-cd-v2.7/05-ui-show-kstatus-in-ui.patch @@ -4,26 +4,25 @@ From: Chanwit Kaewkasi Signed-off-by: Chanwit Kaewkasi --- - .../application-node-info.tsx | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) + .../application-node-info.tsx | 13 +++++++++++++ + 1 file changed, 13 insertions(+) diff --git a/ui/src/app/applications/components/application-node-info/application-node-info.tsx b/ui/src/app/applications/components/application-node-info/application-node-info.tsx -index 17b7a5d85..64058f910 100644 +index ee0e2516c..abf4c6174 100644 --- a/ui/src/app/applications/components/application-node-info/application-node-info.tsx +++ b/ui/src/app/applications/components/application-node-info/application-node-info.tsx -@@ -9,7 +9,7 @@ import * as models from '../../../shared/models'; - import {services} from '../../../shared/services'; - import {ResourceTreeNode} from '../application-resource-tree/application-resource-tree'; - import {ApplicationResourcesDiff} from '../application-resources-diff/application-resources-diff'; --import {ComparisonStatusIcon, formatCreationTimestamp, getPodStateReason, HealthStatusIcon} from '../utils'; -+import {ComparisonStatusIcon, formatCreationTimestamp, getKstatusCondition, getPodStateReason, HealthStatusIcon} from '../utils'; - - import './application-node-info.scss'; - -@@ -62,6 +62,18 @@ export const ApplicationNodeInfo = (props: { +@@ -11,6 +11,7 @@ import {ApplicationResourcesDiff} from '../application-resources-diff/applicatio + import { + ComparisonStatusIcon, + formatCreationTimestamp, ++ getKstatusCondition, + getPodReadinessGatesState, + getPodReadinessGatesState as _getPodReadinessGatesState, + getPodStateReason, +@@ -69,6 +70,18 @@ export const ApplicationNodeInfo = (props: { attributes.push({title: 'HOSTNAMES', value: hostNames}); } else if (props.node.kind === 'ReplicaSet') { - attributes.push({title: 'REPLICAS', value: `${props.live.spec?.replicas || 0}/${props.live.status?.readyReplicas || 0}/${props.live.spec?.replicas || 0}`}); + attributes.push({title: 'REPLICAS', value: `${props.live.spec?.replicas || 0}/${props.live.status?.readyReplicas || 0}/${props.live.status?.replicas || 0}`}); + } else if (props.node.kind == 'Kustomization' || + props.node.kind == "HelmRelease" || + props.node.kind == "GitRepository" || diff --git a/patches-argo-cd-v2.7/13-add-open-in-weave-gitops.patch b/patches-argo-cd-v2.7/12-add-open-in-weave-gitops.patch similarity index 94% rename from patches-argo-cd-v2.7/13-add-open-in-weave-gitops.patch rename to patches-argo-cd-v2.7/12-add-open-in-weave-gitops.patch index 24a648c..16809fb 100644 --- a/patches-argo-cd-v2.7/13-add-open-in-weave-gitops.patch +++ b/patches-argo-cd-v2.7/12-add-open-in-weave-gitops.patch @@ -8,10 +8,10 @@ Signed-off-by: Chanwit Kaewkasi 1 file changed, 45 insertions(+) diff --git a/ui/src/app/applications/components/utils.tsx b/ui/src/app/applications/components/utils.tsx -index dc5f03c65..f76f48542 100644 +index c13f6eff4..3ff4b7841 100644 --- a/ui/src/app/applications/components/utils.tsx +++ b/ui/src/app/applications/components/utils.tsx -@@ -428,6 +428,28 @@ function getResourceActionsMenuItems(resource: ResourceTreeNode, metadata: model +@@ -423,6 +423,28 @@ function getResourceActionsMenuItems(resource: ResourceTreeNode, metadata: model .catch(() => [] as MenuItem[]); } @@ -40,7 +40,7 @@ index dc5f03c65..f76f48542 100644 function getActionItems( resource: ResourceTreeNode, application: appModels.Application, -@@ -471,6 +493,29 @@ function getActionItems( +@@ -466,6 +488,29 @@ function getActionItems( }); } diff --git a/patches-argo-cd-v2.7/14-upgrade-to-flux-v2-0-0-rc-1.patch b/patches-argo-cd-v2.7/13-upgrade-to-flux-v2-0-0-rc-1.patch similarity index 100% rename from patches-argo-cd-v2.7/14-upgrade-to-flux-v2-0-0-rc-1.patch rename to patches-argo-cd-v2.7/13-upgrade-to-flux-v2-0-0-rc-1.patch diff --git a/patches-argo-cd-v2.7/15-fix-branch-and-rev-info-of.patch b/patches-argo-cd-v2.7/14-fix-branch-and-rev-info-of.patch similarity index 100% rename from patches-argo-cd-v2.7/15-fix-branch-and-rev-info-of.patch rename to patches-argo-cd-v2.7/14-fix-branch-and-rev-info-of.patch diff --git a/patches-argo-cd-v2.7/12-change-logo-to-flamingo.patch b/patches-argo-cd-v2.7/15-change-logo-to-flamingo.patch similarity index 99% rename from patches-argo-cd-v2.7/12-change-logo-to-flamingo.patch rename to patches-argo-cd-v2.7/15-change-logo-to-flamingo.patch index b086f5a..46316de 100644 --- a/patches-argo-cd-v2.7/12-change-logo-to-flamingo.patch +++ b/patches-argo-cd-v2.7/15-change-logo-to-flamingo.patch @@ -6,12 +6,12 @@ Signed-off-by: Chanwit Kaewkasi --- ui/src/app/login/components/login.scss | 2 ui/src/app/login/components/login.tsx | 4 - - ui/src/app/sidebar/sidebar.tsx | 2 + ui/src/app/sidebar/sidebar.tsx | 4 - ui/src/assets/images/argo.png | Bin ui/src/assets/images/argo_o.svg | 159 ++++++++++++++++++++++++++++---- ui/src/assets/images/argologo.svg | 118 ++++++++++++++++++++++++ ui/src/assets/images/flamingo.png | Bin - 7 files changed, 260 insertions(+), 25 deletions(-) + 7 files changed, 261 insertions(+), 26 deletions(-) create mode 100644 ui/src/assets/images/flamingo.png diff --git a/ui/src/app/login/components/login.scss b/ui/src/app/login/components/login.scss @@ -50,18 +50,25 @@ index db67ff185..75ecd6a27 100644 diff --git a/ui/src/app/sidebar/sidebar.tsx b/ui/src/app/sidebar/sidebar.tsx -index 98626900a..8c57ad0cb 100644 +index 4d0d5d6cd..c06f3d424 100644 --- a/ui/src/app/sidebar/sidebar.tsx +++ b/ui/src/app/sidebar/sidebar.tsx -@@ -47,7 +47,7 @@ export const Sidebar = (props: SidebarProps) => { - return ( -
-
-- Argo {!props.pref.hideSidebar && 'Argo CD'} -+ Flamingo {!props.pref.hideSidebar && 'Flamingo'} -
-
- {loading ? 'Loading...' : error?.state ? 'Unknown' : version?.Version || 'Unknown'} +@@ -53,13 +53,13 @@ export const Sidebar = (props: SidebarProps) => { +
+ {!props.pref.hideSidebar && ( +
+- Argo ++ Flamingo +
+ {loading ? 'Loading...' : error?.state ? 'Unknown' : version?.Version || 'Unknown'} +
+
+ )} +- Argo{' '} ++ Flamingo{' '} +
+ + {(props.navItems || []).map(item => ( diff --git a/ui/src/assets/images/argo.png b/ui/src/assets/images/argo.png index 8b21f69deee4fb0b22145e325b5487c974569887..f5f17dc5d61fdf551a85a31cbf31d7f0832da013 100644 GIT binary patch diff --git a/patches-argo-cd-v2.7/series b/patches-argo-cd-v2.7/series index 6ab9e26..c5d3df8 100644 --- a/patches-argo-cd-v2.7/series +++ b/patches-argo-cd-v2.7/series @@ -1,4 +1,4 @@ -# This series applies on GIT commit 5bcd846fa16e4b19d8f477de7da50ec0aef320e5 +# This series applies on GIT commit cbee7e6011407ed2d1066c482db74e97e0cc6bdb 01-build-with-local-gitops-engine.patch 02-implement-loopback.patch 03-allow-flux-and-oci-schemes.patch @@ -10,7 +10,7 @@ 09-auto-create-flux-resources.patch 10-add-flux-options-to-the-ui.patch 11-support-helm-oci-and.patch -12-change-logo-to-flamingo.patch -13-add-open-in-weave-gitops.patch -14-upgrade-to-flux-v2-0-0-rc-1.patch -15-fix-branch-and-rev-info-of.patch +12-add-open-in-weave-gitops.patch +13-upgrade-to-flux-v2-0-0-rc-1.patch +14-fix-branch-and-rev-info-of.patch +15-change-logo-to-flamingo.patch