Skip to content

Commit 46c3b29

Browse files
authored
Shell updates + Binary attach for release (#124)
* Updated shell type * Added binary attach logic * updated download action * updated binary attach action * Removed unused code
1 parent 3feb898 commit 46c3b29

File tree

2 files changed

+55
-20
lines changed

2 files changed

+55
-20
lines changed

.github/workflows/csm-release-driver-module.yaml

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,26 @@ jobs:
4141
echo "Building binaries to attach to the release if any..."
4242
if "${{ inputs.images == 'cert-csi' }}"; then
4343
make build
44+
mv cert-csi cert-csi-linux-amd64
45+
echo "BIN_NAME=cert-csi-linux-amd64" >> $GITHUB_ENV
4446
fi
4547
if "${{ contains(inputs.images, 'dell-csi-replicator') || contains(inputs.images, 'dell-replication-controller') }}"; then
46-
cd repctl && make build
48+
cd repctl
49+
make build
50+
mv repctl repctl-linux-amd64
51+
mv repctl-linux-amd64 ../
52+
echo "BIN_NAME=repctl-linux-amd64" >> $GITHUB_ENV
4753
fi
4854
55+
- name: Upload Binaries
56+
if: ${{ env.BIN_NAME != '' }}
57+
uses: actions/[email protected]
58+
env:
59+
BIN_NAME: ${{ env.BIN_NAME }}
60+
with:
61+
name: ${{ env.BIN_NAME }}
62+
path: ${{ env.BIN_NAME }}
63+
4964
release-and-tag:
5065
name: Tag and Release
5166
needs: build-and-scan
@@ -63,6 +78,7 @@ jobs:
6378
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
6479

6580
- name: Push images to Dockerhub
81+
shell: bash
6682
run: |
6783
# Push each comma seperated images by splitting the string with ','
6884
images_list=$(echo '${{ inputs.images }}' | tr -d '[]"' | tr ',' ' ')
@@ -98,12 +114,16 @@ jobs:
98114
done
99115
100116
- name: Push images to Quay.io
117+
shell: bash
101118
run: |
102119
# Push each comma seperated images by splitting the string with ','
103120
images_list=$(echo '${{ inputs.images }}' | tr -d '[]"' | tr ',' ' ')
121+
122+
REPOSITORY="dell/container-storage-modules"
123+
104124
for image in $images_list; do
105125
106-
latest_version=$(curl -s https://quay.io/api/v1/repository/dell/container-storage-modules/$image/tag/?limit=100 | jq -r '.tags[].name' | sort -V | tail -n 1)
126+
latest_version=$(curl -s https://quay.io/api/v1/repository/$REPOSITORY/$image/tag/?limit=100 | jq -r '.tags[].name' | sort -V | tail -n 1)
107127
echo "Current latest version of $image:$latest_version"
108128
109129
IFS='.' read -r -a version_parts <<< "$latest_version"
@@ -123,23 +143,23 @@ jobs:
123143
version_parts[2]=$(expr ${version_parts[2]} + 1)
124144
new_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}"
125145
fi
126-
repository='dell/container-storage-modules'
146+
127147
# Get manifest digest
128-
SHA=$(curl -s --location --request GET 'https://quay.io/api/v1/repository/$repository/$image/tag?specificTag=nightly' --header 'Content-Type: application/json' --header 'Authorization: Bearer ${{ secrets.QUAY_API_TOKEN }}' | jq -r '.tags[0].manifest_digest')
129-
130-
echo "Pushing image: $image:$new_version"
148+
SHA=$(curl -s --location --request GET https://quay.io/api/v1/repository/$REPOSITORY/$image/tag?specificTag=nightly --header 'Content-Type: application/json' --header 'Authorization: Bearer ${{ secrets.QUAY_API_TOKEN }}' | jq -r '.tags[0].manifest_digest')
149+
echo "Pushing image: $image:$new_version"
131150
132-
# Create version and latest tags
133-
curl -s --location --request PUT 'https://quay.io/api/v1/repository/$repository/$image/tag/$new_version' \
134-
--header 'Content-Type: application/json' \
135-
--header 'Authorization: Bearer ${{ secrets.QUAY_API_TOKEN }}' \
136-
--data-raw '{
137-
"manifest_digest": "$SHA"
138-
}'
139-
curl -s --location --request PUT 'https://quay.io/api/v1/repository/$repository/$image/tag/latest' \
140-
--header 'Content-Type: application/json' \
141-
--header 'Authorization: Bearer ${{ secrets.QUAY_API_TOKEN }}' \
142-
--data-raw '{
143-
"manifest_digest": "$SHA"
144-
}'
151+
# Create version and latest tags
152+
curl --location --request PUT https://quay.io/api/v1/repository/$REPOSITORY/$image/tag/$new_version \
153+
--header 'Content-Type: application/json' \
154+
--header 'Authorization: Bearer ${{ secrets.QUAY_API_TOKEN }}' \
155+
--data-raw '{
156+
"manifest_digest": "'"$SHA"'"
157+
}'
158+
159+
curl --location --request PUT https://quay.io/api/v1/repository/$REPOSITORY/$image/tag/latest \
160+
--header 'Content-Type: application/json' \
161+
--header 'Authorization: Bearer ${{ secrets.QUAY_API_TOKEN }}' \
162+
--data-raw '{
163+
"manifest_digest": "'"$SHA"'"
164+
}'
145165
done

.github/workflows/release-creator.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,20 @@ jobs:
7878
run: |
7979
echo "new version to be released:$REL_VERSION"
8080
git tag -s -a $REL_VERSION -m "Release $REL_VERSION"
81-
git push origin $REL_VERSION
81+
git push origin $REL_VERSION
82+
83+
- name: Download binary
84+
uses: actions/[email protected]
85+
86+
# This is required to check if the binary exists and update its name to the release.
87+
- run: |
88+
FILE="./cert-csi-linux-amd64/cert-csi-linux-amd64"
89+
if [ -d "repctl-linux-amd64" ]; then
90+
FILE="./repctl-linux-amd64/repctl-linux-amd64"
91+
fi
92+
echo "File name: $FILE"
93+
echo "FILE_NAME=$FILE" >> $GITHUB_ENV
94+
shell: bash
8295
8396
- name: Create Release
8497
uses: softprops/action-gh-release@v2
@@ -89,9 +102,11 @@ jobs:
89102
prerelease: false
90103
generate_release_notes: true
91104
make_latest: true
105+
files: ${{ env.FILE_NAME }}
92106
env:
93107
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94108
REL_VERSION: ${{ env.REL_VERSION }}
109+
FILE_NAME: ${{ env.FILE_NAME }}
95110

96111
- name: Create release branch
97112
env:

0 commit comments

Comments
 (0)