Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: commercetools/telefonistka
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.5
Choose a base ref
...
head repository: commercetools/telefonistka
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Apr 3, 2024

  1. Add auto-merge (#156)

    * Add AutoMerge to config
    * Update docs
    Ben10k authored Apr 3, 2024
    Copy the full SHA
    137655d View commit details
  2. Copy the full SHA
    0b0b266 View commit details
  3. reenable publishing dockerhub images (#159)

    * Revert "Disable Publishing of images to DockerHub until token issue is addressed (#158)"
    
    This reverts commit 0b0b266.
    
    * Move to personal GH org until the WayfairOSS thing is sorted out
    Oded-B authored Apr 3, 2024
    Copy the full SHA
    c19c518 View commit details
  4. Make image publish more flexible by moving image name and registery t…

    …o (#160)
    
    "repo settings"
    Oded-B authored Apr 3, 2024
    Copy the full SHA
    1508139 View commit details

Commits on Apr 5, 2024

  1. Better support publishing container images from forked repos (#161)

    Allow setting target container registry with a repo scoped variable
    Oded-B authored Apr 5, 2024
    Copy the full SHA
    ec59f1d View commit details

Commits on Apr 8, 2024

  1. Support multiple levels of nesting for promoted "components" (#164)

    Add `componentPathExtraDepth` config key.
    Add tests.
    Document new configuration key.
    Oded-B authored Apr 8, 2024
    Copy the full SHA
    8d68840 View commit details

Commits on Apr 9, 2024

  1. Add additional docker image that is based on alpine (#165)

    * Add additional alpine-release stage to Dockerfile
    Add alpine-release build to workflows
    * Add image documentation
    Ben10k authored Apr 9, 2024
    Copy the full SHA
    6a90e20 View commit details

Commits on Apr 15, 2024

  1. Add bump version using yaml (#167)

    * Add new command to bump version using yaml selector
    Ben10k authored Apr 15, 2024
    Copy the full SHA
    05a8c31 View commit details

Commits on Apr 25, 2024

  1. Argocd diff (#4)

    Optionally add ArgoCD "diff" comment on PRs
    Light refactoring of the promotion logic to allow ArgoCD functionality to re-use of generateListOfRelevantComponents
    
    ---------
    
    Co-authored-by: Hannes Gustafsson <hannes.gustafsson@commercetools.com>
    Co-authored-by: Yazdan Mohammadi <yzdannn@gmail.com>
    3 people authored Apr 25, 2024
    Copy the full SHA
    c7be471 View commit details

Commits on May 8, 2024

  1. Improve logs for ArgoCD API interaction (#5)

    Add error messages for each failure type
    Ensure any app-specific failure fails the whole "diff" action
    Oded-B authored May 8, 2024
    Copy the full SHA
    7c9c205 View commit details

Commits on May 15, 2024

  1. Add pagination to "List files in PR" api call (#174)

    * Support pagination for "List files in PR" API call
    +relevant test
    Oded-B authored May 15, 2024
    Copy the full SHA
    cc7867e View commit details
  2. Support automatically merging PRs that don't affect target clusters (#6)

    * Support automaticallyh merging PRs that don't affect target clusters
    
    * Update docs/installation.md
    
    Co-authored-by: Sunil Aggarwal <sunil.aggarwal@commercetools.com>
    Oded-B and sunchill06 authored May 15, 2024
    Copy the full SHA
    7f33a8b View commit details
  3. Update golangci/golangci-lint-action action to v6 (#170)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored May 15, 2024
    Copy the full SHA
    b7b701f View commit details
  4. Update GitHub Actions (#144)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored May 15, 2024
    Copy the full SHA
    af35f90 View commit details
  5. Update module github.com/google/go-github/v53 to v62 (#173)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored May 15, 2024
    Copy the full SHA
    38378c4 View commit details
  6. Update all non-major dependencies (#136)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored May 15, 2024
    Copy the full SHA
    1cd0beb View commit details

Commits on May 24, 2024

  1. fix(automerge): implement exponential backoff (#181)

    * fix(automerge): implement exponential backoff
    
    * Update internal/pkg/githubapi/github.go
    Ben10k authored May 24, 2024
    Copy the full SHA
    55bcc24 View commit details

Commits on Jun 5, 2024

  1. fix Telefonistka "hungs" on diff when ArgoCD application-controller i…

    …s down issue (#7)
    
    * Improve error logging
    * Move context creation and add timeout to propely handle timeouts
    Oded-B authored Jun 5, 2024
    Copy the full SHA
    ad47e29 View commit details

Commits on Jun 12, 2024

  1. Fix > 250 char Branch name issue (#188)

    * Fix > 250 char Branch name issue
    
    Move brnach name generation to a function.
    Limit original branch substing to 200 charts
    Switch target paths substring to sha1 of the target paths.
    Tests
    
    * Address isssus raised in PR reivew
    
    Rename a var
    Used Repeat to avoid hardcoding long string
    Made some test input **a bit** more realistic
    Oded-B authored Jun 12, 2024
    Copy the full SHA
    a3b2abe View commit details
  2. Upsteam merge (#10)

    * Add pagination to "List files in PR" api call (#174)
    
    * Support pagination for "List files in PR" API call
    +relevant test
    
    * Update golangci/golangci-lint-action action to v6 (#170)
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    
    * Update GitHub Actions (#144)
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    
    * Update module github.com/google/go-github/v53 to v62 (#173)
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    
    * Update all non-major dependencies (#136)
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    
    * fix(automerge): implement exponential backoff (#181)
    
    * fix(automerge): implement exponential backoff
    
    * Update internal/pkg/githubapi/github.go
    
    * Fix > 250 char Branch name issue (#188)
    
    * Fix > 250 char Branch name issue
    
    Move branch name generation to a function.
    Limit original branch substing to 200 charts
    Switch target paths substring to sha1 of the target paths.
    Tests
    
    * Address issues raised in PR review:
    
    Rename a var
    Used Repeat to avoid hardcoding long string
    Made some test input **a bit** more realistic
    
    * Cleanup some conflict marker and add comment
    
    * Fix some merge bug
    
    ---------
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    Co-authored-by: Benas Taurosevičius <benas.taurosevicius@plumery.com>
    3 people authored Jun 12, 2024
    Copy the full SHA
    0fcbba5 View commit details
  3. Fix relevant components discovery and add support for ArgoCD "native"…

    … application discovery (#8)
    
    * Use telefonistka in-pr metadata mechanism to pass changed component path
    to ArgoCD diff functionality
    
    * Add some validation to avoid auto-merging PRs in cases telefonistka is
    unsure of the component that where changed
    
    * Support two way to fetch matching ArgoCD apps from a Telefonistka
    component the telefonistka dedicated sha1 label and the ArgoCD native
    `manifest-generate-paths`  annotation
    
    * Fix relevant components discovery hannes (#9)
    
    * mocks: use go run to reduce dependency
    
    Using go run will automatically install the tool and run it if it is not
    installed already.
    
    * argocd: fix import path
    
    The import path for the mocks package is incorrect causing errors.
    
    The mocks package should be imported from internal/pkg/mocks instead of
    mocks/argocd.
    
    This also removes the aliased import and uses the package as named,
    which aligns with the directory name.
    
    ---------
    
    Co-authored-by: Hannes Gustafsson <hannes.gustafsson@commercetools.com>
    
    * Add needed argodiff.NewDiffConfigBuilder param (after version upgrade)
    
    Log time of API call with questionable performance :)
    
    * Fix typo and add code generate step to makefile
    
    * Lint fixes, fix gitignore.
    upsate go.mod
    
    * Hack go genrate for linting
    
    * Cleanup and try to use make file config
    
    * Document new configuration key
    
    * Update argocd_test.go - remove some editor completion artifacts
    
    * Fix two "bad conflict resolution"  issues
    
    * Apply suggestions from code review
    
    Co-authored-by: Yazdan Mohammadi <yzdannn@gmail.com>
    
    * I fix var name typo
    
    * Rename client var names
    
    ---------
    
    Co-authored-by: Hannes Gustafsson <hannes.gustafsson@commercetools.com>
    Co-authored-by: Yazdan Mohammadi <yzdannn@gmail.com>
    3 people authored Jun 12, 2024
    Copy the full SHA
    324e6b0 View commit details

Commits on Jun 18, 2024

  1. Document APPROVER_GITHUB_APP_ID and APPROVER_GITHUB_APP_PRIVATE_KEY_P…

    …ATH env vars (#189)
    
    * Document APPROVER_GITHUB_APP_ID and APPROVER_GITHUB_APP_PRIVATE_KEY_PATH
    env vars
    
    Co-authored-by: Hannes Gustafsson <hnnsgstfssn@gmail.com>
    Oded-B and hnnsgstfssn authored Jun 18, 2024
    Copy the full SHA
    f6f4e75 View commit details

Commits on Jun 19, 2024

  1. Add a Target Description configuration keys to provide control over p…

    …romotion PR titles (#191)
    
    * Add a Target Description configuration keys to provide control over
    promotion PR titles
    
    * Add tests for the new **optional** configuration key
    
    * Provide example for PR title in doc
    Oded-B authored Jun 19, 2024
    Copy the full SHA
    23f5b2a View commit details
  2. Allow skipping upstream TLS server certificate validation for the we…

    …bhook proxy functionality (#190)
    Oded-B authored Jun 19, 2024
    Copy the full SHA
    f819925 View commit details
  3. Sync PR 2 (#14)

    Sync Changes from upstream
    
    
    * Document APPROVER_GITHUB_APP_ID and APPROVER_GITHUB_APP_PRIVATE_KEY_PATH env vars (#189)
    * Add a Target Description configuration keys to provide control over promotion PR titles (#191)
    * Allow skipping upstream TLS server certificate validation for the webhook proxy functionality (#190)
    Oded-B authored Jun 19, 2024
    Copy the full SHA
    aa5f386 View commit details
  4. Merge branch 'main' into main

    Oded-B authored Jun 19, 2024
    Copy the full SHA
    99db0c0 View commit details
  5. Copy the full SHA
    bb49889 View commit details
  6. Sync changes from upstream project (#15)

    Another sync from upstream 🤷‍♂️
    Oded-B authored Jun 19, 2024
    Copy the full SHA
    8ca8586 View commit details
  7. Copy the full SHA
    2549abd View commit details

Commits on Jun 24, 2024

  1. Handle/mitigate crash and context issues (#11)

    * Use  new context (not a child)
    * Remove calls to a function that exits the process.
    * Add more "context"(info, like for humans) to errors
    * Address another err with no context issue
    * Respond the webhook only based on payload parsing.
    Actual Event processing is move to background thread.
    
    This require some refactoring, created ReciveWebhook and ReciveEventFile
    functions to represent the different behavior in Web Server VS CLI
    triggering while keeping to the GH stuff in the GH package
    * Cancel whole drift work  on context deadline
    * Move error function return value to the standard position
    Handle cases where GetContents returns nil HTTP response (like in Context
    cancellation)
    Oded-B authored Jun 24, 2024
    Copy the full SHA
    e2b552d View commit details

Commits on Jul 5, 2024

  1. Document mirrord usage for local testing (#17)

    * Document mirrord usage for local testing
    
    Co-authored-by: Arthur Shvarts <ashvarts@gmail.com>
    
    ---------
    
    Co-authored-by: Arthur Shvarts <ashvarts@gmail.com>
    Oded-B and ashvarts authored Jul 5, 2024
    Copy the full SHA
    82d4fc2 View commit details

Commits on Jul 12, 2024

  1. Allow setting argoCD revision to PR git Branch (#16)

    * Allow setting argoCD revision to PR git branch
    * Triggering from checkbox event was written in a generic way for future proofing
    * Document new config key
    
    
    ---------
    
    Co-authored-by: Hannes Gustafsson <hnnsgstfssn@gmail.com>
    Oded-B and hnnsgstfssn authored Jul 12, 2024
    Copy the full SHA
    2a96ff7 View commit details

Commits on Jul 22, 2024

  1. Allow selectively redacting diff content (#19)

    * Add a new component-level "disableDiff" configuration key
    * Read the configuration file before diff
    * Pass the the config the relevant function
    * Replace diff content with a relevant message
    * Document new configuration key
    
    
    Co-authored-by: Yazdan Mohammadi <yzdannn@gmail.com>
    
    ---------
    
    Co-authored-by: Yazdan Mohammadi <yzdannn@gmail.com>
    Oded-B and yzdann authored Jul 22, 2024
    Copy the full SHA
    322cad1 View commit details

Commits on Jul 24, 2024

  1. Provide Diff for new apps (#18)

    * Initial commit of "Provide Diff for new apps"
    * Delete temp app after diff
    * Nest ArgoCD configuration keys under one key.
    * Add configuration key to toggle this feature
    * Add some feature limitation to docs
    * Use prBtanch for temp app object TargetRevision
    Oded-B authored Jul 24, 2024
    Copy the full SHA
    adbd913 View commit details

Commits on Aug 6, 2024

  1. Copy the full SHA
    9ab1dd8 View commit details

Commits on Sep 3, 2024

  1. Sd 607 provide the compelete name of target cluster in promotion prs (#…

    …21)
    
    * Configure mirrord to 'steal' traffic.
    
    Stealing traffic means the Telefonistka instance running in the
    cluster will not receive the webhook, only the local instance will.
    This is so that we only see results from our local instance.
    
    * Change format of promotion path comment.
    
    The promotion path used to look like 'source/'->['path1/','path2/'].
    This PR changes it to look like:
    'source/'->
      'path1/'
      'path2/'
    
    * Remove truncation of sp in promotionPRBody
    
    * Add test for prBody
    
    * Run gofumpt
    
    * Add md extension to golden file
    
    * Addjusted prBody and matching test/goldenfile
    
    * Remove dead code
    ashvarts authored Sep 3, 2024
    Copy the full SHA
    2f5c16e View commit details

Commits on Sep 5, 2024

  1. Improve application diffs (#23)

    * Improve application diff
    
    This changes the application diff to render a YAML diff with a number of
    context lines instead of relying on the cmp library previously used
    which would render a diff of Go objects.
    
    * Allow bare URL in markdown
    
    After discussion it has been deemed unnecessary to enforce non-bare URLs
    in markdown.
    
    * Upgrade golangci-lint
    
    The earlier version fails to run on Darwin with Go 1.23.
    hnnsgstfssn authored Sep 5, 2024
    Copy the full SHA
    4a14b34 View commit details

Commits on Sep 9, 2024

  1. Fix flaky test (#24)

    This PR resolves intermittent test suite execution failures that are caused by
    the TestAggregatePromotionPlan test [1].
    
    JIRA Issue [2].
    
    The function signature for generatePromotionPlanTestHelper [3] has been modified to
    support a variadic expected promotions parameter.
    
    [1] https://github.com/commercetools/telefonistka/blob/bug/SD-732/internal/pkg/githubapi/promotion_test.go#L174
    [2] https://commercetools.atlassian.net/jira/software/c/projects/SD/issues/SD-732?jql=project%20%3D%20%22SD%22%20ORDER%20BY%20created%20DESC
    [3] https://github.com/commercetools/telefonistka/blob/bug/SD-732/internal/pkg/githubapi/promotion_test.go#L52
    jared-logan-patrick-ct authored Sep 9, 2024
    Copy the full SHA
    d4cf1aa View commit details
  2. Help user to debug the diff error with temporary applications (#26)

    * Keep the application if there is a diff error
    
    * Update the template
    yzdann authored Sep 9, 2024
    Copy the full SHA
    bbe49ea View commit details

Commits on Sep 12, 2024

  1. Split too big comment per cluster (#22)

    * Split too big comment per cluster
    
    If a "regular" aggregate diff can't fit in a GH comment create one
    comment per cluster.
    There's still a fallback to concise diff (just lists changed objects)
    for extreme cases
    
    * Move logging out of executeTemplate to higher up the stack
    Create a new "testable"  generateArgoCdDiffComments function to generate
    all the comments content
    
    Comment all the comments
    
    * Add test for 3 "levels" of comments
    
    * Apply suggestions from code review
    
    Co-authored-by: Hannes Gustafsson <hnnsgstfssn@gmail.com>
    Oded-B and hnnsgstfssn authored Sep 12, 2024
    Copy the full SHA
    d60f34e View commit details

Commits on Oct 17, 2024

  1. Copy the full SHA
    a8a51a9 View commit details

Commits on Oct 18, 2024

  1. Sd 766 telefonistka get nil pointer dereference when it tries to diff…

    … a new application (#27)
    
    * add nil condition to found app to prevent nil references
    
    * add templates path to generate argo cd diff comments test
    
    * add nolint
    
    * separate error and nil conditions for clarity
    
    * add a unit test to verify the nil return value
    
    * update test for clarity
    jared-logan-patrick-ct authored Oct 18, 2024
    Copy the full SHA
    caaf793 View commit details

Commits on Oct 23, 2024

  1. Custom Commit Status URL (#30)

    * return err as second value
    
    * Make executeTemplate more general by extracting template path join
    
    * Generate target url with dynamic value (CommitTime)
    
    * Inject /etc/telefonistka-gh-app-config/ for mirrord
    
    This will be used for CUSTOM_COMMIT_STATUS_URL_TEMPLATE_PATH
    
    * Add doc
    
    * Add test
    
    * Fix lint issues
    
    * Make targetURL const
    
    * Change the level to Debug
    
    See: #30 (comment)
    yzdann authored Oct 23, 2024
    Copy the full SHA
    a43d3d1 View commit details
  2. Improve promotion comment. (#31)

    * Improve promotion comment.
    
    Promotion comment used to list all the values in the 'targetPaths' key,
    ignoring the promotionAllow and promotionBlock lists. This PR limits
    the comment to only paths that are being promoted.
    
    * Use testify library for assert
    
    * return nil, use assert
    
    * Add t.Parallel()
    ashvarts authored Oct 23, 2024
    Copy the full SHA
    33715e7 View commit details

Commits on Oct 24, 2024

  1. Sd 805 improve diff comment (#32)

    * Avoid displaying the "Sync from PR Branch" checkbox for new applications.
    * Create a new function to check if all application in a PR are new.
    * Write tests for new function
    * Rename HasSyncableComponents to DisplaySyncBranchCheckBox to better match its new usage
    * Switch from Emoji based annotation to GH markdown "alerts"
    Oded-B authored Oct 24, 2024
    Copy the full SHA
    81093e4 View commit details
  2. SD-838: fix panic (#33)

    * Fix potential panic
    
    The change [1] introduced a potential panic as it is trying to log the
    app name when a failure happens, but the app variable is overridden
    during such a failure and is thus nil.
    
    This results in the following panic.
    
        panic: runtime error: invalid memory address or nil pointer dereference
        [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x20ddccb]
    
        goroutine 367 [running]:
        internal/pkg/argocd.generateDiffOfAComponent()
    	    internal/pkg/argocd/argocd.go:477
        internal/pkg/argocd.GenerateDiffOfChangedComponents()
    	    internal/pkg/argocd/argocd.go:561
        internal/pkg/githubapi.HandlePREvent()
    	    internal/pkg/githubapi/github.go:161
        internal/pkg/githubapi.handleEvent()
    	    internal/pkg/githubapi/github.go:382
        created by internal/pkg/githubapi.ReciveWebhook
    	    internal/pkg/githubapi/github.go:322
    
    By instead using the name from the query constructed prior, the panic
    should be avoided.
    
    [1] adbd913
    hnnsgstfssn authored Oct 24, 2024
    Copy the full SHA
    9b32fb1 View commit details

Commits on Oct 28, 2024

  1. SD-781: Telefonistka wrongly reports "Error" when deploying from a PR…

    … branch with auto-sync on (#35)
    
    * Introduce .AppSyncedFromPRBranch and return no error
    
    * Disable deploy from branch for apps that we synced from branch
    yzdann authored Oct 28, 2024
    Copy the full SHA
    89c7839 View commit details
  2. Use separate context for setting the commit status

    When the event handling takes to long the previous context is canceled
    and the request fails and the commit status ends up in a pending state.
    
    Using a separate context will allow the status to always be set,
    regardless of the event handling timing out.
    hnnsgstfssn committed Oct 28, 2024
    Copy the full SHA
    7a63d3f View commit details
  3. Simplify label check function

    Since it is very specific, might as well make it operate directly on
    labels. This should make it slightly clearer and easier to read.
    
    This reverts commit fcd2aeffd5b2752c7274514b7c78be7fc1bc60fd.
    hnnsgstfssn committed Oct 28, 2024
    Copy the full SHA
    bf31002 View commit details
  4. Refactor to recover from panic in event handlers

    This change refactors the event handling logic such that a deferred
    panic handler can log panics in the downstream handler logic. This
    should avoid crashing when such panics occur, and instead it would log
    the panic using the logger.
    
    Additionally, the parsing of the event payload to determine which
    handling logic to invoke is separated out, and now also indicates
    whether a match was found. This is to allow PR status updates to be
    applied once, when appropriate, and to enable ensuring that the
    success/failure update is always applied.
    
    To achieve this the individual downstream logic is factored out into
    separate functions, and errors encountered in them are returned where
    prHandleError were previously set.
    
    Getting the default branch and Telefonistka config is duplicated in each
    handler as needed.
    hnnsgstfssn committed Oct 28, 2024
    Copy the full SHA
    0d69595 View commit details
Showing with 7,011 additions and 1,036 deletions.
  1. +6 −0 .github/dependabot.yml
  2. +40 −17 .github/workflows/docker-publish-on-comment.yml
  3. +40 −17 .github/workflows/docker-publish.yml
  4. +8 −6 .github/workflows/lint.yml
  5. +2 −0 .gitignore
  6. +1 −1 .golangci.yml
  7. +2 −1 .markdownlint.json
  8. +1 −0 CODEOWNERS
  9. +11 −3 Dockerfile
  10. +3 −2 Makefile
  11. +45 −3 README.md
  12. +12 −5 cmd/telefonistka/bump-version-overwrite.go
  13. +13 −6 cmd/telefonistka/bump-version-regex.go
  14. +107 −0 cmd/telefonistka/bump-version-yaml.go
  15. +91 −0 cmd/telefonistka/bump-version-yaml_test.go
  16. +1 −24 cmd/telefonistka/event.go
  17. +11 −5 cmd/telefonistka/server.go
  18. +85 −0 docs/argocd.md
  19. +67 −6 docs/installation.md
  20. +23 −0 docs/observability.md
  21. +31 −2 docs/version_bumping.md
  22. +3 −0 docs/webhook_multiplexing.md
  23. +193 −32 go.mod
  24. +666 −494 go.sum
  25. +605 −0 internal/pkg/argocd/argocd.go
  26. +105 −0 internal/pkg/argocd/argocd_copied_from_upstream.go
  27. +472 −0 internal/pkg/argocd/argocd_test.go
  28. +5 −0 internal/pkg/argocd/diff/README.md
  29. +260 −0 internal/pkg/argocd/diff/diff.go
  30. +46 −0 internal/pkg/argocd/diff/diff_test.go
  31. +13 −0 internal/pkg/argocd/diff/testdata/allnew.txt
  32. +13 −0 internal/pkg/argocd/diff/testdata/allold.txt
  33. +35 −0 internal/pkg/argocd/diff/testdata/basic.txt
  34. +40 −0 internal/pkg/argocd/diff/testdata/dups.txt
  35. +38 −0 internal/pkg/argocd/diff/testdata/end.txt
  36. +9 −0 internal/pkg/argocd/diff/testdata/eof.txt
  37. +18 −0 internal/pkg/argocd/diff/testdata/eof1.txt
  38. +18 −0 internal/pkg/argocd/diff/testdata/eof2.txt
  39. +62 −0 internal/pkg/argocd/diff/testdata/long.txt
  40. +5 −0 internal/pkg/argocd/diff/testdata/same.txt
  41. +34 −0 internal/pkg/argocd/diff/testdata/start.txt
  42. +40 −0 internal/pkg/argocd/diff/testdata/triv.txt
  43. +38 −0 internal/pkg/argocd/testdata/TestDiffLiveVsTargetObject/1.live
  44. +38 −0 internal/pkg/argocd/testdata/TestDiffLiveVsTargetObject/1.target
  45. +16 −0 internal/pkg/argocd/testdata/TestDiffLiveVsTargetObject/1.want
  46. +54 −0 internal/pkg/argocd/testdata/TestRenderDiff.live
  47. +22 −0 internal/pkg/argocd/testdata/TestRenderDiff.md
  48. +54 −0 internal/pkg/argocd/testdata/TestRenderDiff.target
  49. +23 −9 internal/pkg/configuration/config.go
  50. +7 −0 internal/pkg/configuration/config_test.go
  51. +4 −0 internal/pkg/configuration/tests/testConfigurationParsing.yaml
  52. +0 −93 internal/pkg/githubapi/.tmpMJcSWN
  53. +18 −33 internal/pkg/githubapi/clients.go
  54. +3 −4 internal/pkg/githubapi/drift_detection.go
  55. +37 −37 internal/pkg/githubapi/drift_detection_test.go
  56. +741 −160 internal/pkg/githubapi/github.go
  57. +2 −2 internal/pkg/githubapi/github_graphql.go
  58. +567 −0 internal/pkg/githubapi/github_test.go
  59. +108 −0 internal/pkg/githubapi/pr_metrics.go
  60. +87 −0 internal/pkg/githubapi/pr_metrics_test.go
  61. +84 −34 internal/pkg/githubapi/promotion.go
  62. +301 −28 internal/pkg/githubapi/promotion_test.go
  63. +1 −0 internal/pkg/githubapi/testdata/custom_commit_status_invalid_template.gotmpl
  64. +1 −0 internal/pkg/githubapi/testdata/custom_commit_status_valid_template.gotmpl
  65. +88 −0 internal/pkg/githubapi/testdata/data/TestMarkdownGenerator/Basic_templating.json
  66. +88 −0 internal/pkg/githubapi/testdata/data/TestMarkdownGenerator/Concice_templeting.json
  67. +34 −0 internal/pkg/githubapi/testdata/data/TestMarkdownGenerator/OutOfSync.json
  68. +88 −0 internal/pkg/githubapi/testdata/data/TestMarkdownGenerator/Part_of_splitted_comment_.json
  69. +34 −0 internal/pkg/githubapi/testdata/data/TestMarkdownGenerator/Show_Sync_from_Branch_checkbox.json
  70. +34 −0 ...bapi/testdata/data/TestMarkdownGenerator/Temp_app_should_not_show_sync_or_unhealthy_warnings.json
  71. +34 −0 internal/pkg/githubapi/testdata/data/TestMarkdownGenerator/Unhealthy.json
  72. +88 −0 internal/pkg/githubapi/testdata/diff_comment_data_test.json
  73. +205 −0 internal/pkg/githubapi/testdata/output/TestMarkdownGenerator/Basic_templating.md
  74. +43 −0 internal/pkg/githubapi/testdata/output/TestMarkdownGenerator/Concice_templeting.md
  75. +71 −0 internal/pkg/githubapi/testdata/output/TestMarkdownGenerator/OutOfSync.md
  76. +207 −0 internal/pkg/githubapi/testdata/output/TestMarkdownGenerator/Part_of_splitted_comment_.md
  77. +71 −0 internal/pkg/githubapi/testdata/output/TestMarkdownGenerator/Show_Sync_from_Branch_checkbox.md
  78. +73 −0 ...bapi/testdata/output/TestMarkdownGenerator/Temp_app_should_not_show_sync_or_unhealthy_warnings.md
  79. +71 −0 internal/pkg/githubapi/testdata/output/TestMarkdownGenerator/Unhealthy.md
  80. +8 −0 internal/pkg/githubapi/testdata/pr_body.golden.md
  81. +4 −0 internal/pkg/githubapi/testdata/pr_body_multi_component.golden.md
  82. +11 −9 internal/pkg/githubapi/webhook_proxy.go
  83. +1 −1 internal/pkg/githubapi/webhook_proxy_test.go
  84. +1 −0 internal/pkg/mocks/.gitignore
  85. +9 −0 internal/pkg/mocks/mocks.go
  86. +51 −1 internal/pkg/prometheus/prometheus.go
  87. +1 −1 internal/pkg/prometheus/prometheus_test.go
  88. +16 −0 internal/pkg/testutils/testutils.go
  89. +25 −0 mirrord.json
  90. +164 −0 schema/telefonistka.json
  91. +5 −0 templates/auto-merge-comment.gotmpl
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
57 changes: 40 additions & 17 deletions .github/workflows/docker-publish-on-comment.yml
Original file line number Diff line number Diff line change
@@ -9,17 +9,16 @@ on:
issue_comment:
types: [created]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

env:
DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USERNAME }}
IMAGE_NAME: ${{ vars.IMAGE_NAME }}
REGISTRY: ${{ vars.REGISTRY }}

jobs:
build:
runs-on: ubuntu-latest
if: github.event.issue.pull_request && contains(github.event.comment.body, '/publish') && github.event.comment.user.login == 'Oded-B'
if: github.event.issue.pull_request && contains(github.event.comment.body, '/publish')
permissions:
contents: read
packages: write
@@ -32,7 +31,7 @@ jobs:

steps:
- name: Get PR branch
uses: xt0rted/pull-request-comment-branch@v2
uses: xt0rted/pull-request-comment-branch@v3
id: comment-branch
- name: Checkout repository
uses: actions/checkout@v4
@@ -47,21 +46,22 @@ jobs:

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@edfb0fe6204400c56fbfd3feba3fe9ad1adfa345
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into GH registry ${{ env.REGISTRY }}
uses: docker/login-action@3d58c274f17dffee475a5520cbe67f0a882c4dbb
- name: Log into GH registry (ghcr.io)
uses: docker/login-action@7ca345011ac4304463197fac0e56eab1bc7e6af0
with:
registry: ${{ env.REGISTRY }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log into Docker Hub registry ${{ env.REGISTRY }}
uses: docker/login-action@3d58c274f17dffee475a5520cbe67f0a882c4dbb
- name: Log into Docker Hub registry
if: env.DOCKERHUB_USERNAME != ''
uses: docker/login-action@7ca345011ac4304463197fac0e56eab1bc7e6af0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
@@ -70,12 +70,11 @@ jobs:
# 2nd image name is for DockerHub image
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@dbef88086f6cef02e264edb7dbf63250c17cef6c
uses: docker/metadata-action@906ecf0fc0a80f9110f79d9e6c04b1080f4a2621
with:
context: git
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
wayfaiross/telefonistka
tags: |
type=ref,event=branch
type=ref,event=pr
@@ -86,14 +85,38 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@9f6f8c940b91232557f8699b21341a08624a8dce
uses: docker/build-push-action@7e094594beda23fc8f21fa31049f4b203e51096b
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Extract Docker metadata - alpine
id: meta-alpine
uses: docker/metadata-action@906ecf0fc0a80f9110f79d9e6c04b1080f4a2621
with:
context: git
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha
flavor: prefix=alpine-,onlatest=true
- name: Build and push Docker image - alpine
id: build-and-push-alpine
uses: docker/build-push-action@7e094594beda23fc8f21fa31049f4b203e51096b
with:
context: .
target: alpine-release
push: true
tags: ${{ steps.meta-alpine.outputs.tags }}
labels: ${{ steps.meta-alpine.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Set latest commit status as ${{ job.status }}
uses: myrotvorets/set-commit-status-action@master
if: always()
57 changes: 40 additions & 17 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -16,11 +16,9 @@ on:
branches: [ "main" ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USERNAME }}
IMAGE_NAME: ${{ vars.IMAGE_NAME }}
REGISTRY: ${{ vars.REGISTRY }}

jobs:
build:
@@ -49,23 +47,23 @@ jobs:

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@edfb0fe6204400c56fbfd3feba3fe9ad1adfa345
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into GH registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@3d58c274f17dffee475a5520cbe67f0a882c4dbb
- name: Log into GH registry (ghcr.io)
if: github.event_name != 'pull_request'
uses: docker/login-action@7ca345011ac4304463197fac0e56eab1bc7e6af0
with:
registry: ${{ env.REGISTRY }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log into Docker Hub registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@3d58c274f17dffee475a5520cbe67f0a882c4dbb
- name: Log into Docker Hub registry
if: github.event_name != 'pull_request' && env.DOCKERHUB_USERNAME != ''
uses: docker/login-action@7ca345011ac4304463197fac0e56eab1bc7e6af0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
@@ -74,18 +72,17 @@ jobs:
# 2nd image name is for DockerHub image
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@dbef88086f6cef02e264edb7dbf63250c17cef6c
uses: docker/metadata-action@906ecf0fc0a80f9110f79d9e6c04b1080f4a2621
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
wayfaiross/telefonistka
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@9f6f8c940b91232557f8699b21341a08624a8dce
uses: docker/build-push-action@7e094594beda23fc8f21fa31049f4b203e51096b
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
@@ -94,6 +91,32 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
# 1st image name is for GH package repo
# 2nd image name is for DockerHub image
- name: Extract Docker metadata - alpine
id: meta-alpine
uses: docker/metadata-action@906ecf0fc0a80f9110f79d9e6c04b1080f4a2621
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: prefix=alpine-,onlatest=true

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image - alpine
id: build-and-push-alpine
uses: docker/build-push-action@7e094594beda23fc8f21fa31049f4b203e51096b
with:
context: .
target: alpine-release
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-alpine.outputs.tags }}
labels: ${{ steps.meta-alpine.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max


# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
14 changes: 8 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -17,28 +17,30 @@ jobs:
uses: avto-dev/markdown-lint@v1
with:
config: '.markdownlint.json'
args: '**/*.md .github/**/*.md'
args: '*.md docs/*.md .github/**/*.md'
renovate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 🧼 lint renovate config # Validates changes to renovate.json config file
uses: suzuki-shunsuke/github-action-renovate-config-validator@v1.0.1
uses: suzuki-shunsuke/github-action-renovate-config-validator@v1.1.1
with:
config_file_path: 'renovate.json'
golangci:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.19
- uses: actions/checkout@v4
go-version-file: go.mod
- run: make get-deps
- run: go mod tidy -diff
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.50.1
version: v1.64.7

# Optional: working directory, useful for monorepos
# working-directory: somedir
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/telefonistka
vendor/
internal/pkg/mocks/argocd_settings.go
internal/pkg/mocks/argocd_project.go
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ linters:
- durationcheck
- errcheck
- errname
- exportloopref
- copyloopvar
- gci
- gochecknoinits
- gofmt
3 changes: 2 additions & 1 deletion .markdownlint.json
Original file line number Diff line number Diff line change
@@ -12,5 +12,6 @@
"MD025": {
"front_matter_title": ""
},
"MD041": false
"MD041": false,
"MD034": false
}
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @commercetools/special-delivery
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@

FROM golang:1.21.5 as test
FROM golang:1.24.1 AS test
ARG GOPROXY
ENV GOPATH=/go
ENV PATH="$PATH:$GOPATH/bin"
WORKDIR /go/src/github.com/wayfair-incubator/telefonistka
COPY . ./
RUN make test

FROM test as build
# FROM golang:1.18.3 as build
FROM test AS build
ARG GOPROXY
ENV GOPATH=/go
ENV PATH="$PATH:$GOPATH/bin"
@@ -17,6 +16,15 @@ COPY . ./
RUN make build


FROM alpine:latest AS alpine-release
WORKDIR /telefonistka
COPY --from=build /go/src/github.com/wayfair-incubator/telefonistka/telefonistka /telefonistka/bin/telefonistka
COPY templates/ /telefonistka/templates/
# This next line is hack to overcome GH actions lack of support for docker workdir override https://github.com/actions/runner/issues/878
COPY templates/ /github/workspace/templates/
USER 1001
ENTRYPOINT ["/telefonistka/bin/telefonistka"]
CMD ["server"]



5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -12,7 +12,8 @@ VENDOR_DIR = vendor
get-deps: $(VENDOR_DIR)

$(VENDOR_DIR):
GO111MODULE=on go mod vendor
go generate $$(go list ./internal/pkg/mocks/...)
go mod download

.PHONY: build
build: $(VENDOR_DIR)
@@ -24,5 +25,5 @@ clean:

.PHONY: test
test: $(VENDOR_DIR)
go test -v -timeout 30s .
TEMPLATES_PATH=../../../templates/ go test -v -timeout 30s ./...

Loading