diff --git a/.ci/get_test_matrix.sh b/.ci/get_test_matrix.sh index c8ff40b3f3..feafaece18 100755 --- a/.ci/get_test_matrix.sh +++ b/.ci/get_test_matrix.sh @@ -3,7 +3,7 @@ set -e trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG -trap 'echo "$0: \"${last_command}\" command failed with exit code $?, log:" && cat /tmp/log.txt' ERR +trap 'echo "$0: \"${last_command}\" command failed with exit code $?' ERR DEBUG=false diff --git a/.ci/merge_push_to_release.sh b/.ci/merge_push_to_release.sh new file mode 100755 index 0000000000..50e56c6c82 --- /dev/null +++ b/.ci/merge_push_to_release.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +set -e + +trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG +trap 'echo "$0: \"${last_command}\" command failed with exit code $?' ERR + +ARCH=amd64 +LOCATION=/tmp/git + +REPOS=$(./.ci/parse_yaml.py mrs.yaml $ARCH) + +REPOS="$REPOS +$(./.ci/parse_yaml.py thirdparty.yaml $ARCH)" + +REPOS="$REPOS +$(./.ci/parse_yaml.py nonbloom.yaml $ARCH)" + +[ -e $LOCATION ] && rm -rf $LOCATION || echo "$0: nothing to delete" +mkdir -p $LOCATION + +cd $LOCATION + +# clone and checkout +echo "$REPOS" | while IFS= read -r REPO; do + + echo "Cloning $REPO" + + PACKAGE=$(echo "$REPO" | awk '{print $1}') + URL=$(echo "$REPO" | awk '{print $2}') + + # strip the https from the url + URL=$(echo $URL | sed -r 's|https://(.+)|\1|' | head -n 1) + + RELEASE_BRANCH=$(echo "$REPO" | awk '{print $3}') + TESTING_BRANCH=$(echo "$REPO" | awk '{print $4}') + + echo "$0: cloning '$URL --branch $RELEASE_BRANCH' into '$PACKAGE'" + [ ! -e $PACKAGE ] && git clone https://$PUSH_TOKEN@$URL --branch $RELEASE_BRANCH $PACKAGE + + echo "" + +done + +echo "$0: Done cloning" +echo "$0: Going to merge and dry-run the push" + +# merge and try dry-run push +echo "$REPOS" | while IFS= read -r REPO; do + + PACKAGE=$(echo "$REPO" | awk '{print $1}') + TESTING_BRANCH=$(echo "$REPO" | awk '{print $4}') + + echo "$0: going to merge $PACKAGE" + + cd $LOCATION/$PACKAGE + + git merge origin/$TESTING_BRANCH + + git push --dry-run + + echo "" + +done + +echo "$0: Done merging" +echo "$0: Going to push" + +# merge and try dry-run push +echo "$REPOS" | while IFS= read -r REPO; do + + PACKAGE=$(echo "$REPO" | awk '{print $1}') + TESTING_BRANCH=$(echo "$REPO" | awk '{print $4}') + + echo "$0: going to push $PACKAGE" + + cd $LOCATION/$PACKAGE + + git push + + echo "" + +done + +echo "$0: Done pushing" diff --git a/.github/workflows/rostest.yml b/.github/workflows/rostest_and_merge.yml similarity index 76% rename from .github/workflows/rostest.yml rename to .github/workflows/rostest_and_merge.yml index b3d5f5e6e8..63d738aad4 100644 --- a/.github/workflows/rostest.yml +++ b/.github/workflows/rostest_and_merge.yml @@ -3,11 +3,8 @@ name: rostest on: workflow_dispatch: - push: - branches: [ testing ] - - # schedule: - # - cron: '0 20 * * *' # every day at 10pm UTC+2 + schedule: + - cron: '0 5 * * *' # every day at 7am UTC+2 concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -51,7 +48,7 @@ jobs: run: | .ci/test.sh "${{ matrix.job }}" - merge: + merge_and_push: runs-on: ubuntu-20.04 needs: build-job env: @@ -61,12 +58,6 @@ jobs: with: fetch-depth: 0 submodules: 'recursive' - - name: Checkout CI scripts - uses: actions/checkout@v3 - with: - repository: ctu-mrs/ci_scripts - ref: master - path: .ci_scripts - token: ${{ secrets.PUSH_TOKEN }} - - name: Merge - run: echo "Merging release_candidate to release" + - id: merge + run: | + .ci/merge_push_to_release.sh