ArafatKhan2198 commented on code in PR #12214:
URL: https://github.com/apache/ozone/pull/12214#discussion_r4759017497


##########
.github/workflows/check.yml:
##########
@@ -234,38 +234,39 @@ jobs:
         if: ${{ inputs.script == 'acceptance' }}
         run: |
           source hadoop-ozone/dev-support/checks/_lib.sh
-          HADOOP_VERSION=$(get_version hadoop)
-          echo "HADOOP_VERSION=$HADOOP_VERSION" >> $GITHUB_ENV
-          RANGER_VERSION=$(get_version ranger)
-          echo "RANGER_VERSION=$RANGER_VERSION" >> $GITHUB_ENV
+          set -x
+          if [[ "$SPLIT" == *test-s3a.sh ]]; then
+            hadoop_version=$(get_version hadoop)
+            echo "hadoop_version=$hadoop_version" >> $GITHUB_OUTPUT
+          elif [[ "$SPLIT" == *test-ranger.sh ]] || [[ "$SPLIT" == 
*test-sts.sh ]]; then
+            ranger_version=$(get_version ranger)
+            echo "ranger_version=$ranger_version" >> $GITHUB_OUTPUT
+          fi
 
       - name: Restore Hadoop
         id: restore-hadoop
-        # TODO reduce hard-code in HDDS-17509
-        if: ${{ inputs.script == 'acceptance' && contains(inputs.split, 
'test-s3a.sh') }}
+        if: ${{ steps.versions.outputs.hadoop_version != '' }}
         uses: apache/infrastructure-actions/stash/restore@restore/v1
         with:
           clean: true
           path: ~/.cache/ozone
-          key: hadoop-${{ env.HADOOP_VERSION }}
+          key: hadoop-${{ steps.versions.outputs.hadoop_version }}
 
       - name: Restore Hadoop AWS dependencies
         id: restore-hadoop-deps
-        # TODO reduce hard-code in HDDS-17509
-        if: ${{ inputs.script == 'acceptance' && contains(inputs.split, 
'test-s3a.sh') }}
+        if: ${{ steps.versions.outputs.hadoop_version != '' }}
         uses: apache/infrastructure-actions/stash/restore@restore/v1
         with:
           path: ~/.cache/ozone/maven-repo
-          key: hadoop-${{ env.HADOOP_VERSION }}-deps
+          key: hadoop-${{ steps.versions.outputs.hadoop_version }}
 

Review Comment:
   Since we are no longer setting `HADOOP_VERSION` in the environment, 
shouldn't we update the condition and the key here as well to use 
`steps.versions.outputs.hadoop_version`?
   
   I checked the CI logs, and we are currently getting `hadoop--deps` as the 
key, resulting in a cache miss.



##########
.github/workflows/check.yml:
##########
@@ -234,38 +234,39 @@ jobs:
         if: ${{ inputs.script == 'acceptance' }}
         run: |
           source hadoop-ozone/dev-support/checks/_lib.sh
-          HADOOP_VERSION=$(get_version hadoop)
-          echo "HADOOP_VERSION=$HADOOP_VERSION" >> $GITHUB_ENV
-          RANGER_VERSION=$(get_version ranger)
-          echo "RANGER_VERSION=$RANGER_VERSION" >> $GITHUB_ENV
+          set -x
+          if [[ "$SPLIT" == *test-s3a.sh ]]; then
+            hadoop_version=$(get_version hadoop)
+            echo "hadoop_version=$hadoop_version" >> $GITHUB_OUTPUT
+          elif [[ "$SPLIT" == *test-ranger.sh ]] || [[ "$SPLIT" == 
*test-sts.sh ]]; then
+            ranger_version=$(get_version ranger)
+            echo "ranger_version=$ranger_version" >> $GITHUB_OUTPUT
+          fi
 
       - name: Restore Hadoop
         id: restore-hadoop
-        # TODO reduce hard-code in HDDS-17509
-        if: ${{ inputs.script == 'acceptance' && contains(inputs.split, 
'test-s3a.sh') }}
+        if: ${{ steps.versions.outputs.hadoop_version != '' }}
         uses: apache/infrastructure-actions/stash/restore@restore/v1
         with:
           clean: true
           path: ~/.cache/ozone
-          key: hadoop-${{ env.HADOOP_VERSION }}
+          key: hadoop-${{ steps.versions.outputs.hadoop_version }}
 
       - name: Restore Hadoop AWS dependencies
         id: restore-hadoop-deps
-        # TODO reduce hard-code in HDDS-17509
-        if: ${{ inputs.script == 'acceptance' && contains(inputs.split, 
'test-s3a.sh') }}
+        if: ${{ steps.versions.outputs.hadoop_version != '' }}
         uses: apache/infrastructure-actions/stash/restore@restore/v1
         with:
           path: ~/.cache/ozone/maven-repo
-          key: hadoop-${{ env.HADOOP_VERSION }}-deps
+          key: hadoop-${{ steps.versions.outputs.hadoop_version }}
 

Review Comment:
   Since we are no longer setting `HADOOP_VERSION` in the environment, 
shouldn't we update the condition and the key here as well to use 
`steps.versions.outputs.hadoop_version`?
   
   I checked the CI logs, and we are currently getting `hadoop--deps` as the 
key, resulting in a cache miss.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to