Skip to content

Commit 82389a7

Browse files
oleksandr-codefreshreggie-knitishfy
authored andcommitted
chore: sync all codefresh code changes into v3.0.2 (#397)
* chore: sync all codefresh code changes into v3.0.2 without event-reporter related changes Signed-off-by: oleksandr-codefresh <[email protected]> * removed cf script Signed-off-by: oleksandr-codefresh <[email protected]> * upgraded git-lfs to 3.6.1 in Dockerfile (#386) Signed-off-by: reggie-k <[email protected]> Signed-off-by: oleksandr-codefresh <[email protected]> * fixed webstorm go.mod issue Signed-off-by: oleksandr-codefresh <[email protected]> * e2e: improved error logs Signed-off-by: oleksandr-codefresh <[email protected]> * fixed changes on generated files Signed-off-by: oleksandr-codefresh <[email protected]> * chore: replace heptio-images with argocd-e2e-container (argoproj#23040) Signed-off-by: nitishfy <[email protected]> Signed-off-by: Nitish Kumar <[email protected]> (cherry picked from commit 309acd1) Signed-off-by: oleksandr-codefresh <[email protected]> * feat: upgraded github.com/expr-lang/expr from 0.16.9 to 0.17.0 Signed-off-by: oleksandr-codefresh <[email protected]> * e2e [TestTrackAppStateAndSyncApp / TestNewStyleResourceActionMixedOk / TestNewStyleResourceActionPermitted / TestNamespacedPermissions]: added wait for sync operation Signed-off-by: oleksandr-codefresh <[email protected]> --------- Signed-off-by: oleksandr-codefresh <[email protected]> Signed-off-by: reggie-k <[email protected]> Co-authored-by: Regina Voloshin <[email protected]> Co-authored-by: Nitish Kumar <[email protected]> # Conflicts: # .github/workflows/ci-build.yaml # cmd/argocd/commands/app_test.go # go.mod # go.sum # manifests/base/kustomization.yaml # manifests/core-install-with-hydrator.yaml # manifests/core-install.yaml # manifests/core-install/kustomization.yaml # manifests/ha/base/kustomization.yaml # manifests/ha/install-with-hydrator.yaml # manifests/ha/install.yaml # manifests/ha/namespace-install-with-hydrator.yaml # manifests/ha/namespace-install.yaml # manifests/install-with-hydrator.yaml # manifests/install.yaml # manifests/namespace-install-with-hydrator.yaml # manifests/namespace-install.yaml # pkg/apiclient/application/application.pb.go # pkg/apiclient/application/application.pb.gw.go # pkg/apis/application/v1alpha1/generated.pb.go # reposerver/apiclient/mocks/RepoServerServiceClient.go # reposerver/apiclient/repository.pb.go # server/application/application.proto # util/git/mocks/Client.go
1 parent cfeed49 commit 82389a7

File tree

89 files changed

+7847
-2410
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+7847
-2410
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ manifests/
1717
hack/
1818
docs/
1919
examples/
20+
.dockerignore
21+
.git/
2022
.github/
2123
!test/container
2224
!test/e2e/testdata

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ contact_links:
55
url: https://argo-cd.readthedocs.io/
66
about: Much help can be found in the docs
77
- name: Ask a question
8-
url: https://github.com/argoproj/argo-cd/discussions/new
8+
url: https://github.com/codefresh-io/argo-cd/discussions/new
99
about: Ask a question or start a discussion about Argo CD
1010
- name: Chat on Slack
1111
url: https://argoproj.github.io/community/join-slack

.github/workflows/ci-build.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ name: Integration tests
22
on:
33
push:
44
branches:
5-
- 'master'
6-
- 'release-*'
7-
- '!release-1.4'
8-
- '!release-1.5'
5+
- 'sync-*'
6+
# - 'master'
7+
# - 'release-*'
8+
# - '!release-1.4'
9+
# - '!release-1.5'
910
pull_request:
1011
branches:
11-
- 'master'
12-
- 'release-*'
12+
- 'sync-*'
13+
# - 'master'
14+
# - 'release-*'
1315

1416
env:
1517
# Golang version to use across CI steps
@@ -392,7 +394,7 @@ jobs:
392394
env:
393395
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
394396
- name: Upload test results to Codecov
395-
if: github.ref == 'refs/heads/master' && github.event_name == 'push' && github.repository == 'argoproj/argo-cd'
397+
if: startsWith(github.ref, 'refs/heads/sync-') && github.event_name == 'push' && github.repository == 'codefresh-io/argo-cd'
396398
uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1
397399
with:
398400
file: test-results/junit.xml
@@ -403,7 +405,7 @@ jobs:
403405
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
404406
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
405407
uses: SonarSource/sonarqube-scan-action@2500896589ef8f7247069a56136f8dc177c27ccf # v5.2.0
406-
if: env.sonar_secret != ''
408+
if: false && env.sonar_secret != ''
407409
test-e2e:
408410
name: Run end-to-end tests
409411
if: ${{ needs.changes.outputs.backend == 'true' }}

.github/workflows/image.yaml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: Image
33
on:
44
push:
55
branches:
6-
- master
6+
- sync-*
77
pull_request:
88
branches:
9-
- master
9+
- sync-*
1010
types: [labeled, unlabeled, opened, synchronize, reopened]
1111

1212
concurrency:
@@ -19,17 +19,25 @@ jobs:
1919
set-vars:
2020
permissions:
2121
contents: read
22-
if: github.repository == 'argoproj/argo-cd'
22+
if: github.repository == 'codefresh-io/argo-cd'
2323
runs-on: ubuntu-22.04
2424
outputs:
25-
image-tag: ${{ steps.image.outputs.tag}}
25+
image-tag: ${{ steps.image-pr.outputs.tag || steps.image-push.outputs.tag }}
2626
platforms: ${{ steps.platforms.outputs.platforms }}
2727
steps:
2828
- uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 # v4.0.0
2929

30-
- name: Set image tag for ghcr
31-
run: echo "tag=$(cat ./VERSION)-${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
32-
id: image
30+
- name: Set image tag (push to feature branch)
31+
if: ${{ github.repository == 'codefresh-io/argo-cd' && github.event_name == 'pull_request' }}
32+
run: |
33+
CLEAN_REF=$(echo "${{ github.head_ref }}" | sed 's|^refs/[^/]*||; s|/|_|g')
34+
echo "tag=v$(cat ./VERSION)-${CLEAN_REF}-${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
35+
id: image-pr
36+
37+
- name: Set image tag (push to sync-* branch)
38+
if: ${{ github.repository == 'codefresh-io/argo-cd' && github.event_name == 'push' }}
39+
run: echo "tag=v$(cat ./VERSION)-$(date +%Y-%m-%d)-${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
40+
id: image-push
3341

3442
- name: Determine image platforms to use
3543
id: platforms
@@ -48,7 +56,7 @@ jobs:
4856
contents: read
4957
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
5058
id-token: write # for creating OIDC tokens for signing.
51-
if: ${{ github.repository == 'argoproj/argo-cd' && github.event_name != 'push' }}
59+
if: ${{ false }}
5260
uses: ./.github/workflows/image-reuse.yaml
5361
with:
5462
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
@@ -63,11 +71,11 @@ jobs:
6371
contents: read
6472
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
6573
id-token: write # for creating OIDC tokens for signing.
66-
if: ${{ github.repository == 'argoproj/argo-cd' && github.event_name == 'push' }}
74+
if: ${{ github.repository == 'codefresh-io/argo-cd' }}
6775
uses: ./.github/workflows/image-reuse.yaml
6876
with:
69-
quay_image_name: quay.io/argoproj/argocd:latest
70-
ghcr_image_name: ghcr.io/argoproj/argo-cd/argocd:${{ needs.set-vars.outputs.image-tag }}
77+
quay_image_name: ${{ github.event_name == 'pull_request' && 'quay.io/codefresh/dev/argocd' || 'quay.io/codefresh/argocd' }}:${{ needs.set-vars.outputs.image-tag }}
78+
# ghcr_image_name: ghcr.io/codefresh-io/argo-cd/argocd:${{ needs.set-vars.outputs.image-tag }}
7179
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
7280
# renovate: datasource=golang-version packageName=golang
7381
go-version: 1.24.6
@@ -86,7 +94,7 @@ jobs:
8694
actions: read # for detecting the Github Actions environment.
8795
id-token: write # for creating OIDC tokens for signing.
8896
packages: write # for uploading attestations. (https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#known-issues)
89-
if: ${{ github.repository == 'argoproj/argo-cd' && github.event_name == 'push' }}
97+
if: ${{ false }}
9098
# Must be refernced by a tag. https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#referencing-the-slsa-generator
9199
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
92100
with:
@@ -103,7 +111,7 @@ jobs:
103111
permissions:
104112
contents: write # for git to push upgrade commit if not already deployed
105113
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
106-
if: ${{ github.repository == 'argoproj/argo-cd' && github.event_name == 'push' }}
114+
if: ${{ false }}
107115
runs-on: ubuntu-22.04
108116
steps:
109117
- uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 # v4.0.0

.mockery.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ template-data:
77
unroll-variadic: true
88

99
packages:
10+
github.com/argoproj/argo-cd/v3/acr_controller/application:
11+
interfaces:
12+
ApplicationClient:
1013
github.com/argoproj/argo-cd/v3/applicationset/generators:
1114
interfaces:
1215
Generator: {}

Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,18 @@ USER root
4343
ENV ARGOCD_USER_ID=999 \
4444
DEBIAN_FRONTEND=noninteractive
4545

46-
RUN groupadd -g $ARGOCD_USER_ID argocd && \
46+
RUN apt-get update && \
47+
apt-get install curl -y && \
48+
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
49+
apt-get install git-lfs -y && \
50+
groupadd -g $ARGOCD_USER_ID argocd && \
4751
useradd -r -u $ARGOCD_USER_ID -g argocd argocd && \
4852
mkdir -p /home/argocd && \
4953
chown argocd:0 /home/argocd && \
5054
chmod g=u /home/argocd && \
51-
apt-get update && \
5255
apt-get dist-upgrade -y && \
5356
apt-get install -y \
54-
git git-lfs tini gpg tzdata connect-proxy && \
57+
git tini gpg tzdata connect-proxy && \
5558
apt-get clean && \
5659
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
5760

@@ -138,6 +141,7 @@ COPY --from=argocd-build /go/src/github.com/argoproj/argo-cd/dist/argocd* /usr/l
138141
USER root
139142
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-server && \
140143
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-repo-server && \
144+
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-application-change-revision-controller && \
141145
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-cmp-server && \
142146
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-application-controller && \
143147
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-dex && \

Dockerfile.dev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ COPY argocd /usr/local/bin/
77
USER root
88
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-server && \
99
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-repo-server && \
10+
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-application-change-revision-controller && \
1011
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-application-controller && \
1112
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-dex && \
1213
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-notifications && \

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ define run-in-test-client
134134
-e GITHUB_TOKEN \
135135
-e GOCACHE=/tmp/go-build-cache \
136136
-e ARGOCD_LINT_GOGC=$(ARGOCD_LINT_GOGC) \
137+
-e GOSUMDB=off \
137138
-v ${DOCKER_SRC_MOUNT} \
138139
-v ${GOPATH}/pkg/mod:/go/pkg/mod${VOLUME_MOUNT} \
139140
-v ${GOCACHE}:/tmp/go-build-cache${VOLUME_MOUNT} \
@@ -154,7 +155,7 @@ PATH:=$(PATH):$(PWD)/hack
154155

155156
# docker image publishing options
156157
DOCKER_PUSH?=false
157-
IMAGE_NAMESPACE?=
158+
IMAGE_NAMESPACE?=quay.io/codefresh
158159
# perform static compilation
159160
DEFAULT_STATIC_BUILD:=true
160161
ifeq ($(IS_DARWIN),true)

Merge-upstream.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
## Process of merging upstream changes
2+
3+
1. create "sync-3.0.2" branch on top of upstream v3.0.2 tag (git checkout -b sync-3.0.2 v3.0.2), push to codefresh-io/argocd
4+
2. create branch "make-cf-changes" on current release (sync-2.14.9 HEAD)
5+
3. rebase onto sync-3.0.2 ("git rebase --onto sync-3.0.2 v2.14.9 make-cf-changes)
6+
4. make a pr from "make-cf-changes" into "sync-3.0.2".
7+
1. the pr will trigger dev image builds, e2e runs, etc (quay.io/codefresh/dev/argocd)
8+
5. fix conflicts, test, fixes, whatever (by instuction in following section)
9+
6. merge pr
10+
1. merge will create official image of fork (quay.io/codefresh/argocd)
11+
2. manually create tag "v3.0.2-YYYY-MM-DD-SHA"
12+
3. THERE IS NOT GITHUB RELEASE
13+
14+
## Resolving conflicts during upstream changes merge
15+
16+
This docs include info about places where codefresh made it's customizations:
17+
18+
#### General notes:
19+
1. All files that're deleted in our branches - we can keep deleted (accept ours).
20+
2. all `xxx.pb.go` - apply theirs and after resolving conflicts re-generate.
21+
22+
#### Paths and actions on them
23+
1. `.github/workflows` - accept ours (yours).
24+
2. `applicationset` - accept theirs
25+
3. `assets / swagger` - accept ours. Later run codegen and commit new version
26+
4. `cmd / argocd` - accept ours if files deleted.
27+
5. `cmd / argocd-application-controller` - no custom thing from our side, so just resolve conflicts.
28+
6. `cmd / notifications` - no custom thing from our side, so just accept theirs.
29+
7. `cmd / argocd-repo-server` - includes our changes with codefresh related parameters.
30+
8. `cmd / common` - includes our changes with codefresh related constants (event-reporter)
31+
9. `cmd / controller / application.go` - includes our changes to resource node (to return labels and annotations getResourceTree method)
32+
10. `cmd / controller / state.go` - includes our changes (GetRepoObjs method)
33+
11. `cmd / controller / state_test.go - includes our changes. Replace manifest values with our struct `apiclient.Manifest`
34+
12. `docs` - apply theirs
35+
13. `examples` - apply theirs
36+
14. `hack` - apply theirs
37+
15. `manifests` - accept theirs
38+
16. `notification_controller` - apply theirs
39+
17. `pkg/apis/application/v1alpha` - generatedXXX - apply theirs (than re-generate). types.go - merge (includes our changes with ForceNamespace).
40+
18. `server / application.go` - merge (includes our v1 event-reporter.)
41+
19. `ui` - accept theirs.
42+
20. `util / kustomize` - merge, as it includes ours changes.
43+
21. `mkdocs.yaml` - apply theirs.
44+
22. `go.mod` - merge direct dependencies. go.sum accept theirs. Run go mod tidy. Check `replace` section, perform cleanup if needed.
45+
23. `reposerver / sepository.go` - merge, includes: cf appVersion logic; type manifest struct (with path to file, rawManifest);
46+
47+
48+
#### Post actions:
49+
1. run `go mod tidy`
50+
2. run `go mod download`
51+
3. run `go mod vendor`
52+
4. run `make install-tools-local`
53+
5. run `make lint-local`
54+
6. run `make protogen-fast` - because sometimes gogen won't work if types from protogen used
55+
7. run `make codegen`
56+
8. run `make test-local`
57+
58+
### Thoughts
59+
60+
1. Revert cherry picks before merges - as they cause issues later if in upstream decided to slightly move some parts of such changes. In this case no conflicts will occur during merge as they on different lines but then you need cleanup them manually.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
package application_change_revision_controller
2+
3+
import (
4+
"context"
5+
"crypto/tls"
6+
"encoding/json"
7+
"fmt"
8+
"io"
9+
"net/http"
10+
"strings"
11+
"time"
12+
13+
"google.golang.org/grpc"
14+
15+
appclient "github.com/argoproj/argo-cd/v3/pkg/apiclient/application"
16+
)
17+
18+
type ApplicationClient interface {
19+
GetChangeRevision(ctx context.Context, in *appclient.ChangeRevisionRequest, opts ...grpc.CallOption) (*appclient.ChangeRevisionResponse, error)
20+
}
21+
22+
type httpApplicationClient struct {
23+
httpClient *http.Client
24+
baseURL string
25+
token string
26+
rootpath string
27+
}
28+
29+
func NewHTTPApplicationClient(token string, address string, rootpath string) ApplicationClient {
30+
if rootpath != "" && !strings.HasPrefix(rootpath, "/") {
31+
rootpath = "/" + rootpath
32+
}
33+
34+
if !strings.Contains(address, "http") {
35+
address = "http://" + address
36+
}
37+
38+
if rootpath != "" {
39+
address = address + rootpath
40+
}
41+
42+
return &httpApplicationClient{
43+
httpClient: &http.Client{
44+
Timeout: 30 * time.Second,
45+
Transport: &http.Transport{
46+
// Support for insecure connections
47+
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
48+
},
49+
},
50+
baseURL: address,
51+
token: token,
52+
rootpath: rootpath,
53+
}
54+
}
55+
56+
func (c *httpApplicationClient) execute(ctx context.Context, url string, result any) error {
57+
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
58+
if err != nil {
59+
return err
60+
}
61+
62+
req.Header.Set("Content-Type", "application/json")
63+
req.Header.Set("Authorization", "Bearer "+c.token)
64+
65+
res, err := c.httpClient.Do(req)
66+
if err != nil {
67+
return err
68+
}
69+
defer res.Body.Close()
70+
71+
b, _ := io.ReadAll(res.Body)
72+
73+
isStatusOK := res.StatusCode >= 200 && res.StatusCode < 300
74+
if !isStatusOK {
75+
return fmt.Errorf("argocd server respond with code %d, msg is: %s", res.StatusCode, string(b))
76+
}
77+
78+
err = json.Unmarshal(b, &result)
79+
if err != nil {
80+
return err
81+
}
82+
return nil
83+
}
84+
85+
func (c *httpApplicationClient) GetChangeRevision(ctx context.Context, in *appclient.ChangeRevisionRequest, _ ...grpc.CallOption) (*appclient.ChangeRevisionResponse, error) {
86+
params := fmt.Sprintf("?appName=%s&namespace=%s&currentRevision=%s&previousRevision=%s", in.GetAppName(), in.GetNamespace(), in.GetCurrentRevision(), in.GetPreviousRevision())
87+
88+
url := fmt.Sprintf("%s/api/v1/application/changeRevision%s", c.baseURL, params)
89+
90+
changeRevisionResponse := &appclient.ChangeRevisionResponse{}
91+
err := c.execute(ctx, url, changeRevisionResponse)
92+
if err != nil {
93+
return nil, err
94+
}
95+
return changeRevisionResponse, nil
96+
}

0 commit comments

Comments
 (0)