Skip to content

Commit 044ed0d

Browse files
committed
added checking of docker image
1 parent da82d57 commit 044ed0d

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

.github/workflows/build_backend.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,11 @@ jobs:
137137
run: |
138138
bash ./buildscripts/ci/backend/publish_to_registry.sh --token ${{ secrets.PACKAGES_PAT }}
139139
140-
- name: Deploy to musescore.com
140+
- name: Check and update config on S3
141141
if: env.DO_DEPLOY == 'true'
142142
run: |
143-
bash ./buildscripts/ci/backend/update_config_on_s3.sh \
143+
bash ./buildscripts/ci/backend/check_update_config_on_s3.sh \
144+
--token ${{ secrets.PACKAGES_PAT }} \
144145
--s3_key ${{ secrets.S3_KEY_CONVERTER }} \
145146
--s3_secret ${{ secrets.S3_SECRET_CONVERTER }} \
146147
--stage ${{ inputs.build_mode }} \

buildscripts/ci/backend/update_config_on_s3.sh renamed to buildscripts/ci/backend/check_update_config_on_s3.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
# You should have received a copy of the GNU General Public License
2020
# along with this program. If not, see <https://www.gnu.org/licenses/>.
2121

22+
trap 'echo Check and update config failed; exit 1' ERR
23+
24+
ACCESS_USER="igorkorsukov" # For test, should be replaced with muse-bot
25+
ACCESS_TOKEN=$GITHUB_TOKEN
2226
S3_KEY=""
2327
S3_SECRET=""
2428
S3_URL="s3://convertor.musescore.org"
@@ -30,6 +34,8 @@ MU_VERSION_MAJOR_MINOR=""
3034

3135
while [[ "$#" -gt 0 ]]; do
3236
case $1 in
37+
-t|--token) ACCESS_TOKEN="$2"; shift ;;
38+
-u|--user) ACCESS_USER="$2"; shift ;;
3339
--s3_key) S3_KEY="$2"; shift ;;
3440
--s3_secret) S3_SECRET="$2"; shift ;;
3541
--stage) STAGE="$2"; shift ;;
@@ -40,6 +46,27 @@ while [[ "$#" -gt 0 ]]; do
4046
shift
4147
done
4248

49+
# Check
50+
echo "Login Docker"
51+
echo $ACCESS_TOKEN | docker login ghcr.io -u $ACCESS_USER --password-stdin
52+
53+
echo "Pull Docker"
54+
docker pull ghcr.io/musescore/converter_4:${MU_VERSION}
55+
56+
echo "Check version..."
57+
docker run ghcr.io/musescore/converter_4:${MU_VERSION} /musescore/convertor -v > $ARTIFACTS_DIR/conv_output.txt
58+
59+
APP_VERSION=$(echo "$MU_VERSION" | cut -d '.' -f 1,2,3)
60+
CONV_OUT=$(cat $ARTIFACTS_DIR/conv_output.txt)
61+
if [[ "$CONV_OUT" == *"$APP_VERSION" ]]; then
62+
echo "The test was successful, convertor output: $CONV_OUT, version: $APP_VERSION"
63+
else
64+
echo "The test failed, convertor output: $CONV_OUT, version: $APP_VERSION"
65+
exit 1
66+
fi
67+
68+
echo "Update config..."
69+
4370
bash ./buildscripts/ci/tools/s3_install.sh --s3_key ${S3_KEY} --s3_secret ${S3_SECRET}
4471

4572
if [ -z "$ARTIFACT_PATH" ]; then

0 commit comments

Comments
 (0)