Skip to content

Commit 839e287

Browse files
Ash-expprkhrkatiamayushmvikramdevtronakshatsinha007
authored
chore: Merged origin/main branch into develop (#6770)
* ephemeral error fix * ephemeral error fix (#6737) * panic fix * NotificationRule removed * vendor update * misc: Added Github Actions for linting and building api specs (#6720) * Added action to check for linting errors in openapi.yaml * Create build-docs.yaml * added read-only permission in api-linter * updated action to add permission * misc: open api spec addition (#6750) * added version yml * changes in openapi.yaml * Updated build-docs.yaml (#6752) switch the approach from rebasing to creating a temp folder and copying the file * misc: fixing swagger openapi.yaml (#6751) * resolved application.yaml * resolved application.yaml * resolved applisting.yaml * resolved charts.yaml helm-apps list * resolved jobs.yaml jobs list * removed unrequired server * renamed the x-displayName * resolved app-labels.yaml * resolved merge-conflict * resolved merge-conflict - 02 * added Get Deployment History (ENT) spec * misc: adding codeowner for swagger api spec (#6754) * adding codeowner for swagger api spec * adding codeowner for swagger api spec * gitops validation spec added (#6755) * misc: Update openapi spec (#6758) * Updated openapi-spec with notificats api * updated openapi-spec to add historical-get-api-change * updated the title of openapi specs (#6759) * removed timeout notification (#6760) * misc: Timeout main notification (#6761) * removed timeout notification * removed timeout notification * misc: changes in description of api spec (#6767) * changes in description of api spec * refactor: rename bulk edit config SQL files for consistency * chore: update dependencies to origin/main --------- Co-authored-by: prakhar katiyar <[email protected]> Co-authored-by: prakhar katiyar <[email protected]> Co-authored-by: ayushmaheshwari <[email protected]> Co-authored-by: iamayushm <[email protected]> Co-authored-by: Vikram <[email protected]> Co-authored-by: Vikram Singh <[email protected]> Co-authored-by: akshatsinha007 <[email protected]> Co-authored-by: kamal-devtron <[email protected]> Co-authored-by: Badal Kumar <[email protected]> Co-authored-by: Pawan Kumar <[email protected]>
2 parents 9a925a8 + 1d85543 commit 839e287

File tree

36 files changed

+11155
-1975
lines changed

36 files changed

+11155
-1975
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ scripts/sql @prakarsh-dt @vikramdevtron @nishant-d @vivek-devtron
1111
scripts/utilities @prakarsh-dt @nishant-d @pawan-mehta-dt @vivek-devtron
1212

1313
#Github Specific
14-
.github/ @prakarsh-dt @nishant-d @pawan-mehta-dt @vikramdevtron @tayalrishabh96
14+
.github/ @prakarsh-dt @nishant-d @pawan-mehta-dt @vikramdevtron @tayalrishabh96 @pawan-59
15+
16+
#swagger api specs
17+
specs/ @prakarsh-dt @pawan-mehta-dt @pawan-59

.github/workflows/api-linter.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Lint API Specs
2+
on:
3+
pull_request:
4+
paths:
5+
- 'specs/swagger/**'
6+
permissions:
7+
contents: read
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
- name: Install Redocly CLI
19+
run: npm install -g @redocly/cli
20+
- name: Lint OpenAPI specification
21+
run: |
22+
cd specs/swagger
23+
echo "Linting OpenAPI specification..."
24+
redocly lint openapi.yaml
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GH_SYSTEMSDT_TOKEN }}

.github/workflows/build-docs.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: OpenAPI Build Documentation
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- 'specs/swagger/**'
8+
permissions:
9+
contents: write
10+
jobs:
11+
lint-and-build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
22+
- name: Install Redocly CLI
23+
run: npm install -g @redocly/cli
24+
25+
- name: Switch to gh-pages and copy OpenAPI source
26+
run: |
27+
git config --local user.email "[email protected]"
28+
git config --local user.name "GitHub Action"
29+
30+
mkdir tmp-api
31+
32+
cp specs/swagger/openapi.yaml tmp-api/
33+
34+
git checkout gh-pages
35+
36+
cp tmp-api/openapi.yaml specs/swagger/openapi.yaml
37+
38+
rm -rf /tmp-api
39+
40+
- name: Build OpenAPI documentation
41+
run: |
42+
43+
cd specs/swagger
44+
echo "Building OpenAPI documentation..."
45+
redocly build-docs openapi.yaml --output=openapi.html
46+
echo "Documentation built successfully!"
47+
48+
- name: Commit and push documentation
49+
run: |
50+
git config --local user.email "[email protected]"
51+
git config --local user.name "GitHub Action"
52+
53+
git add specs/swagger/openapi.html specs/swagger/openapi.yaml
54+
55+
if git diff --staged --quiet; then
56+
echo "No changes to commit"
57+
else
58+
git commit -m "Update OpenAPI documentation from main branch"
59+
git push origin gh-pages
60+
echo "Documentation pushed to gh-pages branch!"
61+
fi
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GH_SYSTEMSDT_TOKEN }}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ require (
334334
replace (
335335
github.com/argoproj/argo-workflows/v3 v3.5.13 => github.com/devtron-labs/argo-workflows/v3 v3.5.13
336336
github.com/cyphar/filepath-securejoin v0.4.1 => github.com/cyphar/filepath-securejoin v0.3.6 // indirect
337-
github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250708133124-d0285b3c0de2
338-
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250708133124-d0285b3c0de2
337+
github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250718122027-cb75c2add53e
338+
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250718122027-cb75c2add53e
339339
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 => go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1
340340
)

go.sum

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,10 @@ github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzq
237237
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
238238
github.com/devtron-labs/argo-workflows/v3 v3.5.13 h1:3pINq0gXOSeTw2z/vYe+j80lRpSN5Rp/8mfQORh8SmU=
239239
github.com/devtron-labs/argo-workflows/v3 v3.5.13/go.mod h1:/vqxcovDPT4zqr4DjR5v7CF8ggpY1l3TSa2CIG3jmjA=
240-
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250708133124-d0285b3c0de2 h1:DVZudmuKWuWGEUN3DoMpYDBGIk7dWQSdubx8ixKZZh4=
241-
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250708133124-d0285b3c0de2/go.mod h1:9LCkYfiWaEKIBkmxw9jX1GujvEMyHwmDtVsatffAkeU=
242-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250708133124-d0285b3c0de2 h1:g2Zee/3lL8lOtOieDDnHYD/h00JPFpEdP6uu3FAzKx4=
243-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250708133124-d0285b3c0de2/go.mod h1:/Ciy9tD9OxZOWBDPIasM448H7uvSo4+ZJiExpfwBZpA=
240+
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250718122027-cb75c2add53e h1:uhVKRc6CyQngloaUUfYz9y8fZ2My0x1Jrkt/YbZdRAI=
241+
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250718122027-cb75c2add53e/go.mod h1:9LCkYfiWaEKIBkmxw9jX1GujvEMyHwmDtVsatffAkeU=
242+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250718122027-cb75c2add53e h1:bprDKDpzZ/UVFxnA3xP3GiqRFHjmmTXXg2IDkN5EdUg=
243+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250718122027-cb75c2add53e/go.mod h1:/Ciy9tD9OxZOWBDPIasM448H7uvSo4+ZJiExpfwBZpA=
244244
github.com/devtron-labs/go-bitbucket v0.9.60-beta h1:VEx1jvDgdtDPS6A1uUFoaEi0l1/oLhbr+90xOwr6sDU=
245245
github.com/devtron-labs/go-bitbucket v0.9.60-beta/go.mod h1:GnuiCesvh8xyHeMCb+twm8lBR/kQzJYSKL28ZfObp1Y=
246246
github.com/devtron-labs/protos v0.0.3-0.20250323220609-ecf8a0f7305e h1:U6UdYbW8a7xn5IzFPd8cywjVVPfutGJCudjePAfL/Hs=
@@ -475,7 +475,6 @@ github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0=
475475
github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
476476
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
477477
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
478-
github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE=
479478
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
480479
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
481480
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=

internal/sql/repository/NotificationSettingsRepository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ func (impl *NotificationSettingsRepositoryImpl) FindNotificationSettingsWithRule
628628

629629
query := impl.dbConnection.
630630
Model(&notificationSettings).
631-
Column("notification_settings.*", "NotificationRule").
631+
Column("notification_settings.*").
632632
Where("notification_settings.pipeline_type = ?", req.PipelineType).
633633
Where("notification_settings.event_type_id = ?", eventId).
634634
WhereGroup(settingsFilerConditions)

pkg/deployment/trigger/devtronApps/postStageHandlerCode.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func (impl *HandlerServiceImpl) TriggerPostStage(request bean.CdTriggerRequest)
5656
return nil, err
5757
}
5858
}
59+
request.Artifact = cdWf.CiArtifact
5960

6061
// Migration of deprecated DataSource Type
6162
if cdWf.CiArtifact.IsMigrationRequired() {

pkg/k8s/application/k8sApplicationService.go

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,17 +1040,81 @@ func (impl *K8sApplicationServiceImpl) TerminatePodEphemeralContainer(req bean5.
10401040
if container == nil {
10411041
return false, errors.New("externally created ephemeral containers cannot be removed")
10421042
}
1043+
// Check if pod exists and is running before attempting to execute command
1044+
var v1Client *v1.CoreV1Client
1045+
if req.ExternalArgoAppIdentifier != nil {
1046+
_, v1Client, err = impl.k8sCommonService.GetCoreClientByClusterIdForExternalArgoApps(&req)
1047+
if err != nil {
1048+
impl.logger.Errorw("error in getting coreV1 client by clusterId for external argo apps", "err", err, "req", req)
1049+
return false, err
1050+
}
1051+
} else {
1052+
_, v1Client, err = impl.k8sCommonService.GetCoreClientByClusterId(req.ClusterId)
1053+
if err != nil {
1054+
impl.logger.Errorw("error in getting coreV1 client by clusterId", "clusterId", req.ClusterId, "err", err)
1055+
return false, err
1056+
}
1057+
}
1058+
1059+
// Check if pod exists and is running
1060+
pod, err := impl.K8sUtil.GetPodByName(req.Namespace, req.PodName, v1Client)
1061+
if err != nil {
1062+
if k8s.IsResourceNotFoundErr(err) {
1063+
impl.logger.Infow("pod not found, ephemeral container termination not needed", "podName", req.PodName, "namespace", req.Namespace, "clusterId", req.ClusterId)
1064+
// Pod doesn't exist, so ephemeral container is already terminated
1065+
err = impl.ephemeralContainerService.AuditEphemeralContainerAction(req, repository.ActionTerminate)
1066+
if err != nil {
1067+
impl.logger.Errorw("error in saving ephemeral container data", "err", err)
1068+
return true, err
1069+
}
1070+
return true, nil
1071+
}
1072+
impl.logger.Errorw("error in getting pod", "clusterId", req.ClusterId, "namespace", req.Namespace, "podName", req.PodName, "err", err)
1073+
return false, err
1074+
}
1075+
1076+
// Check if pod is in a terminated state
1077+
if pod.Status.Phase == corev1.PodSucceeded || pod.Status.Phase == corev1.PodFailed {
1078+
impl.logger.Infow("pod is in terminated state, ephemeral container termination not needed", "podName", req.PodName, "namespace", req.Namespace, "clusterId", req.ClusterId, "podPhase", pod.Status.Phase)
1079+
// Pod is terminated, so ephemeral container is already terminated
1080+
err = impl.ephemeralContainerService.AuditEphemeralContainerAction(req, repository.ActionTerminate)
1081+
if err != nil {
1082+
impl.logger.Errorw("error in saving ephemeral container data", "err", err)
1083+
return true, err
1084+
}
1085+
return true, nil
1086+
}
1087+
1088+
// Check if the specific ephemeral container is still running
1089+
ephemeralContainerRunning := false
1090+
for _, ecStatus := range pod.Status.EphemeralContainerStatuses {
1091+
if ecStatus.Name == req.BasicData.ContainerName && ecStatus.State.Running != nil {
1092+
ephemeralContainerRunning = true
1093+
break
1094+
}
1095+
}
1096+
1097+
if !ephemeralContainerRunning {
1098+
impl.logger.Infow("ephemeral container is not running, termination not needed", "podName", req.PodName, "namespace", req.Namespace, "clusterId", req.ClusterId, "containerName", req.BasicData.ContainerName)
1099+
// Ephemeral container is not running, so it's already terminated
1100+
err = impl.ephemeralContainerService.AuditEphemeralContainerAction(req, repository.ActionTerminate)
1101+
if err != nil {
1102+
impl.logger.Errorw("error in saving ephemeral container data", "err", err)
1103+
return true, err
1104+
}
1105+
return true, nil
1106+
}
10431107
containerKillCommand := fmt.Sprintf("kill -16 $(pgrep -f '%s' -o)", fmt.Sprintf(k8sObjectUtils.EphemeralContainerStartingShellScriptFileName, terminalReq.ContainerName))
10441108
cmds := []string{"sh", "-c", containerKillCommand}
10451109
_, errBuf, err := impl.terminalSession.RunCmdInRemotePod(terminalReq, cmds)
10461110
if err != nil {
10471111
impl.logger.Errorw("failed to execute commands ", "err", err, "commands", cmds, "podName", req.PodName, "namespace", req.Namespace)
1048-
return false, err
1112+
// not returning the error since websocket connection will break when running kill command
10491113
}
10501114
errBufString := errBuf.String()
10511115
if errBufString != "" {
10521116
impl.logger.Errorw("error response on executing commands ", "err", errBufString, "commands", cmds, "podName", req.Namespace, "namespace", req.Namespace)
1053-
return false, err
1117+
// not returning the error since websocket connection will break when running kill command
10541118
}
10551119

10561120
if err == nil {

pkg/workflow/status/WorkflowStatusService.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ func (impl *WorkflowStatusServiceImpl) CheckHelmAppStatusPeriodicallyAndUpdateIn
213213
impl.logger.Errorw("error on handling deployment success event", "wfr", wfr, "err", err)
214214
return err
215215
}
216-
} else if wfr.Status == cdWorkflow2.WorkflowTimedOut {
217-
impl.deploymentEventHandler.WriteCDNotificationEventAsync(pipelineOverride.Pipeline.AppId, pipelineOverride.Pipeline.EnvironmentId, pipelineOverride, util.Fail)
218216
}
219217
}
220218
return nil
@@ -674,8 +672,6 @@ func (impl *WorkflowStatusServiceImpl) CheckFluxAppStatusPeriodicallyAndUpdateIn
674672
impl.logger.Errorw("error on handling deployment success event", "wfr", wfr, "err", err)
675673
return err
676674
}
677-
} else if wfr.Status == cdWorkflow2.WorkflowTimedOut {
678-
impl.deploymentEventHandler.WriteCDNotificationEventAsync(pipelineOverride.Pipeline.AppId, pipelineOverride.Pipeline.EnvironmentId, pipelineOverride, util.Fail)
679675
}
680676
}
681677
return nil

0 commit comments

Comments
 (0)