Skip to content

Commit

Permalink
[v2.7] resolve conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
  • Loading branch information
chanwit committed May 14, 2023
1 parent b9eb87a commit c25f61d
Show file tree
Hide file tree
Showing 11 changed files with 215 additions and 51 deletions.
158 changes: 158 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<press tab> | 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.
Expand All @@ -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 <file>..." to unstage)
(use "git add <file>..." 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 <file>..." 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 <file>..." to unstage)
(use "git add <file>..." 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
```
10 changes: 5 additions & 5 deletions patches-argo-cd-v2.7/01-build-with-local-gitops-engine.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion patches-argo-cd-v2.7/02-implement-loopback.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
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
Expand Down
12 changes: 6 additions & 6 deletions patches-argo-cd-v2.7/03-allow-flux-and-oci-schemes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
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}
Expand All @@ -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
}
Expand All @@ -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)

Expand Down
10 changes: 5 additions & 5 deletions patches-argo-cd-v2.7/04-ui-fix-find-leaf-pod-bug.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
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 {
Expand All @@ -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(
});
}

Expand All @@ -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?
);
};

Expand Down
27 changes: 13 additions & 14 deletions patches-argo-cd-v2.7/05-ui-show-kstatus-in-ui.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,25 @@ From: Chanwit Kaewkasi <chanwit@gmail.com>

Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
---
.../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" ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
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[]);
}

Expand Down Expand Up @@ -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(
});
}

Expand Down
Loading

0 comments on commit c25f61d

Please sign in to comment.