Skip to content

Commit 9f0a7f6

Browse files
Merge branch 'main' into release-bot
2 parents 494c4ec + 657fc69 commit 9f0a7f6

21 files changed

+365
-99
lines changed

.github/semantic.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
11
titleOnly: true
22

3+
types:
4+
- fix
5+
- feat
6+
- feature
7+
- fixes
8+
- chore
9+
- perf
10+
- docs
11+
- doc
12+
- release

.github/workflows/create-release.yml

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@ name: Create Release
55
# Controls when the action will run. Workflow runs when manually triggered using the UI
66
# or on push in charts directory of main branch.
77
on:
8-
push:
9-
branches: [ main ]
108

11-
paths:
12-
- 'charts/**'
13-
149
workflow_dispatch:
1510

1611
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
@@ -25,26 +20,60 @@ jobs:
2520
# Runs series of commands to create a release
2621
- name: create-release
2722
run: |
28-
gh repo clone $GITHUB_REPOSITORY
29-
cd devtron
30-
tag=$(git tag --sort=committerdate | tail -1)
31-
echo $tag
32-
echo $RELEASE_BRANCH
33-
echo $GITHUB_REPOSITORY
34-
gh release create $tag --target $RELEASE_BRANCH -R $GITHUB_REPOSITORY
35-
sudo apt install nodejs npm -y
36-
npm install github-release-notes -g
37-
gren release --data-source issues --include-messages all --override --token ${{ secrets.GIT_TOKEN }} --tags $tag --username devtron-labs --repo devtron
23+
RELEASE_FILE_CONTENTS=$(curl -L -s "https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/${RELEASE_BRANCH}/manifests/release.txt" )
24+
RELEASE_TYPE=$(echo $RELEASE_FILE_CONTENTS | awk '{print $1}')
25+
FILE_NAME=${FILE_NAME:=releasenotes.md}
26+
echo $RELEASE_TYPE
27+
if [[ "$RELEASE_TYPE" == "stable" ]]
28+
then
29+
echo $GITHUB_REPOSITORY
30+
gh repo clone $GITHUB_REPOSITORY
31+
cd devtron
32+
tag=$(git tag --sort=committerdate | tail -1)
33+
echo $tag
34+
echo $RELEASE_BRANCH
35+
echo $GITHUB_REPOSITORY
36+
gh release create $tag --target $RELEASE_BRANCH -R $GITHUB_REPOSITORY -F $FILE_NAME
37+
git checkout -b release-bot
38+
touch CHANGELOG/release-notes-${tag}.md
39+
cat $FILE_NAME > CHANGELOG/release-notes-${tag}.md
40+
ls CHANGELOG
41+
git config --global user.email "$GIT_CONFIG_EMAIL"
42+
git config --global user.name "$GIT_CONFIG_NAME"
43+
rm -f $FILE_NAME
44+
touch $FILE_NAME
45+
echo "## Bugs" > beta-releasenotes.md
46+
echo "## Enhancements" >> beta-releasenotes.md
47+
echo "## Documentation" >> beta-releasenotes.md
48+
echo "## Others" >> beta-releasenotes.md
49+
echo "beta -1 $tag" > manifests/release.txt
50+
git add .
51+
git commit -am "Updated release-notes files"
52+
git push -f https://${GIT_CONFIG_NAME}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY} release-bot
53+
elif [[ "$RELEASE_TYPE" == "beta" ]]
54+
then
55+
echo "Not creating release due to beta"
56+
fi
3857
env:
3958
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
4059
RELEASE_BRANCH: ${{ secrets.RELEASE_BRANCH }}
60+
GIT_CONFIG_NAME: ${{ secrets.GIT_TARGET_USERNAME }}
61+
GIT_CONFIG_EMAIL: ${{ secrets.GIT_TARGET_EMAIL }}
4162
# Send notification on discord
4263
- name: discord-notify
4364
run: |
65+
RELEASE_FILE_CONTENTS=$(curl -L -s "https://raw.githubusercontent.com/$REPO/$GIT_BRANCH/manifests/release.txt" )
66+
RELEASE_TYPE=$(echo $RELEASE_FILE_CONTENTS | awk '{print $1}')
67+
if [[ "$RELEASE_TYPE" == "stable" ]]
68+
then
4469
sudo apt install python3 python3-pip -y
4570
pip install discord-webhook
4671
export repo=$GITHUB_REPOSITORY
4772
export webhook_url=${{ secrets.DISCORD_WEBHOOK_URL }}
4873
curl -O https://raw.githubusercontent.com/pawan-59/scripts/main/python/release-note-discord.py
4974
ls
5075
python3 release-note-discord.py
76+
elif [[ "$RELEASE_TYPE" == "beta" ]]
77+
then
78+
echo "Not sending notification due to beta"
79+
fi
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: update-release-notes
2+
3+
# Controls when the workflow will run
4+
on:
5+
pull_request_target:
6+
types:
7+
- closed
8+
branches:
9+
- main
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
if_merged:
17+
if: github.event.pull_request.merged == true
18+
runs-on: ubuntu-latest
19+
steps:
20+
- run: |
21+
echo "PR ${{ github.event.pull_request.title }} (#${{ github.event.pull_request.number }}) has been merged"
22+
closed_pr="- ${{ github.event.pull_request.title }} (#${{ github.event.pull_request.number }})"
23+
closed_pr_lower=$(echo "$closed_pr" | sed -e 's/\(.*\)/\L\1/')
24+
gh repo clone $GITHUB_REPOSITORY
25+
REPO_NAME=$(echo $GITHUB_REPOSITORY | awk -F ["/"] '{print $2}')
26+
DOC_SECTION=${DOC_SECTION:=Documentation}
27+
FEAT_SECTION=${FEAT_SECTION:=Enhancements}
28+
BUG_SECTION=${BUG_SECTION:=Bugs}
29+
OTHER_SECTION=${OTHER_SECTION:=Others}
30+
FILE_NAME=${FILE_NAME:=beta-releasenotes.md}
31+
RELEASE_NOTES_BRANCH=${RELEASE_NOTES_BRANCH:=release-bot}
32+
echo "Cloned repository $REPO_NAME"
33+
cd $REPO_NAME
34+
git config --global user.email "${GIT_CONFIG_EMAIL}" && git config --global user.name "${GIT_CONFIG_NAME}"
35+
git branch ${RELEASE_NOTES_BRANCH} refs/remotes/origin/${RELEASE_NOTES_BRANCH}
36+
git checkout ${RELEASE_NOTES_BRANCH}
37+
# Update Documentation PRs in documentation section
38+
if [[ "$closed_pr_lower" == *"doc:"* || "$closed_pr_lower" == *"docs:"* ]]
39+
then
40+
sed -i "/${DOC_SECTION}/a $closed_pr" "$FILE_NAME"
41+
# Skip Release PRs from release notes
42+
elif [[ "$closed_pr_lower" == *"release:"* || "$closed_pr_lower" == *"releases:"* ]]
43+
then
44+
echo "Skipping Release PR: $closed_pr"
45+
# Update Bug fixes PRs in Bugs section
46+
elif [[ "$closed_pr_lower" == *"fix:"* || "$closed_pr_lower" == *"fixes:"* ]]
47+
then
48+
sed -i "/${BUG_SECTION}/a $closed_pr" "$FILE_NAME"
49+
# Update Features/Enhancements PRs in enhancement section
50+
elif [[ "$closed_pr_lower" == *"feat:"* || "$closed_pr_lower" == *"feature:"* || "$closed_pr_lower" == *"enhancement:"* || "$closed_pr_lower" == *"perf:"* ]]
51+
then
52+
sed -i "/${FEAT_SECTION}/a $closed_pr" "$FILE_NAME"
53+
else
54+
# Update all other PRs in others section
55+
sed -i "/${OTHER_SECTION}/a $closed_pr" "$FILE_NAME"
56+
fi
57+
git commit -am "Updated release notes"
58+
git push https://${GIT_CONFIG_NAME}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY} $RELEASE_NOTES_BRANCH
59+
env:
60+
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
61+
GIT_CONFIG_NAME: ${{ secrets.GIT_TARGET_USERNAME }}
62+
GIT_CONFIG_EMAIL: ${{ secrets.GIT_TARGET_EMAIL }}

api/appbean/AppDetail.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,19 @@ type GitMaterial struct {
4242
}
4343

4444
type DockerConfig struct {
45-
DockerRegistry string `json:"dockerRegistry" validate:"required"`
46-
DockerRepository string `json:"dockerRepository" validate:"required"`
47-
CiBuildConfig *bean.CiBuildConfigBean `json:"ciBuildConfig" validate:"required"`
48-
CheckoutPath string `json:"checkoutPath"`
45+
DockerRegistry string `json:"dockerRegistry" validate:"required"`
46+
DockerRepository string `json:"dockerRepository" validate:"required"`
47+
CiBuildConfig *bean.CiBuildConfigBean `json:"ciBuildConfig"`
48+
DockerBuildConfig *DockerBuildConfig `json:"dockerBuildConfig,omitempty"` // Deprecated, should use CiBuildConfig for development
49+
CheckoutPath string `json:"checkoutPath"`
50+
}
51+
52+
type DockerBuildConfig struct {
53+
GitCheckoutPath string `json:"gitCheckoutPath,omitempty" validate:"required"`
54+
DockerfileRelativePath string `json:"dockerfileRelativePath,omitempty" validate:"required"`
55+
Args map[string]string `json:"args,omitempty"`
56+
TargetPlatform string `json:"targetPlatform"`
57+
DockerBuildOptions map[string]string `json:"dockerBuildOptions,omitempty"`
4958
}
5059

5160
type DeploymentTemplate struct {

api/restHandler/AppListingRestHandler.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,6 @@ func (handler AppListingRestHandlerImpl) fetchResourceTree(w http.ResponseWriter
725725
}
726726
}
727727
appDetail.ResourceTree = util2.InterfaceToMapAdapter(resp)
728-
handler.logger.Debugw("application environment status", "appId", appId, "envId", envId, "resp", resp)
729728
if resp.Status == string(health.HealthStatusHealthy) {
730729
err = handler.cdApplicationStatusUpdateHandler.SyncPipelineStatusForResourceTreeCall(acdAppName, appId, envId)
731730
if err != nil {

api/restHandler/BatchOperationRestHandler_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
package restHandler
1919

2020
import (
21-
"github.com/devtron-labs/devtron/pkg/apis/devtron/v1"
2221
"testing"
22+
23+
v1 "github.com/devtron-labs/devtron/pkg/apis/devtron/v1"
2324
)
2425

2526
func Test_validatePipeline(t *testing.T) {
@@ -82,3 +83,4 @@ func Test_validatePipeline(t *testing.T) {
8283
}
8384
})
8485
}
86+
}

api/restHandler/CoreAppRestHandler.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import (
3838
chartRepoRepository "github.com/devtron-labs/devtron/pkg/chartRepo/repository"
3939
repository2 "github.com/devtron-labs/devtron/pkg/cluster/repository"
4040
"github.com/devtron-labs/devtron/pkg/pipeline"
41+
bean2 "github.com/devtron-labs/devtron/pkg/pipeline/bean"
4142
"github.com/devtron-labs/devtron/pkg/sql"
4243
"github.com/devtron-labs/devtron/pkg/team"
4344
"github.com/devtron-labs/devtron/pkg/user"
@@ -1244,7 +1245,18 @@ func (handler CoreAppRestHandlerImpl) createGitMaterials(appId int, gitMaterials
12441245
// create docker config
12451246
func (handler CoreAppRestHandlerImpl) createDockerConfig(appId int, dockerConfig *appBean.DockerConfig, userId int32) (error, int) {
12461247
handler.logger.Infow("Create App - creating docker config", "appId", appId, "DockerConfig", dockerConfig)
1247-
1248+
dockerBuildConfig := dockerConfig.DockerBuildConfig
1249+
if dockerBuildConfig != nil {
1250+
dockerConfig.CheckoutPath = dockerBuildConfig.GitCheckoutPath
1251+
dockerConfig.CiBuildConfig = &bean2.CiBuildConfigBean{
1252+
DockerBuildConfig: &bean2.DockerBuildConfig{
1253+
DockerfilePath: dockerBuildConfig.DockerfileRelativePath,
1254+
DockerBuildOptions: dockerBuildConfig.DockerBuildOptions,
1255+
Args: dockerBuildConfig.Args,
1256+
TargetPlatform: dockerBuildConfig.TargetPlatform,
1257+
},
1258+
}
1259+
}
12481260
createDockerConfigRequest := &bean.CiConfigRequest{
12491261
AppId: appId,
12501262
UserId: userId,

client/argocdServer/application/Application.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,9 @@ func (c ServiceClientImpl) ResourceTree(ctxt context.Context, query *application
394394
if app != nil {
395395
appResp, err := app.Recv()
396396
if err == nil {
397+
// https://github.com/argoproj/argo-cd/issues/11234 workaround
398+
c.updateNodeHealthStatus(resp, appResp)
399+
397400
status = string(appResp.Application.Status.Health.Status)
398401
hash = appResp.Application.Status.Sync.Revision
399402
conditions = appResp.Application.Status.Conditions
@@ -410,6 +413,36 @@ func (c ServiceClientImpl) ResourceTree(ctxt context.Context, query *application
410413
return &ResourceTreeResponse{resp, newReplicaSets, status, hash, podMetadata, conditions}, err
411414
}
412415

416+
// fill the health status in node from app resources
417+
func (c ServiceClientImpl) updateNodeHealthStatus(resp *v1alpha1.ApplicationTree, appResp *v1alpha1.ApplicationWatchEvent) {
418+
if resp == nil || len(resp.Nodes) == 0 || appResp == nil || len(appResp.Application.Status.Resources) == 0 {
419+
return
420+
}
421+
422+
for index, node := range resp.Nodes {
423+
if node.Health != nil {
424+
continue
425+
}
426+
for _, resource := range appResp.Application.Status.Resources {
427+
if node.Group != resource.Group || node.Version != resource.Version || node.Kind != resource.Kind ||
428+
node.Name != resource.Name || node.Namespace != resource.Namespace {
429+
continue
430+
}
431+
resourceHealth := resource.Health
432+
if resourceHealth != nil {
433+
node.Health = &v1alpha1.HealthStatus{
434+
Message: resourceHealth.Message,
435+
Status: resourceHealth.Status,
436+
}
437+
// updating the element in slice
438+
// https://medium.com/@xcoulon/3-ways-to-update-elements-in-a-slice-d5df54c9b2f8
439+
resp.Nodes[index] = node
440+
}
441+
break
442+
}
443+
}
444+
}
445+
413446
func (c ServiceClientImpl) buildPodMetadata(resp *v1alpha1.ApplicationTree, responses []*Result) (podMetaData []*PodMetadata, newReplicaSets []string) {
414447
rolloutManifests := make([]map[string]interface{}, 0)
415448
statefulSetManifest := make(map[string]interface{})

client/telemetry/TelemetryEventClientExtended.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ func NewTelemetryEventClientImplExtended(logger *zap.SugaredLogger, client *http
5353
ciWorkflowRepository pipelineConfig.CiWorkflowRepository, cdWorkflowRepository pipelineConfig.CdWorkflowRepository,
5454
dockerArtifactStoreRepository repository.DockerArtifactStoreRepository,
5555
materialRepository pipelineConfig.MaterialRepository, ciTemplateRepository pipelineConfig.CiTemplateRepository,
56-
chartRepository chartRepoRepository.ChartRepository, moduleRepository moduleRepo.ModuleRepository, serverDataStore *serverDataStore.ServerDataStore, userAuditService user.UserAuditService) (*TelemetryEventClientImplExtended, error) {
56+
chartRepository chartRepoRepository.ChartRepository, moduleRepository moduleRepo.ModuleRepository,
57+
serverDataStore *serverDataStore.ServerDataStore, userAuditService user.UserAuditService,
58+
ciBuildConfigService pipeline.CiBuildConfigService) (*TelemetryEventClientImplExtended, error) {
5759

5860
cron := cron.New(
5961
cron.WithChain())
@@ -72,6 +74,7 @@ func NewTelemetryEventClientImplExtended(logger *zap.SugaredLogger, client *http
7274
materialRepository: materialRepository,
7375
ciTemplateRepository: ciTemplateRepository,
7476
chartRepository: chartRepository,
77+
ciBuildConfigService: ciBuildConfigService,
7578
TelemetryEventClientImpl: &TelemetryEventClientImpl{
7679
cron: cron,
7780
logger: logger,

docs/SUMMARY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@
4444
* [Deploy a sample application](user-guide/Deploy-sample-app/nodejs_app.md)
4545
* [App Configuration](user-guide/creating-application/README.md)
4646
* [Git Repository](user-guide/creating-application/git-material.md)
47-
* [Docker Build Config](user-guide/creating-application/docker-build-configuration.md)
47+
* [Build Configuration](user-guide/creating-application/docker-build-configuration.md)
4848
* [Deployment Template](user-guide/creating-application/deployment-template.md)
4949
* [Rollout Deployment](user-guide/creating-application/deployment-template/rollout-deployment.md)
5050
* [Job and Cronjob](user-guide/creating-application/deployment-template/job-and-cronjob.md)
5151
* [Workflow Overview](user-guide/creating-application/workflow/README.md)
5252
* [CI Pipeline](user-guide/creating-application/workflow/ci-pipeline.md)
5353
* [Pre-Build/Post-Build Tasks](user-guide/creating-application/workflow/ci-build-pre-post-plugins.md)
54-
* [Override Container Registry](user-guide/creating-application/container-registry-override.md)
54+
* [Override Container Registry and Dockerfile](user-guide/creating-application/container-registry-override.md)
5555
* [CI Pipeline (Legacy)](user-guide/creating-application/workflow/ci-pipeline-legacy.md)
5656
* [CD Pipeline](user-guide/creating-application/workflow/cd-pipeline.md)
5757
* [Config Maps](user-guide/creating-application/config-maps.md)

0 commit comments

Comments
 (0)