Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
Meta PyPCC
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Operate
Environments
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
Meta PyPCC
Commits
b8381ee6
Commit
b8381ee6
authored
2 weeks ago
by
Reinder Kraaij
Browse files
Options
Downloads
Patches
Plain Diff
revert changes, move to own branch
parent
7084e0d5
No related branches found
No related tags found
2 merge requests
!15
Resolve L2SS-2305 "Add hawkbit support"
,
!4
L2SS-2305: Add Hawkbit support
Pipeline
#124532
skipped
Stage: build
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+1
-22
1 addition, 22 deletions
.gitlab-ci.yml
publish/create_software_module_with_distset.sh
+0
-118
0 additions, 118 deletions
publish/create_software_module_with_distset.sh
publish/publsh_to_hawkbit.sh
+0
-2
0 additions, 2 deletions
publish/publsh_to_hawkbit.sh
with
1 addition
and
142 deletions
.gitlab-ci.yml
+
1
−
22
View file @
b8381ee6
...
...
@@ -10,7 +10,6 @@ variables:
stages
:
-
build
-
publish
run_build
:
stage
:
build
...
...
@@ -24,23 +23,3 @@ run_build:
artifacts
:
paths
:
-
artifacts/*
\ No newline at end of file
publish_to_hawkbit
:
image
:
name
:
alpine/curl
stage
:
build
when
:
manual
environment
:
name
:
production
script
:
-
cd publish
-
chmod +x *.sh
-
./create_software_module_with_distset.sh
-
./publish_to_hawkbit.sh
This diff is collapsed.
Click to expand it.
publish/create_software_module_with_distset.sh
deleted
100644 → 0
+
0
−
118
View file @
7084e0d5
#!/bin/sh
# Default server URL
DEFAULT_SERVER
=
"https://ota.lofar.net"
SERVER
=
"
${
1
:-
$DEFAULT_SERVER
}
"
# Software module metadata
MODULE_NAME
=
"Lofar CCD and APSCT Yocto Image"
MODULE_TYPE
=
"os"
MODULE_VENDOR
=
"LOFAR"
MODULE_DESC
=
"Yocto image for Raspberry Pi"
# Distribution set metadata
DISTSET_NAME
=
"Lofar CCD and APSCT Yocto Image Distribution"
DISTSET_DESC
=
"Distribution set for CCD APSCT Raspberry Pi Yocto images"
DISTSET_TYPE
=
"os_app"
# its a full os with apps :)
# Determine version from GitLab CI or local commit
if
[
-n
"
$CI_COMMIT_TAG
"
]
;
then
MODULE_VERSION
=
"
$CI_COMMIT_TAG
"
elif
[
-n
"
$CI_COMMIT_SHORT_SHA
"
]
;
then
MODULE_VERSION
=
"dev-
${
CI_COMMIT_SHORT_SHA
}
"
else
MODULE_VERSION
=
"dev-
$(
git rev-parse
--short
HEAD
)
"
fi
echo
"Using version:
$MODULE_VERSION
"
# urlencode function using jq
urlencode
()
{
printf
'%s'
"
$1
"
| jq
-sRr
@uri
}
# 1. Check if software module exists and get its ID, using q filter
query_sm
=
"name==
\"
$MODULE_NAME
\"
;version==
\"
$MODULE_VERSION
\"
"
query_sm_enc
=
$(
urlencode
"
$query_sm
"
)
modules
=
$(
curl
-s
-u
"
$HAWKBITUSER
:
$HAWKBITPW
"
\
"
$SERVER
/rest/v1/softwaremodules?q=
$query_sm_enc
&limit=1"
)
module_id
=
$(
echo
"
$modules
"
| jq
-r
'.content[0].id // empty'
)
if
[
-n
"
$module_id
"
]
;
then
echo
"➤ Software module
\"
$MODULE_NAME
\"
version
\"
$MODULE_VERSION
\"
already exists with ID
$module_id
."
else
echo
"➤ Creating software module
\"
$MODULE_NAME
\"
version
\"
$MODULE_VERSION
\"
..."
payload
=
$(
jq
-n
\
--arg
name
"
$MODULE_NAME
"
\
--arg
version
"
$MODULE_VERSION
"
\
--arg
type
"
$MODULE_TYPE
"
\
--arg
vendor
"
$MODULE_VENDOR
"
\
--arg
desc
"
$MODULE_DESC
"
\
'{ name: $name, version: $version, type: $type, vendor: $vendor, description: $desc, encrypted: false }'
)
response
=
$(
curl
-s
-u
"
$HAWKBITUSER
:
$HAWKBITPW
"
\
-H
"Content-Type: application/json"
\
-X
POST
"
$SERVER
/rest/v1/softwaremodules"
\
-d
"[
$payload
]"
)
module_id
=
$(
echo
"
$response
"
| jq
-r
'.[0].id'
)
if
[
-z
"
$module_id
"
]
||
[
"
$module_id
"
=
"null"
]
;
then
echo
"❌ ERROR: Failed to create software module or parse module ID"
exit
1
fi
echo
"➤ Created software module with ID:
$module_id
"
fi
# 2. Check if distribution set exists and get its ID, using q filter
query_ds
=
"name==
\"
$DISTSET_NAME
\"
"
query_ds_enc
=
$(
urlencode
"
$query_ds
"
)
distsets
=
$(
curl
-s
-u
"
$HAWKBITUSER
:
$HAWKBITPW
"
\
"
$SERVER
/rest/v1/distributionsets?q=
$query_ds_enc
&limit=1"
)
#echo "$distsets"
distset_id
=
$(
echo
"
$distsets
"
| jq
-r
'.content[0]?.id // empty'
)
if
[
-n
"
$distset_id
"
]
;
then
echo
"➤ Distribution set
\"
$DISTSET_NAME
\"
already exists with ID
$distset_id
."
else
echo
"➤ Creating distribution set
\"
$DISTSET_NAME
\"
..."
# Prepare modules array with module_id converted to number inside jq
modules_array
=
$(
jq
-n
--arg
id
"
$module_id
"
'[{id: ($id|tonumber)}]'
)
distset_payload
=
$(
jq
-n
\
--arg
name
"
$DISTSET_NAME
"
\
--arg
desc
"
$DISTSET_DESC
"
\
--arg
version
"
$MODULE_VERSION
"
\
--arg
type
"
$DISTSET_TYPE
"
\
--argjson
modules
"
$modules_array
"
\
'{
name: $name,
description: $desc,
version: $version,
locked: true,
requiredMigrationStep: false,
modules: $modules,
type: $type
}'
)
#echo "$distset_payload" | jq .
response
=
$(
curl
-s
-u
"
$HAWKBITUSER
:
$HAWKBITPW
"
\
-H
"Content-Type: application/json"
\
-X
POST
"
$SERVER
/rest/v1/distributionsets"
\
-d
"[
$distset_payload
]"
)
echo
"
$response
"
distset_id
=
$(
echo
"
$response
"
| jq
-r
'.[0].id'
)
if
[
-z
"
$distset_id
"
]
||
[
"
$distset_id
"
=
"null"
]
;
then
echo
"❌ ERROR: Failed to create distribution set or parse ID"
exit
1
fi
echo
"➤ Created distribution set with ID:
$distset_id
"
fi
This diff is collapsed.
Click to expand it.
publish/publsh_to_hawkbit.sh
deleted
100644 → 0
+
0
−
2
View file @
7084e0d5
#!/bin/sh
echo
"work in progress"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment