Commit 95345e40 authored by Nicolas Denoyelle's avatar Nicolas Denoyelle
Browse files

add checksum

parent 3c849402
......@@ -61,8 +61,6 @@ dist-artifacts:
when: on_success
only:
- tags
- master
- /v\.[0-9]+\.[0-9]+\.x/
script:
- nix-build "$ARGOPKGS" -A aml-dist --arg aml-src ./.
- echo "$CI_JOB_ID" > .cijobid
......@@ -78,7 +76,7 @@ readthedocs:
when: on_success
only:
- master
- /v\.[0-9]+\.[0-9]+\.[0-9]+/
- /v\.[0-9]+\.[0-9]+\.x/
script:
- nix run nixpkgs.curl -c curl -X POST -d "branch=$CI_COMMIT_REF_NAME" -d "token=$READTHEDOCS_TOKEN" https://readthedocs.org/api/v2/webhook/argo-aml/83161/
......@@ -87,8 +85,6 @@ dist-release:
when: on_success
only:
- tags
- master
- /v\.[0-9]+\.[0-9]+\.x/
dependencies:
- dist-artifacts
script:
......@@ -97,5 +93,6 @@ dist-release:
artifacts:
when: on_success
paths:
- result/*.tar.gz
- result/*.tar.gz
- CHECKSUM
expire_in: 1000y
......@@ -52,6 +52,7 @@ TAG=$5
RELEASE_VERSION="" # set to "latest" or "X.X.X" from $TAG
BASE_URL="https://xgitlab.cels.anl.gov/api/v4/projects"
BASE_URL="http://localhost/api/v4/projects"
URL="$BASE_URL/$PROJECT_ID"
TOKEN_HEADER="PRIVATE-TOKEN: $JOB_TOKEN"
......@@ -97,15 +98,11 @@ URL="$URL/releases"
##################################
EXTENSIONS=("tar.gz" "zip" "bz2" "bz" "tar")
ARTIFACTS_BASE_URL="https://xgitlab.cels.anl.gov/argo/aml/-/jobs/$JOB_ID/artifacts/file/result"
ARTIFACTS_BASE_URL="https://xgitlab.cels.anl.gov/argo/aml/-/jobs/$JOB_ID/artifacts/file"
ARTIFACTS_BASE_URL="http://localhost/root/aml/-/jobs/$JOB_ID/artifacts/file/result"
#Takes extension name as first argument
function artifact_name_from_ext(){
echo "aml-$RELEASE_VERSION.$1"
}
#Takes extension name as first argument
function artifact_url_from_ext(){
function exist_result_ext(){
if [ ! -d result ]; then
echo "Expected to find './result' directory containing the result of make dist." 1>&2
return
......@@ -114,21 +111,43 @@ function artifact_url_from_ext(){
for f in $(ls result); do
regex=$(echo .+.$1$)
if [ ! -z $(echo $f | grep -E $regex) ]; then
echo "$ARTIFACTS_BASE_URL/$f"
echo $f
return
fi
done
}
#Takes extension name as first argument
function artifact_name_from_ext(){
echo "aml-$RELEASE_VERSION.$1"
}
function artifact_checksum(){
sha256sum "result/$1" | cut -d " " -f 1 > CHECKSUM
echo "$ARTIFACTS_BASE_URL/CHECKSUM"
}
#Takes extension name as first argument
function artifact_url(){
echo "$ARTIFACTS_BASE_URL/result/$1"
}
function artifact_upload_from_ext(){
ART_FILENAME=$(exist_result_ext $1)
ART_NAME=$(artifact_name_from_ext $1)
ART_URL=$(artifact_url_from_ext $1)
if [ ! -z "$ART_URL" ]; then
ART_URL=$(artifact_url $ART_FILENAME)
if [ ! -z "$ART_FILENAME" ]; then
curl --header "$TOKEN_HEADER" \
--data name="$ART_NAME" \
--data url="$ART_URL" \
--request POST "$URL/$TAG/assets/links"
CHECKSUM_URL=$(artifact_checksum $ART_FILENAME)
curl --header "$TOKEN_HEADER" \
--data name="CHECKSUM" \
--data url="$CHECKSUM_URL" \
--request POST "$URL/$TAG/assets/links"
fi
}
......@@ -139,7 +158,7 @@ function artifacts_get_ids(){
function artifacts_rm_link(){
curl --header "$TOKEN_HEADER" \
--request DELETE "$URL/$TAG/assets/links/$1"
--request DELETE "$URL/$TAG/assets/links/$1"
}
function description_update(){
......@@ -176,10 +195,12 @@ function create_release(){
ARTIFACTS=""
for ext in ${EXTENSIONS[@]}; do
ART_NAME=$(artifact_name_from_ext $ext)
ART_URL=$(artifact_url_from_ext $ext)
if [ ! -z $ART_URL ]; then
ARTIFACTS="$ARTIFACTS { \"name\": \"$ART_NAME\", \"url\": \"$ART_URL\" }, "
ART_FILENAME=$(exist_result_ext $1)
ART_NAME=$(artifact_name_from_ext $1)
ART_URL=$(artifact_url $ART_FILENAME)
if [ ! -z "$ART_FILENAME" ]; then
CHECKSUM_URL=$(artifact_checksum $ART_FILENAME)
ARTIFACTS="$ARTIFACTS { \"name\": \"$ART_NAME\", \"url\": \"$ART_URL\" }, { \"name\": \"CHECKSUM\", \"url\": \"$CHECKSUM_URL\" }"
COUNT=$(($COUNT + 1))
fi
done
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment