From f907b7e072187746a3d0f9caee3e72dc60d86cf7 Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 17:32:35 +0000 Subject: [PATCH 01/21] First attempt at drone cicd migration - Created a new `.drone.yml` that will compile the Dockerfile, upload this to the Docker Registry & then use this for building. --- .drone.yml | 23 ++++++++++++++++ .gitlab-ci.yml | 73 -------------------------------------------------- 2 files changed, 23 insertions(+), 73 deletions(-) create mode 100644 .drone.yml delete mode 100644 .gitlab-ci.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 00000000..f42cfaaf --- /dev/null +++ b/.drone.yml @@ -0,0 +1,23 @@ +kind: pipeline +type: docker +name: build + +steps: + - name: build-image + image: plugins/docker + settings: + repo: t3hn3rd/asuro-build + tags: latest + dockerfile: Dockerfile + registry: t3hn3rd + username: + from_secret: docker_username + password: + from_secret: docker_password + + - name: compile + image: t3hn3rd/asuro-build:latest + depends_on: + - build-image + commands: + - /compile.sh \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 5613dcbb..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,73 +0,0 @@ -stages: - - Compile Versions - - Compile Sources - - Link - - Generate Documentation - - Deploy - -cache: - - key: ${CI_COMMIT_REF_SLUG} - paths: - - lib/*.o - - bin/kernel.bin - - doc - -before_script: - - chmod +x *.sh - -versions: - stage: Compile Versions - script: - - ./compile_vergen.sh - artifacts: - paths: - - release/*.svg - - src/include/asuro.pas - -compile_sources: - stage: Compile Sources - script: - - rm -f lib/*.so - - ./compile_sources.sh - needs: - - versions - -link: - stage: Link - script: - - ./compile_stub.sh - - ./compile_link.sh - needs: - - versions - - compile_sources - -isogen: - stage: Deploy - script: - - ./compile_isogen.sh - - ./compile_sumgen.sh - artifacts: - paths: - - ./Asuro.iso - - ./release/checksum.svg - needs: - - link - -docgen: - stage: Generate Documentation - only: - - master - - develop - script: - - ./compile_sourcelist.sh - - ./compile_docs.sh - # Remove comments when we want to use gitlab pages. - #- cp doc public - allow_failure: true - artifacts: - paths: - - doc - #- public/* - #- ./sources.list - needs: - - versions From f19444201d8ab199e2f1b80550c3c229844fdb00 Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 17:36:45 +0000 Subject: [PATCH 02/21] Updated registry to the registry server, as opposed to my username Oops. --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index f42cfaaf..a326fa93 100644 --- a/.drone.yml +++ b/.drone.yml @@ -9,7 +9,7 @@ steps: repo: t3hn3rd/asuro-build tags: latest dockerfile: Dockerfile - registry: t3hn3rd + registry: docker.io username: from_secret: docker_username password: From 9473e26b50e16e345aeb4ced00f7befccf82838f Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 17:42:06 +0000 Subject: [PATCH 03/21] Dockerfile corrections - /code already exists, don't create it in Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a366a1a9..87091a6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ RUN curl -sL https://sourceforge.net/projects/freepascal/files/Linux/$FPC_VERSIO COPY compile.sh /compile.sh ADD https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver /usr/bin/semver -RUN mkdir /code && chmod +x /usr/bin/semver +RUN chmod +x /usr/bin/semver WORKDIR /code RUN find . -type f -print0 | xargs -0 dos2unix ENTRYPOINT ["/bin/bash", "-c"] From 6a1b87e250d873be2c1445272efba3f218ea40ca Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 17:49:04 +0000 Subject: [PATCH 04/21] `.drone.yml` modifications Modified drone.yml to copy source from the /drone/src directory to the /code directory. --- .drone.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.drone.yml b/.drone.yml index a326fa93..822eff33 100644 --- a/.drone.yml +++ b/.drone.yml @@ -20,4 +20,6 @@ steps: depends_on: - build-image commands: + - cp -r /drone/src/* /code/ + - chmod +x /code/*.sh - /compile.sh \ No newline at end of file From 43464bb550e1c80f483b32157efb7ccfd5e75257 Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 18:08:28 +0000 Subject: [PATCH 05/21] Still not working Testing whether mount paths are the problem --- .drone.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 822eff33..326a0459 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,9 +17,11 @@ steps: - name: compile image: t3hn3rd/asuro-build:latest + volumes: + - name: /code + path: /drone/src depends_on: - build-image commands: - - cp -r /drone/src/* /code/ - - chmod +x /code/*.sh - - /compile.sh \ No newline at end of file + - find . -type f -print0 | xargs -0 dos2unix + - chmod +x /code/*.sh \ No newline at end of file From 8c51bd86903923d3a1eff5b67a85c74966a1864e Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 18:54:38 +0000 Subject: [PATCH 06/21] Attempts to resolve issues with missing `/code` directory Dockerfile expects `/code` attempting to resolve this in the .drone.yml --- .drone.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 326a0459..eef63b65 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,11 +17,9 @@ steps: - name: compile image: t3hn3rd/asuro-build:latest - volumes: - - name: /code - path: /drone/src depends_on: - build-image commands: + - ln -s /drone/src /code - find . -type f -print0 | xargs -0 dos2unix - chmod +x /code/*.sh \ No newline at end of file From 96fcf19c143147ed0f74c2d1bcc68323c0e79338 Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 18:59:32 +0000 Subject: [PATCH 07/21] Further updates to `.drone.yml` Still experiencing issues with not being able to find the .sh files due to missing /code directory. --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index eef63b65..95068489 100644 --- a/.drone.yml +++ b/.drone.yml @@ -20,6 +20,6 @@ steps: depends_on: - build-image commands: - - ln -s /drone/src /code - find . -type f -print0 | xargs -0 dos2unix - - chmod +x /code/*.sh \ No newline at end of file + - chmod +x /drone/src/*.sh + - /drone/src/compile.sh \ No newline at end of file From d4236f455e087bebbbdd0f5a688cb6f37c8a5141 Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 19:16:23 +0000 Subject: [PATCH 08/21] DroneCI doesn't fetch tags by default - Added `git fetch --tags` as the first command - Changes to compile_vergen.sh in order to debug. --- .drone.yml | 1 + compile_vergen.sh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.drone.yml b/.drone.yml index 95068489..663b3225 100644 --- a/.drone.yml +++ b/.drone.yml @@ -20,6 +20,7 @@ steps: depends_on: - build-image commands: + - git fetch --tags - find . -type f -print0 | xargs -0 dos2unix - chmod +x /drone/src/*.sh - /drone/src/compile.sh \ No newline at end of file diff --git a/compile_vergen.sh b/compile_vergen.sh index cb9ae513..22ece737 100644 --- a/compile_vergen.sh +++ b/compile_vergen.sh @@ -14,6 +14,8 @@ file="version" wget -q https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver -O bin/semver && chmod +x bin/semver export PATH="$(pwd)/bin:$PATH" } +pwd +ls tagref=$(git describe --tags) revision=$(git rev-parse --short=8 HEAD) major=$(semver get major $tagref) From f0dc598f4400a19c228deaed58a42dec8d40165f Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 19:39:25 +0000 Subject: [PATCH 09/21] Cleaning up compile scripts - Debugging removed from `compile_vergen.sh` - `compile.sh` modified to use a for loop for each command & only continue if previous steps succeeded. --- compile.sh | 30 ++++++++++++++++-------------- compile_vergen.sh | 2 -- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/compile.sh b/compile.sh index c55accb7..16776b1d 100755 --- a/compile.sh +++ b/compile.sh @@ -20,26 +20,28 @@ runOrFail() { fi } -runOrFail $(pwd)/compile_stub.sh "Failed to compile stub!" +declare -a run_steps=( + 'compile_stub.sh "Failed to compile stub!"' + 'compile_vergen.sh "Versions failed to compile"' + 'compile_sources.sh "Failed to compile FPC Sources!"' + 'compile_link.sh "Failed linking!"' + 'compile_isogen.sh "Failed to create ISO!"' +) -#Generate .pas with versioning headers. -runOrFail $(pwd)/compile_vergen.sh "Versions failed to compile" - -#Compile all .pas sources -runOrFail $(pwd)/compile_sources.sh "Failed to compile FPC Sources!" - -#Link into a binary. -runOrFail $(pwd)/compile_link.sh "Failed linking!" - -#Generate an ISO with GRUB as the Bootloader. -runOrFail ./compile_isogen.sh "Failed to create ISO!" +for command in "${run_steps[@]}" +do + if [ "$ERRCOUNT" -eq "0" ] + then + runOrFail $(pwd)/$command + fi +done #Call generate final artifacts based on failure or success of the above. if [ "$ERRCOUNT" -ne "0" ] then - ./compile_finish.sh "failed" + . ./compile_finish.sh "failed" else - ./compile_finish.sh "success" + . ./compile_finish.sh "success" fi cd .. \ No newline at end of file diff --git a/compile_vergen.sh b/compile_vergen.sh index 22ece737..cb9ae513 100644 --- a/compile_vergen.sh +++ b/compile_vergen.sh @@ -14,8 +14,6 @@ file="version" wget -q https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver -O bin/semver && chmod +x bin/semver export PATH="$(pwd)/bin:$PATH" } -pwd -ls tagref=$(git describe --tags) revision=$(git rev-parse --short=8 HEAD) major=$(semver get major $tagref) From 0b5981242bd2958ca7a40a03d57cfed7ec49b0a8 Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 19:44:19 +0000 Subject: [PATCH 10/21] Intentional edit to cause build failure - Intentional edit to `compile_stub.sh` in order to cause a build failure. --- compile_stub.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compile_stub.sh b/compile_stub.sh index 72c829a7..0509a3c5 100644 --- a/compile_stub.sh +++ b/compile_stub.sh @@ -4,4 +4,5 @@ echo "=======================" echo " " echo "Compiling Stub..." echo " " -nasm -f elf src/stub/stub.asm -o lib/stub.o \ No newline at end of file +nasm -f elf src/stub/stub.asm -o lib/stub.o +exit 1 \ No newline at end of file From 04cff2e2c3778d791f7b2dfcedcb8834123765db Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 19:58:24 +0000 Subject: [PATCH 11/21] Testing Succeeded - Refinement & removal of debugging code - Removed the debug `exit 1` from `compile_stub.sh` - Improved `compile.sh` to use runOrFail in a more suitable way, correctly passing through failure messages. --- compile.sh | 16 +++++++++------- compile_stub.sh | 3 +-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/compile.sh b/compile.sh index 16776b1d..a513feda 100755 --- a/compile.sh +++ b/compile.sh @@ -21,18 +21,20 @@ runOrFail() { } declare -a run_steps=( - 'compile_stub.sh "Failed to compile stub!"' - 'compile_vergen.sh "Versions failed to compile"' - 'compile_sources.sh "Failed to compile FPC Sources!"' - 'compile_link.sh "Failed linking!"' - 'compile_isogen.sh "Failed to create ISO!"' + "compile_stub.sh" "Failed to compile stub!" + "compile_vergen.sh" "Versions failed to compile" + "compile_sources.sh" "Failed to compile FPC Sources!" + "compile_link.sh" "Failed linking!" + "compile_isogen.sh" "Failed to create ISO!" ) -for command in "${run_steps[@]}" +for ((i=0; i<${#run_steps[@]}; i+=2)) do if [ "$ERRCOUNT" -eq "0" ] then - runOrFail $(pwd)/$command + script=$(pwd)/"${run_steps[$i]}" + message="${run_steps[$i+1]}" + runOrFail "$script" "$message" fi done diff --git a/compile_stub.sh b/compile_stub.sh index 0509a3c5..72c829a7 100644 --- a/compile_stub.sh +++ b/compile_stub.sh @@ -4,5 +4,4 @@ echo "=======================" echo " " echo "Compiling Stub..." echo " " -nasm -f elf src/stub/stub.asm -o lib/stub.o -exit 1 \ No newline at end of file +nasm -f elf src/stub/stub.asm -o lib/stub.o \ No newline at end of file From 738307d070b814feb379cadaa3caaf970f9495d5 Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 20:30:45 +0000 Subject: [PATCH 12/21] Testing artefact upload - Testing the upload of the resulting `Asuro.iso` to Gitea fromt the Drone pipeline. --- .drone.yml | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 663b3225..66197904 100644 --- a/.drone.yml +++ b/.drone.yml @@ -23,4 +23,36 @@ steps: - git fetch --tags - find . -type f -print0 | xargs -0 dos2unix - chmod +x /drone/src/*.sh - - /drone/src/compile.sh \ No newline at end of file + - /drone/src/compile.sh + + - name: upload-iso-artifact + image: curlimages/curl:latest + depends_on: + - compile + # when: + # branch: + # - master + environment: + GITEA_TOKEN: + from_secret: gitea_token + commands: + - export BUILD_VERSION=$(git rev-parse --short HEAD) + - export ISO_NAME="Asuro-${BUILD_VERSION}.iso" + - mv Asuro.iso "$ISO_NAME" + + # Upload commit-specific ISO + - | + echo "Uploading ${ISO_NAME} to Gitea Packages..." + curl -X POST "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/${BUILD_VERSION}" \ + -H "Authorization: token $GITEA_TOKEN" \ + -F "file=@$ISO_NAME" + + # Update the "latest" alias (delete old latest, re-upload) + - | + echo "Updating latest ISO reference..." + curl -X DELETE "https://gitea.example.com/api/packages/Spexeah/generic/asuro-iso/latest" \ + -H "Authorization: token $GITEA_TOKEN" || echo "No previous latest version found." + + curl -X POST "https://gitea.example.com/api/packages/Spexeah/generic/asuro-iso/latest" \ + -H "Authorization: token $GITEA_TOKEN" \ + -F "file=@$ISO_NAME" \ No newline at end of file From f795ba24f8837108484222d2fbf753b85b29a814 Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 20:36:19 +0000 Subject: [PATCH 13/21] Further tweaks to artefact upload step DroneCI wasn't happy with the mv of `Asuro.iso` - changed to a cp. --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 66197904..bb5d26c9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -38,7 +38,7 @@ steps: commands: - export BUILD_VERSION=$(git rev-parse --short HEAD) - export ISO_NAME="Asuro-${BUILD_VERSION}.iso" - - mv Asuro.iso "$ISO_NAME" + - cp Asuro.iso "$ISO_NAME" # Upload commit-specific ISO - | From 315050f0958340ddf95b48001aac8a006c198d0f Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 20:42:40 +0000 Subject: [PATCH 14/21] Further permission issues - Further attempts to fix permission issues within Drone when exporting the Asuro.iso artefact - Switched to `alpine/git` instead of `curl` image, as git didn't exist under the `curl` image. --- .drone.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index bb5d26c9..72b23921 100644 --- a/.drone.yml +++ b/.drone.yml @@ -26,7 +26,7 @@ steps: - /drone/src/compile.sh - name: upload-iso-artifact - image: curlimages/curl:latest + image: alpine/git depends_on: - compile # when: @@ -36,8 +36,11 @@ steps: GITEA_TOKEN: from_secret: gitea_token commands: + - apk add --no-cache curl - export BUILD_VERSION=$(git rev-parse --short HEAD) - export ISO_NAME="Asuro-${BUILD_VERSION}.iso" + - ls -lah + - chmod +w Asuro.iso - cp Asuro.iso "$ISO_NAME" # Upload commit-specific ISO From 5e6e6c394a53f4b6369206aca8b4e1825d159c41 Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 21:18:49 +0000 Subject: [PATCH 15/21] Debugging & Testing - Mistakes made in the curl methods used & the curl upload-file flag - rectified. --- .drone.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index 72b23921..9e56b6d0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -46,16 +46,16 @@ steps: # Upload commit-specific ISO - | echo "Uploading ${ISO_NAME} to Gitea Packages..." - curl -X POST "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/${BUILD_VERSION}" \ + curl -X PUT "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/${BUILD_VERSION}/Asuro.iso" \ -H "Authorization: token $GITEA_TOKEN" \ - -F "file=@$ISO_NAME" + --upload-file $ISO_NAME # Update the "latest" alias (delete old latest, re-upload) - | echo "Updating latest ISO reference..." - curl -X DELETE "https://gitea.example.com/api/packages/Spexeah/generic/asuro-iso/latest" \ + curl -X DELETE "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso" \ -H "Authorization: token $GITEA_TOKEN" || echo "No previous latest version found." - curl -X POST "https://gitea.example.com/api/packages/Spexeah/generic/asuro-iso/latest" \ + curl -X POST "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso" \ -H "Authorization: token $GITEA_TOKEN" \ - -F "file=@$ISO_NAME" \ No newline at end of file + --upload-file $ISO_NAME \ No newline at end of file From 2906b8724b5b6c12238c3249c94ebda6c80d1eaa Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 21:45:29 +0000 Subject: [PATCH 16/21] Exports don't persist between commands - Exports don't persist between commands in Drone commands - removed these exports and made more verbose commands. --- .drone.yml | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/.drone.yml b/.drone.yml index 9e56b6d0..cf941a82 100644 --- a/.drone.yml +++ b/.drone.yml @@ -37,25 +37,10 @@ steps: from_secret: gitea_token commands: - apk add --no-cache curl - - export BUILD_VERSION=$(git rev-parse --short HEAD) - - export ISO_NAME="Asuro-${BUILD_VERSION}.iso" - - ls -lah - - chmod +w Asuro.iso - - cp Asuro.iso "$ISO_NAME" - - # Upload commit-specific ISO - - | - echo "Uploading ${ISO_NAME} to Gitea Packages..." - curl -X PUT "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/${BUILD_VERSION}/Asuro.iso" \ - -H "Authorization: token $GITEA_TOKEN" \ - --upload-file $ISO_NAME - - # Update the "latest" alias (delete old latest, re-upload) - - | - echo "Updating latest ISO reference..." - curl -X DELETE "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso" \ - -H "Authorization: token $GITEA_TOKEN" || echo "No previous latest version found." - - curl -X POST "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso" \ - -H "Authorization: token $GITEA_TOKEN" \ - --upload-file $ISO_NAME \ No newline at end of file + - chmod +w Asuro.iso + - cp Asuro.iso "Asuro-$(git rev-parse --short HEAD).iso" + - echo "Uploading Asuro-$(git rev-parse --short HEAD).iso to Gitea Packages..." + - curl -X PUT "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/$(git rev-parse --short HEAD)/Asuro.iso" -H "Authorization: token $GITEA_TOKEN" --upload-file "Asuro-$(git rev-parse --short HEAD).iso" + - echo "Updating latest ISO reference..." + - curl -X DELETE "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso" -H "Authorization: token $GITEA_TOKEN" || echo "No previous latest version found." + - curl -X PUT "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso" -H "Authorization: token $GITEA_TOKEN" --upload-file "Asuro-$(git rev-parse --short HEAD).iso" \ No newline at end of file From d1a4b4d42f5f7ffec09b74bb31146663c972f962 Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 21:57:19 +0000 Subject: [PATCH 17/21] Another attempt - issues with YAML layout for some reason --- .drone.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index cf941a82..baae6808 100644 --- a/.drone.yml +++ b/.drone.yml @@ -38,9 +38,10 @@ steps: commands: - apk add --no-cache curl - chmod +w Asuro.iso - - cp Asuro.iso "Asuro-$(git rev-parse --short HEAD).iso" - - echo "Uploading Asuro-$(git rev-parse --short HEAD).iso to Gitea Packages..." - - curl -X PUT "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/$(git rev-parse --short HEAD)/Asuro.iso" -H "Authorization: token $GITEA_TOKEN" --upload-file "Asuro-$(git rev-parse --short HEAD).iso" + - git rev-parse --short HEAD > commit_hash.txt + - COMMIT_HASH=$(cat commit_hash.txt) && cp Asuro.iso "Asuro-${COMMIT_HASH}.iso" + - COMMIT_HASH=$(cat commit_hash.txt) && echo "Uploading Asuro-${COMMIT_HASH}.iso to Gitea Packages..." + - COMMIT_HASH=$(cat commit_hash.txt) && curl -X PUT "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/${COMMIT_HASH}/Asuro.iso" -H "Authorization: token $GITEA_TOKEN" --upload-file "Asuro-${COMMIT_HASH}.iso" - echo "Updating latest ISO reference..." - - curl -X DELETE "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso" -H "Authorization: token $GITEA_TOKEN" || echo "No previous latest version found." - - curl -X PUT "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso" -H "Authorization: token $GITEA_TOKEN" --upload-file "Asuro-$(git rev-parse --short HEAD).iso" \ No newline at end of file + - curl -X DELETE https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso -H "Authorization: token $GITEA_TOKEN" || echo "No previous latest version found." + - COMMIT_HASH=$(cat commit_hash.txt) && curl -X PUT https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso -H "Authorization: token $GITEA_TOKEN" --upload-file "Asuro-${COMMIT_HASH}.iso" \ No newline at end of file From 0913daebc6d8c77f5044cc90dc872835e74ab9b5 Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 22:01:55 +0000 Subject: [PATCH 18/21] Still experiencing YAML errors, for some reason. --- .drone.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index baae6808..fba20248 100644 --- a/.drone.yml +++ b/.drone.yml @@ -41,7 +41,17 @@ steps: - git rev-parse --short HEAD > commit_hash.txt - COMMIT_HASH=$(cat commit_hash.txt) && cp Asuro.iso "Asuro-${COMMIT_HASH}.iso" - COMMIT_HASH=$(cat commit_hash.txt) && echo "Uploading Asuro-${COMMIT_HASH}.iso to Gitea Packages..." - - COMMIT_HASH=$(cat commit_hash.txt) && curl -X PUT "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/${COMMIT_HASH}/Asuro.iso" -H "Authorization: token $GITEA_TOKEN" --upload-file "Asuro-${COMMIT_HASH}.iso" + - | + COMMIT_HASH=$(cat commit_hash.txt) && \ + curl -X PUT "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/${COMMIT_HASH}/Asuro.iso" \ + -H 'Authorization: token $GITEA_TOKEN' \ + --upload-file "Asuro-${COMMIT_HASH}.iso" - echo "Updating latest ISO reference..." - - curl -X DELETE https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso -H "Authorization: token $GITEA_TOKEN" || echo "No previous latest version found." - - COMMIT_HASH=$(cat commit_hash.txt) && curl -X PUT https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso -H "Authorization: token $GITEA_TOKEN" --upload-file "Asuro-${COMMIT_HASH}.iso" \ No newline at end of file + - | + curl -X DELETE https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso + -H "Authorization: token $GITEA_TOKEN" || echo "No previous latest version found." + - | + COMMIT_HASH=$(cat commit_hash.txt) && \ + curl -X PUT https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso \ + -H "Authorization: token $GITEA_TOKEN" \ + --upload-file "Asuro-${COMMIT_HASH}.iso" \ No newline at end of file From f1211f3ccaf2715035f71ebdc01ead7a7976b985 Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 22:08:18 +0000 Subject: [PATCH 19/21] Slowly making progress - YAML is now valid - however, the attempt to temp store the revision number failed. Doing it inline instead. --- .drone.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.drone.yml b/.drone.yml index fba20248..2cba37e6 100644 --- a/.drone.yml +++ b/.drone.yml @@ -38,20 +38,17 @@ steps: commands: - apk add --no-cache curl - chmod +w Asuro.iso - - git rev-parse --short HEAD > commit_hash.txt - - COMMIT_HASH=$(cat commit_hash.txt) && cp Asuro.iso "Asuro-${COMMIT_HASH}.iso" - - COMMIT_HASH=$(cat commit_hash.txt) && echo "Uploading Asuro-${COMMIT_HASH}.iso to Gitea Packages..." + - cp Asuro.iso "Asuro-$(git rev-parse --short HEAD).iso" + - echo "Uploading Asuro-$(git rev-parse --short HEAD).iso to Gitea Packages..." - | - COMMIT_HASH=$(cat commit_hash.txt) && \ - curl -X PUT "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/${COMMIT_HASH}/Asuro.iso" \ + curl -X PUT "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/$(git rev-parse --short HEAD)/Asuro.iso" \ -H 'Authorization: token $GITEA_TOKEN' \ - --upload-file "Asuro-${COMMIT_HASH}.iso" + --upload-file "Asuro-$(git rev-parse --short HEAD).iso" - echo "Updating latest ISO reference..." - | curl -X DELETE https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso -H "Authorization: token $GITEA_TOKEN" || echo "No previous latest version found." - | - COMMIT_HASH=$(cat commit_hash.txt) && \ curl -X PUT https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso \ -H "Authorization: token $GITEA_TOKEN" \ - --upload-file "Asuro-${COMMIT_HASH}.iso" \ No newline at end of file + --upload-file "Asuro-$(git rev-parse --short HEAD).iso" \ No newline at end of file From 6bca42f2a58583b90d857db44654b2150c9afac1 Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 22:18:19 +0000 Subject: [PATCH 20/21] Final Test before finalizing - Single quotes were causing the first CURL to fail. - This should be the penultimate commit before ready to progress through dev to master. --- .drone.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index 2cba37e6..a5c5811f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -42,13 +42,11 @@ steps: - echo "Uploading Asuro-$(git rev-parse --short HEAD).iso to Gitea Packages..." - | curl -X PUT "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/$(git rev-parse --short HEAD)/Asuro.iso" \ - -H 'Authorization: token $GITEA_TOKEN' \ - --upload-file "Asuro-$(git rev-parse --short HEAD).iso" + -H "Authorization: token $GITEA_TOKEN" --upload-file "Asuro-$(git rev-parse --short HEAD).iso" - echo "Updating latest ISO reference..." - | - curl -X DELETE https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso + curl -X DELETE https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso \ -H "Authorization: token $GITEA_TOKEN" || echo "No previous latest version found." - | curl -X PUT https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso \ - -H "Authorization: token $GITEA_TOKEN" \ - --upload-file "Asuro-$(git rev-parse --short HEAD).iso" \ No newline at end of file + -H "Authorization: token $GITEA_TOKEN" --upload-file "Asuro-$(git rev-parse --short HEAD).iso" \ No newline at end of file From b47194ed99d525382a772805194457880ff747ce Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sun, 9 Mar 2025 22:25:08 +0000 Subject: [PATCH 21/21] Final commit to merge through develop & master - CI/CD Pipeline now working & tested. - Commits to all branches will trigger the pipeline in DroneCI. - Commits to master will trigger the resulting ISO artefact to be uploaded to Gitea as a Package. --- .drone.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index a5c5811f..f868f1a8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -29,9 +29,9 @@ steps: image: alpine/git depends_on: - compile - # when: - # branch: - # - master + when: + branch: + - master environment: GITEA_TOKEN: from_secret: gitea_token