88 workflow_dispatch :
99 inputs :
1010 beforeTagOrCommit :
11- description : ' The baseline tag or commit to build Fleet agents from; if not specified, the latest tag will be used'
12- required : false
13- afterTagOrCommit :
14- description : ' The new tag or commit to build Fleet agents from; if not specified, the last commit in the codebase (PR or branch) will be used'
11+ description : ' The tag or commit to build the before upgrade version of the Fleet agents from; if not specified, the latest tag will be used'
1512 required : false
1613 pull_request :
1714 branches :
@@ -60,11 +57,11 @@ jobs:
6057 - name : Travel back in time to the before upgrade version
6158 run : |
6259 GIT_TAG="${{ github.event.inputs.beforeTagOrCommit }}"
63- PREVIOUS_BRANCH =$(git branch --show-current)
64- PREVIOUS_COMMIT =$(git rev-parse HEAD)
65- echo "Current at branch $PREVIOUS_BRANCH , commit $PREVIOUS_COMMIT ."
60+ CURRENT_BRANCH =$(git branch --show-current)
61+ CURRENT_BRANCH =$(git rev-parse HEAD)
62+ echo "Current at branch $CURRENT_BRANCH , commit $CURRENT_BRANCH ."
6663
67- echo "PREVIOUS_COMMIT=$PREVIOUS_COMMIT " >> "$GITHUB_ENV"
64+ echo "CURRENT_BRANCH=$CURRENT_BRANCH " >> "$GITHUB_ENV"
6865
6966 if [ -z "${GIT_TAG}" ]
7067 then
7370
7471 git fetch --all
7572 GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
76-
7773 else
7874 echo "A tag is specified; go back to the state tracked by the specified tag."
7975 echo "Fetch all tags..."
@@ -85,55 +81,35 @@ jobs:
8581 echo "Checked out source code at $GIT_TAG."
8682
8783 - name : Prepare the fleet using the before upgrade version
88- run : cd test/upgrade && chmod +x setup.sh && ./setup.sh 3 && cd -
84+ # Set up the Fleet using images built the older source code but with the current setup script.
85+ #
86+ # Note that the `git checkout` command below only checks out the `test/upgrade` directory (at
87+ # the current commit); the rest of the source code is still at the before-upgrade version.
88+ run : |
89+ git checkout $CURRENT_BRANCH -- test/upgrade
90+ cd test/upgrade && chmod +x setup.sh && cd -
91+ ./test/upgrade/setup.sh 3
8992 env :
9093 KUBECONFIG : ' /home/runner/.kube/config'
9194 HUB_SERVER_URL : ' https://172.19.0.2:6443'
9295
9396 - name : Travel to the current state
94- # Note: Fleet always uses the version compatibility test suite from the
95- # baseline commit, i.e., the commit that triggers the workflow.
97+ # Run the test suite from the current version, i.e., the commit that triggered the workflow.
9698 run : |
97- echo "Returning to the current state..."
98- git checkout $PREVIOUS_COMMIT
99- echo "Checked out source code at $PREVIOUS_COMMIT."
99+ git checkout $CURRENT_BRANCH
100+ echo "Checked out source code at $CURRENT_BRANCH."
100101
101102 - name : Run the Before suite
102103 run : cd test/upgrade/before && ginkgo -v -p . && cd -
103104 env :
104105 KUBECONFIG : ' /home/runner/.kube/config'
105-
106- - name : Travel back in time to the after upgrade version
107- run : |
108- GIT_TAG="${{ github.event.inputs.afterTagOrCommit }}"
109- PREVIOUS_BRANCH=$(git branch --show-current)
110- PREVIOUS_COMMIT=$(git rev-parse HEAD)
111- echo "Current at branch $PREVIOUS_BRANCH, commit $PREVIOUS_COMMIT."
112-
113- if [ -z "${GIT_TAG}" ]
114- then
115- echo "No tag is specified; go back to the current state."
116- else
117- echo "A tag is specified; go back to the state tracked by the specified tag."
118- echo "Fetch all tags..."
119-
120- git fetch --all
121- git checkout $GIT_TAG
122- echo "Checked out source code at $GIT_TAG."
123- fi
124106
125107 - name : Upgrade the Fleet hub agent to the after upgrade version
126- run : cd test/upgrade && chmod +x upgrade.sh && UPGRADE_HUB_SIDE=true ./upgrade.sh 3 && cd -
108+ run : |
109+ cd test/upgrade && chmod +x upgrade.sh && cd -
110+ UPGRADE_HUB_SIDE=true ./test/upgrade/upgrade.sh 3
127111 env :
128112 KUBECONFIG : ' /home/runner/.kube/config'
129-
130- - name : Travel to the current state
131- # Note: Fleet always uses the version compatibility test suite from the
132- # baseline commit, i.e., the commit that triggers the workflow.
133- run : |
134- echo "Returning to the current state..."
135- git checkout $PREVIOUS_COMMIT
136- echo "Checked out source code at $PREVIOUS_COMMIT."
137113
138114 - name : Run the After suite
139115 run : cd test/upgrade/after && ginkgo -v -p . && cd -
@@ -164,20 +140,19 @@ jobs:
164140 - name : Travel back in time to the before upgrade version
165141 run : |
166142 GIT_TAG="${{ github.event.inputs.beforeTagOrCommit }}"
167- PREVIOUS_BRANCH =$(git branch --show-current)
168- PREVIOUS_COMMIT =$(git rev-parse HEAD)
169- echo "Current at branch $PREVIOUS_BRANCH , commit $PREVIOUS_COMMIT ."
143+ CURRENT_BRANCH =$(git branch --show-current)
144+ CURRENT_BRANCH =$(git rev-parse HEAD)
145+ echo "Current at branch $CURRENT_BRANCH , commit $CURRENT_BRANCH ."
170146
171- echo "PREVIOUS_COMMIT=$PREVIOUS_COMMIT " >> "$GITHUB_ENV"
147+ echo "CURRENT_BRANCH=$CURRENT_BRANCH " >> "$GITHUB_ENV"
172148
173149 if [ -z "${GIT_TAG}" ]
174150 then
175151 echo "No tag is specified; go back to the state tracked by the last known tag."
176152 echo "Fetch all tags..."
177153
178154 git fetch --all
179- GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
180-
155+ GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
181156 else
182157 echo "A tag is specified; go back to the state tracked by the specified tag."
183158 echo "Fetch all tags..."
@@ -188,56 +163,36 @@ jobs:
188163 git checkout $GIT_TAG
189164 echo "Checked out source code at $GIT_TAG."
190165
191- - name : Prepare the fleet
192- run : cd test/upgrade && chmod +x setup.sh && ./setup.sh 3 && cd -
166+ - name : Prepare the fleet using the before upgrade version
167+ # Set up the Fleet using images built the older source code but with the current setup script.
168+ #
169+ # Note that the `git checkout` command below only checks out the `test/upgrade` directory (at
170+ # the current commit); the rest of the source code is still at the before-upgrade version.
171+ run : |
172+ git checkout $CURRENT_BRANCH -- test/upgrade
173+ cd test/upgrade && chmod +x setup.sh && cd -
174+ ./test/upgrade/setup.sh 3
193175 env :
194176 KUBECONFIG : ' /home/runner/.kube/config'
195177 HUB_SERVER_URL : ' https://172.19.0.2:6443'
196178
197179 - name : Travel to the current state
198- # Note: Fleet always uses the version compatibility test suite from the
199- # baseline commit, i.e., the commit that triggers the workflow.
180+ # Run the test suite from the current version, i.e., the commit that triggered the workflow.
200181 run : |
201- echo "Returning to the current state..."
202- git checkout $PREVIOUS_COMMIT
203- echo "Checked out source code at $PREVIOUS_COMMIT."
182+ git checkout $CURRENT_BRANCH
183+ echo "Checked out source code at $CURRENT_BRANCH."
204184
205185 - name : Run the Before suite
206186 run : cd test/upgrade/before && ginkgo -v -p . && cd -
207187 env :
208188 KUBECONFIG : ' /home/runner/.kube/config'
209-
210- - name : Travel back in time to the after upgrade version
211- run : |
212- GIT_TAG="${{ github.event.inputs.afterTagOrCommit }}"
213- PREVIOUS_BRANCH=$(git branch --show-current)
214- PREVIOUS_COMMIT=$(git rev-parse HEAD)
215- echo "Current at branch $PREVIOUS_BRANCH, commit $PREVIOUS_COMMIT."
216-
217- if [ -z "${GIT_TAG}" ]
218- then
219- echo "No tag is specified; go back to the current state."
220- else
221- echo "A tag is specified; go back to the state tracked by the specified tag."
222- echo "Fetch all tags..."
223-
224- git fetch --all
225- git checkout $GIT_TAG
226- echo "Checked out source code at $GIT_TAG."
227- fi
228189
229190 - name : Upgrade the Fleet member agent
230- run : cd test/upgrade && chmod +x upgrade.sh && UPGRADE_MEMBER_SIDE=true ./upgrade.sh 3 && cd -
191+ run : |
192+ cd test/upgrade && chmod +x upgrade.sh && cd -
193+ UPGRADE_MEMBER_SIDE=true ./test/upgrade/upgrade.sh 3
231194 env :
232195 KUBECONFIG : ' /home/runner/.kube/config'
233-
234- - name : Travel to the current state
235- # Note: Fleet always uses the version compatibility test suite from the
236- # baseline commit, i.e., the commit that triggers the workflow.
237- run : |
238- echo "Returning to the current state..."
239- git checkout $PREVIOUS_COMMIT
240- echo "Checked out source code at $PREVIOUS_COMMIT."
241196
242197 - name : Run the After suite
243198 run : cd test/upgrade/after && ginkgo -v -p . && cd -
@@ -268,20 +223,19 @@ jobs:
268223 - name : Travel back in time to the before upgrade version
269224 run : |
270225 GIT_TAG="${{ github.event.inputs.beforeTagOrCommit }}"
271- PREVIOUS_BRANCH =$(git branch --show-current)
272- PREVIOUS_COMMIT =$(git rev-parse HEAD)
273- echo "Current at branch $PREVIOUS_BRANCH , commit $PREVIOUS_COMMIT ."
226+ CURRENT_BRANCH =$(git branch --show-current)
227+ CURRENT_BRANCH =$(git rev-parse HEAD)
228+ echo "Current at branch $CURRENT_BRANCH , commit $CURRENT_BRANCH ."
274229
275- echo "PREVIOUS_COMMIT=$PREVIOUS_COMMIT " >> "$GITHUB_ENV"
230+ echo "CURRENT_BRANCH=$CURRENT_BRANCH " >> "$GITHUB_ENV"
276231
277232 if [ -z "${GIT_TAG}" ]
278233 then
279234 echo "No tag is specified; go back to the state tracked by the last known tag."
280235 echo "Fetch all tags..."
281236
282237 git fetch --all
283- GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
284-
238+ GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
285239 else
286240 echo "A tag is specified; go back to the state tracked by the specified tag."
287241 echo "Fetch all tags..."
@@ -292,57 +246,37 @@ jobs:
292246 git checkout $GIT_TAG
293247 echo "Checked out source code at $GIT_TAG."
294248
295- - name : Prepare the fleet
296- run : cd test/upgrade && chmod +x setup.sh && ./setup.sh 3 && cd -
249+ - name : Prepare the fleet using the before upgrade version
250+ # Set up the Fleet using images built the older source code but with the current setup script.
251+ #
252+ # Note that the `git checkout` command below only checks out the `test/upgrade` directory (at
253+ # the current commit); the rest of the source code is still at the before-upgrade version.
254+ run : |
255+ git checkout $CURRENT_BRANCH -- test/upgrade
256+ cd test/upgrade && chmod +x setup.sh && cd -
257+ ./test/upgrade/setup.sh 3
297258 env :
298259 KUBECONFIG : ' /home/runner/.kube/config'
299260 HUB_SERVER_URL : ' https://172.19.0.2:6443'
300261
301262 - name : Travel to the current state
302- # Note: Fleet always uses the version compatibility test suite from the
303- # baseline commit, i.e., the commit that triggers the workflow.
263+ # Run the test suite from the current version, i.e., the commit that triggered the workflow.
304264 run : |
305- echo "Returning to the current state..."
306- git checkout $PREVIOUS_COMMIT
307- echo "Checked out source code at $PREVIOUS_COMMIT."
265+ git checkout $CURRENT_BRANCH
266+ echo "Checked out source code at $CURRENT_BRANCH."
308267
309268 - name : Run the Before suite
310269 run : cd test/upgrade/before && ginkgo -v -p . && cd -
311270 env :
312271 KUBECONFIG : ' /home/runner/.kube/config'
313-
314- - name : Travel back in time to the after upgrade version
315- run : |
316- GIT_TAG="${{ github.event.inputs.afterTagOrCommit }}"
317- PREVIOUS_BRANCH=$(git branch --show-current)
318- PREVIOUS_COMMIT=$(git rev-parse HEAD)
319- echo "Current at branch $PREVIOUS_BRANCH, commit $PREVIOUS_COMMIT."
320-
321- if [ -z "${GIT_TAG}" ]
322- then
323- echo "No tag is specified; go back to the current state."
324- else
325- echo "A tag is specified; go back to the state tracked by the specified tag."
326- echo "Fetch all tags..."
327-
328- git fetch --all
329- git checkout $GIT_TAG
330- echo "Checked out source code at $GIT_TAG."
331- fi
332272
333273 - name : Upgrade all Fleet agents
334- run : cd test/upgrade && GIT_TAG="${{ github.event.inputs.afterTagOrCommit }}" chmod +x upgrade.sh && UPGRADE_HUB_SIDE=true UPGRADE_MEMBER_SIDE=true ./upgrade.sh 3 && cd -
274+ run : |
275+ cd test/upgrade && chmod +x upgrade.sh && cd -
276+ UPGRADE_HUB_SIDE=true UPGRADE_MEMBER_SIDE=true ./test/upgrade/upgrade.sh 3
335277 env :
336278 KUBECONFIG : ' /home/runner/.kube/config'
337279
338- - name : Travel to the current state
339- # Note: Fleet always uses the version compatibility test suite from the
340- # baseline commit, i.e., the commit that triggers the workflow.
341- run : |
342- echo "Returning to the current state..."
343- git checkout $PREVIOUS_COMMIT
344- echo "Checked out source code at $PREVIOUS_COMMIT."
345-
346280 - name : Run the After suite
347281 run : cd test/upgrade/after && ginkgo -v -p . && cd -
348282 env :
0 commit comments