Skip to content

Commit 64992b4

Browse files
authored
Merge pull request #141 from Dasharo/ci_fix
workflows: get DTS_VER from tag not dts-distro.conf
2 parents c660641 + d70e669 commit 64992b4

File tree

2 files changed

+40
-12
lines changed

2 files changed

+40
-12
lines changed

.github/workflows/ci.yml

+20-6
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,26 @@ jobs:
6666
id: dts-ver
6767
shell: bash
6868
run: |
69-
DTS_VER=v`cat meta-dts/meta-dts-distro/conf/distro/dts-distro.conf | grep DISTRO_VERSION | tr -d "\" [A-Z]_="`
70-
echo "DTS_VER=${DTS_VER}" >> $GITHUB_OUTPUT
69+
# Extract tag version from GITHUB_REF
70+
TAG=${GITHUB_REF#refs/tags/}
71+
DTS_VER=$(echo "${TAG}" | sed -E 's/^v//')
72+
echo "DTS_VER=${DTS_VER}" >> $GITHUB_ENV
73+
- name: Validate DTS_VER
74+
if: ${{ success() }}
75+
shell: bash
76+
run: |
77+
# Retrieve DTS_VER from previous step
78+
DTS_VER_EXPECTED="${{ env.DTS_VER }}"
79+
DTS_VER_ACTUAL=$(cat meta-dts/meta-dts-distro/conf/distro/dts-distro.conf | grep DISTRO_VERSION | tr -d "\" [A-Z]_=")
80+
81+
if [ "${DTS_VER_EXPECTED}" != "${DTS_VER_ACTUAL}" ]; then
82+
echo "Tag (${DTS_VER_EXPECTED}) does not match version (${DTS_VER_ACTUAL}) in `meta-dts/meta-dts-distro/conf/distro/dts-distro.conf`"
83+
exit 1
84+
fi
7185
- name: Deploy DTS on boot.dasharo.com
7286
shell: bash
7387
run: |
74-
DTS_VER="${{steps.dts-ver.outputs.DTS_VER}}"
88+
DTS_VER="${{ env.DTS_VER }}"
7589
ssh -i ~/.ssh/dts-ci-key builder@10.1.40.2 "mkdir -p boot/dts/${DTS_VER}"
7690
cd build/tmp/deploy/images/genericx86-64/
7791
cp bzImage bzImage-${DTS_VER}
@@ -91,7 +105,7 @@ jobs:
91105
- name: Deploy sha256 on boot.dasharo.com
92106
shell: bash
93107
run: |
94-
DTS_VER="${{steps.dts-ver.outputs.DTS_VER}}"
108+
DTS_VER="${{ env.DTS_VER }}"
95109
cd build/tmp/deploy/images/genericx86-64/
96110
sha256sum bzImage-${DTS_VER} > bzImage-${DTS_VER}.sha256
97111
sha256sum dts-base-image-${DTS_VER}.cpio.gz > dts-base-image-${DTS_VER}.cpio.gz.sha256
@@ -110,12 +124,12 @@ jobs:
110124
- name: Update iPXE menu
111125
shell: bash
112126
run: |
113-
./meta-dts/scripts/generate-ipxe-menu.sh ${{steps.dts-ver.outputs.DTS_VER}}
127+
./meta-dts/scripts/generate-ipxe-menu.sh ${{ env.DTS_VER }}
114128
scp -i ~/.ssh/dts-ci-key dts.ipxe builder@10.1.40.2:boot/dts/
115129
- name: Trigger signing
116130
shell: bash
117131
run: |
118-
DTS_VER="${{steps.dts-ver.outputs.DTS_VER}}"
132+
DTS_VER="${{ env.DTS_VER }}"
119133
git clone ssh://git@git.3mdeb.com:2222/3mdeb/dts-release-cicd-pipeline.git
120134
cd dts-release-cicd-pipeline
121135
echo ${DTS_VER} > LATEST_RELEASE

.github/workflows/develop.yml

+20-6
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,26 @@ jobs:
6565
id: dts-ver
6666
shell: bash
6767
run: |
68-
DTS_VER=v`cat meta-dts/meta-dts-distro/conf/distro/dts-distro.conf | grep DISTRO_VERSION | tr -d "\" [A-Z]_="`
69-
echo "DTS_VER=${DTS_VER}" >> $GITHUB_OUTPUT
68+
# Extract tag version from GITHUB_REF
69+
TAG=${GITHUB_REF#refs/tags/}
70+
DTS_VER=$(echo "${TAG}" | sed -E 's/^v//')
71+
echo "DTS_VER=${DTS_VER}" >> $GITHUB_ENV
72+
- name: Validate DTS_VER
73+
if: ${{ success() }}
74+
shell: bash
75+
run: |
76+
# Retrieve DTS_VER from previous step
77+
DTS_VER_EXPECTED="${{ env.DTS_VER }}"
78+
DTS_VER_ACTUAL=$(cat meta-dts/meta-dts-distro/conf/distro/dts-distro.conf | grep DISTRO_VERSION | tr -d "\" [A-Z]_=")
79+
80+
if [ "${DTS_VER_EXPECTED}" != "${DTS_VER_ACTUAL}" ]; then
81+
echo "Tag (${DTS_VER_EXPECTED}) does not match version (${DTS_VER_ACTUAL}) in `meta-dts/meta-dts-distro/conf/distro/dts-distro.conf`"
82+
exit 1
83+
fi
7084
- name: Deploy DTS on boot.dasharo.com
7185
shell: bash
7286
run: |
73-
DTS_VER="${{steps.dts-ver.outputs.DTS_VER}}"
87+
DTS_VER="${{ env.DTS_VER }}"
7488
ssh -i ~/.ssh/dts-ci-key builder@10.1.40.2 "mkdir -p boot/dts/${DTS_VER}"
7589
cd build/tmp/deploy/images/genericx86-64/
7690
cp bzImage bzImage-${DTS_VER}
@@ -86,7 +100,7 @@ jobs:
86100
- name: Deploy sha256 on boot.dasharo.com
87101
shell: bash
88102
run: |
89-
DTS_VER="${{steps.dts-ver.outputs.DTS_VER}}"
103+
DTS_VER="${{ env.DTS_VER }}"
90104
cd build/tmp/deploy/images/genericx86-64/
91105
sha256sum bzImage-${DTS_VER} > bzImage-${DTS_VER}.sha256
92106
sha256sum dts-base-image-${DTS_VER}.cpio.gz > dts-base-image-${DTS_VER}.cpio.gz.sha256
@@ -101,12 +115,12 @@ jobs:
101115
- name: Update iPXE menu
102116
shell: bash
103117
run: |
104-
./meta-dts/scripts/generate-ipxe-menu.sh ${{steps.dts-ver.outputs.DTS_VER}}
118+
./meta-dts/scripts/generate-ipxe-menu.sh DTS_VER="${{ env.DTS_VER }}"
105119
scp -i ~/.ssh/dts-ci-key dts-rc.ipxe builder@10.1.40.2:boot/dts/
106120
- name: Trigger signing
107121
shell: bash
108122
run: |
109-
DTS_VER="${{steps.dts-ver.outputs.DTS_VER}}"
123+
DTS_VER="${{ env.DTS_VER }}"
110124
git clone ssh://git@git.3mdeb.com:2222/3mdeb/dts-release-cicd-pipeline.git
111125
cd dts-release-cicd-pipeline
112126
echo ${DTS_VER} > LATEST_RELEASE

0 commit comments

Comments
 (0)