Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
48773e8
codefresh changes
ATGardner Mar 27, 2025
c3739bf
reverted all changes done from upstream
ATGardner Apr 15, 2025
5be9aca
ci-build: comment out unnedeed stuff
zarbis Apr 15, 2025
4187e76
image: replace with CF variant
zarbis Apr 15, 2025
673908d
fixed lint errors
ATGardner Apr 16, 2025
d8ae531
fix: update branch condition for image tag assignment
ATGardner Apr 16, 2025
f4956b7
image: push to quay same tag as in ghcr
zarbis Apr 16, 2025
41bdd1b
image: remove deploy step
zarbis Apr 16, 2025
b82adf4
ci-build: uncomment e2e
zarbis Apr 16, 2025
ec3d9e3
image: try upstream version of workflow
zarbis Apr 16, 2025
7e984fe
image: try upstream version of workflow
zarbis Apr 16, 2025
61bdc00
fixed merge bug (that caused an e2e failure)
ATGardner Apr 16, 2025
98268e1
image: try upstream version of workflow
zarbis Apr 16, 2025
d71447f
feat: refactor manifest generation to use CfOptions struct
ATGardner Apr 17, 2025
008e626
removed cf-specific `ForceNamespace`
ATGardner Apr 17, 2025
16387c4
switched default `SetNamespace` value to `false`
ATGardner Apr 17, 2025
0c65771
ran codegen
ATGardner Apr 17, 2025
b35f04f
a shot in the dark
ATGardner Apr 17, 2025
a17d293
fix: update image tag generation and repository references in workflows
ATGardner Apr 17, 2025
6781bab
fix: prepend 'v' to image tag in workflows for consistency
ATGardner Apr 17, 2025
8f0f033
changed triggers
ATGardner Apr 18, 2025
38f5b11
Revert "a shot in the dark"
ATGardner Apr 18, 2025
1e7ff9b
fix: update image tag generation logic to always use VERSION file
ATGardner Apr 18, 2025
f04a895
fix: improve image tag generation by cleaning reference names
ATGardner Apr 18, 2025
d7b1218
bump
ATGardner Apr 18, 2025
c80a38d
fixed image tag name
ATGardner Apr 18, 2025
c678996
fix: clean reference names in image tag generation for consistency
ATGardner Apr 18, 2025
953d865
returned conditions, changed them to codefresh-io/argo-cd
ATGardner Apr 18, 2025
20db28a
reverted release.yaml to upstream - we are not using it at all
ATGardner Apr 18, 2025
05f74da
have the image.yaml correctly handle both push to sync-* branch, and …
ATGardner Apr 18, 2025
9d5cb2a
fix: remove quotes from sync-* branch pattern in image.yaml
ATGardner Apr 18, 2025
a9c17ac
turn on integration tests to both push and pr
ATGardner Apr 18, 2025
19d6264
fix: clean up conditional formatting in Codecov upload step
ATGardner Apr 18, 2025
e3ebda2
fix: adjust formatting in image.yaml for consistency
ATGardner Apr 18, 2025
2a630d4
testing
ATGardner Apr 18, 2025
e1ae5bf
test complex syntax
ATGardner Apr 18, 2025
c9f518b
fix: correct quay_image_name formatting in image.yaml for pull requests
ATGardner Apr 18, 2025
6146da9
another attempt
ATGardner Apr 18, 2025
504ed8b
isolating problem
ATGardner Apr 18, 2025
b311e73
fixed missing required permission and wrong condition
ATGardner Apr 18, 2025
f41ae9b
remove some white space changes
ATGardner Apr 18, 2025
9c0a6a6
removed test pipeline
ATGardner Apr 18, 2025
46371b6
removed obsolete codefresh pipelines (not used anymore)
ATGardner Apr 18, 2025
9e3bc9d
test: add delay before syncing app to avoid sync window blockage
ATGardner Apr 20, 2025
0c8ec10
test: add delay before syncing app to prevent race condition
ATGardner Apr 20, 2025
9336572
fix: update conditions for Codecov and SonarQube actions in CI workflow
ATGardner Apr 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ manifests/
hack/
docs/
examples/
.dockerignore
.git/
.github/
!test/container
!test/e2e/testdata
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ contact_links:
url: https://argo-cd.readthedocs.io/
about: Much help can be found in the docs
- name: Ask a question
url: https://github.com/argoproj/argo-cd/discussions/new
url: https://github.com/codefresh-io/argo-cd/discussions/new
about: Ask a question or start a discussion about Argo CD
- name: Chat on Slack
url: https://argoproj.github.io/community/join-slack
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ name: Integration tests
on:
push:
branches:
- 'master'
- 'release-*'
- '!release-1.4'
- '!release-1.5'
- 'sync-*'
# - 'master'
# - 'release-*'
# - '!release-1.4'
# - '!release-1.5'
pull_request:
branches:
- 'master'
- 'release-*'
- 'sync-*'
# - 'master'
# - 'release-*'

env:
# Golang version to use across CI steps
Expand Down Expand Up @@ -383,7 +385,7 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: github.ref == 'refs/heads/master' && github.event_name == 'push' && github.repository == 'argoproj/argo-cd'
if: startsWith(github.ref, 'refs/heads/sync-') && github.event_name == 'push' && github.repository == 'codefresh-io/argo-cd'
uses: codecov/test-results-action@9739113ad922ea0a9abb4b2c0f8bf6a4aa8ef820 # v1.0.1
with:
file: test-results/junit.xml
Expand All @@ -394,7 +396,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
uses: SonarSource/sonarqube-scan-action@bfd4e558cda28cda6b5defafb9232d191be8c203 # v4.2.1
if: env.sonar_secret != ''
if: false && env.sonar_secret != ''
test-e2e:
name: Run end-to-end tests
if: ${{ needs.changes.outputs.backend == 'true' }}
Expand Down
34 changes: 21 additions & 13 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Image
on:
push:
branches:
- master
- sync-*
pull_request:
branches:
- master
- sync-*
types: [ labeled, unlabeled, opened, synchronize, reopened ]

concurrency:
Expand All @@ -19,17 +19,25 @@ jobs:
set-vars:
permissions:
contents: read
if: github.repository == 'argoproj/argo-cd'
if: github.repository == 'codefresh-io/argo-cd'
runs-on: ubuntu-22.04
outputs:
image-tag: ${{ steps.image.outputs.tag}}
image-tag: ${{ steps.image-pr.outputs.tag || steps.image-push.outputs.tag }}
platforms: ${{ steps.platforms.outputs.platforms }}
steps:
- uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 # v4.0.0

- name: Set image tag for ghcr
run: echo "tag=$(cat ./VERSION)-${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
id: image
- name: Set image tag (push to feature branch)
if: ${{ github.repository == 'codefresh-io/argo-cd' && github.event_name == 'pull_request' }}
run: |
CLEAN_REF=$(echo "${{ github.head_ref }}" | sed 's|^refs/[^/]*||; s|/|_|g')
echo "tag=v$(cat ./VERSION)-${CLEAN_REF}-${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
id: image-pr

- name: Set image tag (push to sync-* branch)
if: ${{ github.repository == 'codefresh-io/argo-cd' && github.event_name == 'push' }}
run: echo "tag=v$(cat ./VERSION)-$(date +%Y-%m-%d)-${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
id: image-push

- name: Determine image platforms to use
id: platforms
Expand All @@ -48,7 +56,7 @@ jobs:
contents: read
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
id-token: write # for creating OIDC tokens for signing.
if: ${{ github.repository == 'argoproj/argo-cd' && github.event_name != 'push' }}
if: ${{ false }}
uses: ./.github/workflows/image-reuse.yaml
with:
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
Expand All @@ -63,11 +71,11 @@ jobs:
contents: read
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
id-token: write # for creating OIDC tokens for signing.
if: ${{ github.repository == 'argoproj/argo-cd' && github.event_name == 'push' }}
if: ${{ github.repository == 'codefresh-io/argo-cd' }}
uses: ./.github/workflows/image-reuse.yaml
with:
quay_image_name: quay.io/argoproj/argocd:latest
ghcr_image_name: ghcr.io/argoproj/argo-cd/argocd:${{ needs.set-vars.outputs.image-tag }}
quay_image_name: ${{ github.event_name == 'pull_request' && 'quay.io/codefresh/dev/argocd' || 'quay.io/codefresh/argocd' }}:${{ needs.set-vars.outputs.image-tag }}
# ghcr_image_name: ghcr.io/codefresh-io/argo-cd/argocd:${{ needs.set-vars.outputs.image-tag }}
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
# renovate: datasource=golang-version packageName=golang
go-version: 1.23.3
Expand All @@ -86,7 +94,7 @@ jobs:
actions: read # for detecting the Github Actions environment.
id-token: write # for creating OIDC tokens for signing.
packages: write # for uploading attestations. (https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#known-issues)
if: ${{ github.repository == 'argoproj/argo-cd' && github.event_name == 'push' }}
if: ${{ false }}
# 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
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.0.0
with:
Expand All @@ -103,7 +111,7 @@ jobs:
permissions:
contents: write # for git to push upgrade commit if not already deployed
packages: write # for pushing packages to GHCR, which is used by cd.apps.argoproj.io to avoid polluting Quay with tags
if: ${{ github.repository == 'argoproj/argo-cd' && github.event_name == 'push' }}
if: ${{ false }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 # v4.0.0
Expand Down
6 changes: 6 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ mockname: "{{.InterfaceName}}"
with-expecter: false
# individual interface config
packages:
github.com/argoproj/argo-cd/v2/acr_controller/application:
interfaces:
ApplicationClient:
github.com/argoproj/argo-cd/v2/applicationset/generators:
interfaces:
Generator:
Expand Down Expand Up @@ -36,6 +39,9 @@ packages:
github.com/argoproj/argo-cd/v2/controller/cache:
interfaces:
LiveStateCache:
github.com/argoproj/argo-cd/v2/event_reporter/application:
interfaces:
ApplicationClient:
github.com/argoproj/argo-cd/v2/reposerver/apiclient:
interfaces:
RepoServerServiceClient:
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ COPY --from=argocd-build /go/src/github.com/argoproj/argo-cd/dist/argocd* /usr/l
USER root
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-server && \
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-repo-server && \
ln -s /usr/local/bin/argocd /usr/local/bin/event-reporter-server && \
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-application-change-revision-controller && \
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-cmp-server && \
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-application-controller && \
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-dex && \
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ COPY argocd /usr/local/bin/
USER root
RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-server && \
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-repo-server && \
ln -s /usr/local/bin/argocd /usr/local/bin/event-reporter-server && \
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-application-change-revision-controller && \
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-application-controller && \
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-dex && \
ln -s /usr/local/bin/argocd /usr/local/bin/argocd-notifications && \
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ define run-in-test-client
-e GITHUB_TOKEN \
-e GOCACHE=/tmp/go-build-cache \
-e ARGOCD_LINT_GOGC=$(ARGOCD_LINT_GOGC) \
-e GOSUMDB=off \
-v ${DOCKER_SRC_MOUNT} \
-v ${GOPATH}/pkg/mod:/go/pkg/mod${VOLUME_MOUNT} \
-v ${GOCACHE}:/tmp/go-build-cache${VOLUME_MOUNT} \
Expand All @@ -145,7 +146,7 @@ PATH:=$(PATH):$(PWD)/hack

# docker image publishing options
DOCKER_PUSH?=false
IMAGE_NAMESPACE?=
IMAGE_NAMESPACE?=quay.io/codefresh
# perform static compilation
STATIC_BUILD?=true
# build development images
Expand Down Expand Up @@ -532,6 +533,9 @@ start-local: mod-vendor-local dep-ui-local cli-local
run:
bash ./hack/goreman-start.sh

.PHONY: cf-release
cf-release:
go run ./hack/release

# Runs pre-commit validation with the virtualized toolchain
.PHONY: pre-commit
Expand Down
46 changes: 46 additions & 0 deletions Merge-upstream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## Resolving conflicts during upstream changes merge

This docs include info about places where codefresh made it's customizations:

#### General notes:
1. All files that're deleted in our branches - we can keep deleted (accept ours).
2. all `xxx.pb.go` - apply theirs and after resolving conflicts re-generate.

#### Paths and actions on them
1. `.github/workflows` - accept ours (yours).
2. `applicationset` - accept theirs
3. `assets / swagger` - accept ours. Later run codegen and commit new version
4. `cmd / argocd` - accept ours if files deleted.
5. `cmd / argocd-application-controller` - no custom thing from our side, so just resolve conflicts.
6. `cmd / notifications` - no custom thing from our side, so just accept theirs.
7. `cmd / argocd-repo-server` - includes our changes with codefresh related parameters.
8. `cmd / common` - includes our changes with codefresh related constants (event-reporter)
9. `cmd / controller / application.go` - includes our changes to resource node (to return labels and annotations getResourceTree method)
10. `cmd / controller / state.go` - includes our changes (GetRepoObjs method)
11. `cmd / controller / state_test.go - includes our changes. Replace manifest values with our struct `apiclient.Manifest`
12. `docs` - apply theirs
13. `examples` - apply theirs
14. `hack` - apply theirs
15. `manifests` - accept theirs
16. `notification_controller` - apply theirs
17. `pkg/apis/application/v1alpha` - generatedXXX - apply theirs (than re-generate). types.go - merge (includes our changes with ForceNamespace).
18. `server / application.go` - merge (includes our v1 event-reporter.)
19. `ui` - accept theirs.
20. `util / kustomize` - merge, as it includes ours changes.
21. `mkdocs.yaml` - apply theirs.
22. `go.mod` - merge direct dependencies. go.sum accept theirs. Run go mod tidy. Check `replace` section, perform cleanup if needed.
23. `reposerver / sepository.go` - merge, includes: cf appVersion logic; type manifest struct (with path to file, rawManifest);


#### Post actions:
1. run `go mod tidy`
2. run `go mod download`
3. run `go mod vendor`
4. run `make lint-local`
5. run `make protogen-fast` - because sometimes gogen won't work if types from protogen used
6. run `make codegen`
7. run `make test-local`

### Thoughts

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.
1 change: 1 addition & 0 deletions SOURCE_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.14.8
96 changes: 96 additions & 0 deletions acr_controller/application/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package application_change_revision_controller

import (
"context"
"crypto/tls"
"encoding/json"
"fmt"
"io"
"net/http"
"strings"
"time"

"google.golang.org/grpc"

appclient "github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
)

type ApplicationClient interface {
GetChangeRevision(ctx context.Context, in *appclient.ChangeRevisionRequest, opts ...grpc.CallOption) (*appclient.ChangeRevisionResponse, error)
}

type httpApplicationClient struct {
httpClient *http.Client
baseUrl string
token string
rootpath string
}

func NewHttpApplicationClient(token string, address string, rootpath string) ApplicationClient {
if rootpath != "" && !strings.HasPrefix(rootpath, "/") {
rootpath = "/" + rootpath
}

if !strings.Contains(address, "http") {
address = "http://" + address
}

if rootpath != "" {
address = address + rootpath
}

return &httpApplicationClient{
httpClient: &http.Client{
Timeout: 30 * time.Second,
Transport: &http.Transport{
// Support for insecure connections
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
},
baseUrl: address,
token: token,
rootpath: rootpath,
}
}

func (c *httpApplicationClient) execute(ctx context.Context, url string, result interface{}) error {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
return err
}

req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+c.token)

res, err := c.httpClient.Do(req)
if err != nil {
return err
}
defer res.Body.Close()

b, _ := io.ReadAll(res.Body)

isStatusOK := res.StatusCode >= 200 && res.StatusCode < 300
if !isStatusOK {
return fmt.Errorf("argocd server respond with code %d, msg is: %s", res.StatusCode, string(b))
}

err = json.Unmarshal(b, &result)
if err != nil {
return err
}
return nil
}

func (c *httpApplicationClient) GetChangeRevision(ctx context.Context, in *appclient.ChangeRevisionRequest, opts ...grpc.CallOption) (*appclient.ChangeRevisionResponse, error) {
params := fmt.Sprintf("?appName=%s&namespace=%s&currentRevision=%s&previousRevision=%s", in.GetAppName(), in.GetNamespace(), in.GetCurrentRevision(), in.GetPreviousRevision())

url := fmt.Sprintf("%s/api/v1/application/changeRevision%s", c.baseUrl, params)

changeRevisionResponse := &appclient.ChangeRevisionResponse{}
err := c.execute(ctx, url, changeRevisionResponse)
if err != nil {
return nil, err
}
return changeRevisionResponse, nil
}
Loading
Loading