Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
DAACDemo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Syed Bilal Raees
DAACDemo
Commits
8a9ddd42
Commit
8a9ddd42
authored
Apr 19, 2023
by
Waqas Riaz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added manual jobs to build/promote/deploy all
parent
9dcd3c7f
Pipeline
#4180
skipped with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
140 additions
and
6 deletions
+140
-6
.gitlab-ci.yml
.gitlab-ci.yml
+42
-1
build_all.sh
scripts/build_all.sh
+5
-5
deploy_all.sh
scripts/deploy_all.sh
+56
-0
promote_all_artifacts.sh
scripts/promote_all_artifacts.sh
+37
-0
No files found.
.gitlab-ci.yml
View file @
8a9ddd42
...
...
@@ -3,6 +3,9 @@ stages:
-
deploy_dashboards
-
build_alerts
-
deploy_alerts
-
manual_build_all
-
manual_promote_artifacts_all
-
manual_deploy_all
build_dashboards_job
:
stage
:
build_dashboards
...
...
@@ -76,4 +79,42 @@ deploy_alerts_job:
changes
:
-
alerts/*
tags
:
-
cd
\ No newline at end of file
-
cd
manual_build_all_job
:
stage
:
manual_build_all
before_script
:
-
curl --version
-
jsonnet --version
-
tar --version
script
:
-
echo "Manually building all jsonnets"
-
scripts/build_all.sh
tags
:
-
ci
when
:
manual
manual_promote_artifacts_all_job
:
stage
:
manual_promote_artifacts_all
before_script
:
-
curl --version
-
tar --version
script
:
-
echo "Manually promoting all artifacts to artifactory"
-
scripts/promote_all_artifacts.sh
tags
:
-
ci
when
:
manual
manual_deploy_all_job
:
stage
:
manual_deploy_all
before_script
:
-
curl --version
-
jq --version
-
tar --version
script
:
-
echo "Manually deploying all artifacts"
-
scripts/deploy_all.sh
tags
:
-
cd
when
:
manual
\ No newline at end of file
scripts/build_all.sh
View file @
8a9ddd42
...
...
@@ -15,9 +15,9 @@ function build_alerts {
mkdir
-p
${
ALERTS_BUILD_PATH
}
echo
"Cleaning up previous builds"
rm
-rf
${
ALERTS_BUILD_PATH
}
/
*
.json
rm
-rf
${
ALERTS_BUILD_PATH
}
/
*
ALERTS_JSONNETS
=
$(
find
ALERTS_JSONNET_PATH
-type
f
-name
"*.jsonnet"
| xargs
-I
{}
basename
{}
)
ALERTS_JSONNETS
=
$(
find
${
ALERTS_JSONNET_PATH
}
-type
f
-name
"*.jsonnet"
| xargs
-I
{}
basename
{}
)
for
json_file
in
${
ALERTS_JSONNETS
[@]
}
;
do
...
...
@@ -45,7 +45,7 @@ function build_dashboards {
mkdir
-p
${
DASHBOARDS_BUILD_PATH
}
echo
"Cleaning up previous builds"
rm
-rf
${
DASHBOARDS_BUILD_PATH
}
/
*
.json
rm
-rf
${
DASHBOARDS_BUILD_PATH
}
/
*
DASHBOARDS_JSONNETS
=
$(
find
${
DASHBOARDS_JSONNET_PATH
}
-type
f
-name
"*.jsonnet"
| xargs
-I
{}
basename
{}
)
...
...
@@ -65,10 +65,10 @@ function build_dashboards {
}
if
[
$1
==
"alerts"
]
;
then
if
[
[
$1
==
"alerts"
]
]
;
then
echo
"Building only alerts"
build_alerts
elif
[
$1
==
"dashboards"
]
;
then
elif
[
[
$1
==
"dashboards"
]
]
;
then
echo
"Building only dashboards"
build_dashboards
else
...
...
scripts/deploy_all.sh
0 → 100755
View file @
8a9ddd42
#!/bin/bash
TAR_NAME
=
all_artifacts
DEPLOY_DIR
=
build/
$CI_PIPELINE_ID
/
${
TAR_NAME
}
CURRENT_DIR
=
$PWD
mkdir
-p
${
CURRENT_DIR
}
/
${
DEPLOY_DIR
}
cd
${
CURRENT_DIR
}
/
${
DEPLOY_DIR
}
echo
"Cleaning up previous archives"
rm
-rf
${
CURRENT_DIR
}
/
${
DEPLOY_DIR
}
/
*
echo
"Downloading artifact from
$ARTIFACTORY_URL
/grafonet/
$CI_PIPELINE_ID
/
${
TAR_NAME
}
.tar.gz"
curl
-O
-u
$ARTIFACTORY_USER
:
$ARTIFACTORY_PASS
"
$ARTIFACTORY_URL
/grafonet/
$CI_PIPELINE_ID
/
${
TAR_NAME
}
.tar.gz"
ls
-larth
pwd
mkdir
-p
${
TAR_NAME
}
tar
-xzvf
${
TAR_NAME
}
.tar.gz
-C
${
CURRENT_DIR
}
/
${
DEPLOY_DIR
}
/
${
TAR_NAME
}
cd
${
TAR_NAME
}
ls
-larth
echo
"deploying dashboards"
cd
dashboards
for
FILE
in
*
;
do
echo
"
$FILE
\n
"
;
DASHBOARD
=
"{
\"
dashboard
\"
:
$(
jq
.
$FILE
)
,
\"
overwrite
\"
: true}"
curl
-X
POST
\
-H
"Authorization: Bearer
$TOKEN
"
\
-H
"Content-Type: application/json"
\
-d
"
$DASHBOARD
"
\
$GRAFANA_URL
/api/dashboards/db
echo
"
\n
"
done
cd
..
echo
"deploying alerts"
cd
alerts
ls
-larth
for
FILE
in
*
;
do
echo
"
$FILE
\n
"
;
PAYLOAD
=
"
$(
jq
.
$FILE
)
"
curl
-X
POST
\
-H
"Authorization: Bearer
$TOKEN
"
\
-H
"Content-Type: application/json"
\
-d
"
$PAYLOAD
"
\
$GRAFANA_URL
/api/v1/provisioning/alert-rules
echo
"
\n
"
done
cd
${
CURRENT_DIR
}
echo
"deployment completed"
\ No newline at end of file
scripts/promote_all_artifacts.sh
0 → 100755
View file @
8a9ddd42
#!/bin/bash
BUILD_PATH
=
build
TAR_NAME
=
all_artifacts
ARCHIVE_PATH
=
build/archive
CURRENT_DIR
=
$PWD
mkdir
-p
${
CURRENT_DIR
}
/
${
ARCHIVE_PATH
}
echo
"Cleaning up previous archives"
rm
-rf
${
CURRENT_DIR
}
/
${
ARCHIVE_PATH
}
/
${
TAR_NAME
}
.tar.gz
echo
"Adding dashboard files to archive"
cd
${
BUILD_PATH
}
count_file
=
`
ls
-1
dashboards/
*
.json 2>/dev/null |
wc
-l
`
echo
"
${
count_file
}
json files found at
`
pwd
`
"
if
[
$count_file
!=
0
]
then
tar
-cvzf
${
CURRENT_DIR
}
/
${
ARCHIVE_PATH
}
/
${
TAR_NAME
}
.tar.gz dashboards alerts
ls
-larth
${
CURRENT_DIR
}
/
${
ARCHIVE_PATH
}
echo
"Uploading to
$ARTIFACTORY_URL
/grafonet/
$CI_PIPELINE_ID
/
${
TAR_NAME
}
.tar.gz"
curl
-u
$ARTIFACTORY_USER
:
$ARTIFACTORY_PASS
-T
${
CURRENT_DIR
}
/
${
ARCHIVE_PATH
}
/
${
TAR_NAME
}
.tar.gz
"
$ARTIFACTORY_URL
/grafonet/
$CI_PIPELINE_ID
/
${
TAR_NAME
}
.tar.gz"
echo
"Artifact Uploaded Successfully"
else
echo
"ERROR: No json files found at
${
BUILD_PATH
}
/dashboards. Build process Failed"
ls
-larth
${
BUILD_PATH
}
/dashboards
exit
1
fi
cd
${
CURRENT_DIR
}
echo
"adding alert files to archive"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment