-
Notifications
You must be signed in to change notification settings - Fork 14
83 lines (77 loc) · 2.95 KB
/
gitlab.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: GitLab
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
trigger-ros:
runs-on: ubuntu-latest
steps:
- name: Trigger pipeline
run: |
curl --silent --fail --request POST --form "token=${{ secrets.DOCKER_ROS_CI_TRIGGER_GITLAB_TOKEN }}" --form "ref=main" --form "variables[DOCKER_ROS_GIT_REF]=${{ github.sha }}" "https://gitlab.ika.rwth-aachen.de/api/v4/projects/1886/trigger/pipeline" | jq -r .id > id
- name: Upload pipeline ID
uses: actions/upload-artifact@v4
with:
name: id_ros
path: id
watch-ros:
runs-on: ubuntu-latest
needs: trigger-ros
steps:
- name: Get pipeline ID
uses: actions/download-artifact@v4
with:
name: id_ros
- name: Wait for pipeline completion
run: |
PIPELINE_ID=$(cat id)
while true; do
sleep 30
PIPELINE_STATUS=$(curl --silent --header "PRIVATE-TOKEN: ${{ secrets.DOCKER_ROS_CI_READ_PIPELINE_GITLAB_TOKEN }}" "https://gitlab.ika.rwth-aachen.de/api/v4/projects/1886/pipelines/$PIPELINE_ID" | jq -r .status)
echo "Pipeline status: $PIPELINE_STATUS (https://gitlab.ika.rwth-aachen.de/fb-fi/ops/docker-ros-ci/-/pipelines/$PIPELINE_ID)"
if [[ $PIPELINE_STATUS == "success" ]]; then
break
elif [[ $PIPELINE_STATUS == "failed" ]]; then
exit 1
elif [[ $PIPELINE_STATUS == "canceled" ]]; then
exit 1
fi
done
trigger-ros2:
runs-on: ubuntu-latest
steps:
- name: Trigger pipeline
run: |
curl --silent --fail --request POST --form "token=${{ secrets.DOCKER_ROS_CI_TRIGGER_GITLAB_TOKEN }}" --form "ref=ros2" --form "variables[DOCKER_ROS_GIT_REF]=${{ github.sha }}" "https://gitlab.ika.rwth-aachen.de/api/v4/projects/1886/trigger/pipeline" | jq -r .id > id
- name: Upload pipeline ID
uses: actions/upload-artifact@v4
with:
name: id_ros2
path: id
watch-ros2:
runs-on: ubuntu-latest
needs: trigger-ros2
steps:
- name: Get pipeline ID
uses: actions/download-artifact@v4
with:
name: id_ros2
- name: Wait for pipeline completion
run: |
PIPELINE_ID=$(cat id)
while true; do
sleep 30
PIPELINE_STATUS=$(curl --silent --header "PRIVATE-TOKEN: ${{ secrets.DOCKER_ROS_CI_READ_PIPELINE_GITLAB_TOKEN }}" "https://gitlab.ika.rwth-aachen.de/api/v4/projects/1886/pipelines/$PIPELINE_ID" | jq -r .status)
echo "Pipeline status: $PIPELINE_STATUS (https://gitlab.ika.rwth-aachen.de/fb-fi/ops/docker-ros-ci/-/pipelines/$PIPELINE_ID)"
if [[ $PIPELINE_STATUS == "success" ]]; then
break
elif [[ $PIPELINE_STATUS == "failed" ]]; then
exit 1
elif [[ $PIPELINE_STATUS == "canceled" ]]; then
exit 1
fi
done