zentol commented on code in PR #23970: URL: https://github.com/apache/flink/pull/23970#discussion_r1445866846
########## .github/actions/run_mvn/action.yml: ########## @@ -0,0 +1,42 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +--- +name: "Runs Maven Command" Review Comment: Don't quite understand yet why we have this. bit concerned about repeatedly sourcing `maven-utils.sh`. ########## pom.xml: ########## @@ -998,6 +998,21 @@ under the License. </build> </profile> + <profile> + <id>github-actions</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludedGroups>org.apache.flink.testutils.junit.FailsInGHAContainerWithRootUser</excludedGroups> Review Comment: What you can do alternatively is set a variable `ghaExcludeFails...` to `,org.apache.flink...` and reference said variable in the other profiles. `<excludedGroups>${ghaExcludeFails...}MyOtherFancyExclusion</excludedGroups>` I think the profiles could set such a variable and the base surefire config has the references. ########## .github/actions/run_mvn/action.yml: ########## @@ -0,0 +1,42 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +--- +name: "Runs Maven Command" +description: "Sets the Java version within Flink' CI Docker container" Review Comment: outdated ########## .github/workflows/template.flink-ci.yml: ########## @@ -0,0 +1,438 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Workflow template for triggering the Flink's test suite. + +name: "Apache Flink Test Workflow Template" + +on: + workflow_call: + inputs: + workflow-caller-id: + description: "The calling job's ID that can be used for build artifact names (that need to be different between different jobs of the same workflow)." + default: "" + type: string + environment: + description: "Defines environment variables for downstream scripts." + required: true + type: string + jdk_version: + description: "The Java version to use." + default: 8 + type: number + branch: + description: "The branch the test suite should run on." + default: "master" + type: string + secrets: + s3_bucket: + required: false + s3_access_key: + required: false + s3_secret_key: + required: false + +permissions: read-all + +# Running logic within a container comes with challenges around file permissions (e.g. when trying +# to generate the hash for a certain set of files; see https://github.com/actions/cache/issues/753): +# +# The code is cloned into the runner's workspace /home/runner/work/ but outside the container. +# The runner's workspace folder is then mounted to /__w within the container. Files that were generated +# as part of the checkout will have the runner's user as the owner. Any files that are generated during +# the workflow execution will have the container's user as the owner (i.e. root). That can cause issues +# with actions that need to access the files of the checkout. +# +# We can work around this issue by copying the source code to a separate location (i.e. the container +# user's home folder). It's important to notice that any file that is subject to caching should still +# live in the mounted folder to ensure accessibility by the cache action. +env: + MOUNTED_WORKING_DIR: /__w/flink/flink + CONTAINER_LOCAL_WORKING_DIR: /root/flink + # The following two variables are used by the utility scripts for creating + # and unpacking the build artifacts. + FLINK_ARTIFACT_DIR: /root/artifact-directory + FLINK_ARTIFACT_FILENAME: flink_artifacts.tar.gz + + MAVEN_REPO_FOLDER: /root/.m2/repository + MAVEN_ARGS: -Dmaven.repo.local=/root/.m2/repository + # required by tools/azure-pipelines/cache_docker_images.sh + DOCKER_IMAGES_CACHE_FOLDER: /root/.docker-cache + +jobs: + compile: + name: "Compile" + runs-on: ubuntu-latest + container: + image: chesnay/flink-ci:java_8_11_17_21_maven_386 + options: --init + timeout-minutes: 240 + outputs: + stringified-workflow-name: ${{ steps.workflow-prep-step.outputs.stringified-workflow-name }} + steps: + - name: "Flink Checkout" + uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + persist-credentials: false + + - name: "Stringify workflow name" + id: workflow-prep-step + run: | + stringified_workflow_name=$(echo "${{ github.workflow }}-${{ inputs.workflow-caller-id }}" | tr -C '[:alnum:]._' '-' | tr '[:upper:]' '[:lower:]' | sed -e 's/--*/-/g' -e 's/^-*//g' -e 's/-*$//g') + echo "stringified-workflow-name=${stringified_workflow_name}" >> $GITHUB_OUTPUT + + - name: "Set JDK version to Java ${{ inputs.jdk_version }}" + uses: "./.github/actions/set_java_in_container" + with: + jdk_version: ${{ inputs.jdk_version }} + + - name: "Setup Maven package cache" + uses: actions/cache@v3 + with: + path: ${{ env.MAVEN_REPO_FOLDER }} + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + + - name: "Moves relevant checkout content to container-local working directory" + uses: "./.github/actions/move_checkout" + with: + source_directory: ${{ env.MOUNTED_WORKING_DIR }} + target_directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + + - name: "Compile Flink" + uses: "./.github/actions/run_mvn" + with: + working_directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + maven-parameters: "test-compile -Dflink.markBundledAsOptional=false -Dfast" + env: "${{ inputs.environment }}" + + - name: "Collect build artifacts" + working-directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + run: | + ./tools/azure-pipelines/create_build_artifact.sh + + - name: "Upload artifacts to make them available in downstream jobs" + uses: actions/upload-artifact@v3 + with: + name: build-artifacts-${{ steps.workflow-prep-step.outputs.stringified-workflow-name }}-${{ github.run_number }} + path: ${{ env.FLINK_ARTIFACT_DIR }}/${{ env.FLINK_ARTIFACT_FILENAME }} + if-no-files-found: error + # use minimum here because we only need these artifacts to speed up the build + retention-days: 1 + + packaging: + name: "Test packaging/licensing" + needs: compile + runs-on: ubuntu-latest + container: + image: chesnay/flink-ci:java_8_11_17_21_maven_386 + options: --init Review Comment: add a commentg why this was added? ########## .github/workflows/template.flink-ci.yml: ########## @@ -0,0 +1,438 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Workflow template for triggering the Flink's test suite. + +name: "Apache Flink Test Workflow Template" + +on: + workflow_call: + inputs: + workflow-caller-id: + description: "The calling job's ID that can be used for build artifact names (that need to be different between different jobs of the same workflow)." + default: "" + type: string + environment: + description: "Defines environment variables for downstream scripts." + required: true + type: string + jdk_version: + description: "The Java version to use." + default: 8 + type: number + branch: + description: "The branch the test suite should run on." + default: "master" + type: string + secrets: + s3_bucket: + required: false + s3_access_key: + required: false + s3_secret_key: + required: false + +permissions: read-all + +# Running logic within a container comes with challenges around file permissions (e.g. when trying +# to generate the hash for a certain set of files; see https://github.com/actions/cache/issues/753): +# +# The code is cloned into the runner's workspace /home/runner/work/ but outside the container. +# The runner's workspace folder is then mounted to /__w within the container. Files that were generated +# as part of the checkout will have the runner's user as the owner. Any files that are generated during +# the workflow execution will have the container's user as the owner (i.e. root). That can cause issues +# with actions that need to access the files of the checkout. +# +# We can work around this issue by copying the source code to a separate location (i.e. the container +# user's home folder). It's important to notice that any file that is subject to caching should still +# live in the mounted folder to ensure accessibility by the cache action. +env: + MOUNTED_WORKING_DIR: /__w/flink/flink + CONTAINER_LOCAL_WORKING_DIR: /root/flink + # The following two variables are used by the utility scripts for creating + # and unpacking the build artifacts. + FLINK_ARTIFACT_DIR: /root/artifact-directory + FLINK_ARTIFACT_FILENAME: flink_artifacts.tar.gz + + MAVEN_REPO_FOLDER: /root/.m2/repository + MAVEN_ARGS: -Dmaven.repo.local=/root/.m2/repository + # required by tools/azure-pipelines/cache_docker_images.sh + DOCKER_IMAGES_CACHE_FOLDER: /root/.docker-cache + +jobs: + compile: + name: "Compile" + runs-on: ubuntu-latest + container: + image: chesnay/flink-ci:java_8_11_17_21_maven_386 + options: --init + timeout-minutes: 240 + outputs: + stringified-workflow-name: ${{ steps.workflow-prep-step.outputs.stringified-workflow-name }} + steps: + - name: "Flink Checkout" + uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + persist-credentials: false + + - name: "Stringify workflow name" + id: workflow-prep-step + run: | + stringified_workflow_name=$(echo "${{ github.workflow }}-${{ inputs.workflow-caller-id }}" | tr -C '[:alnum:]._' '-' | tr '[:upper:]' '[:lower:]' | sed -e 's/--*/-/g' -e 's/^-*//g' -e 's/-*$//g') + echo "stringified-workflow-name=${stringified_workflow_name}" >> $GITHUB_OUTPUT + + - name: "Set JDK version to Java ${{ inputs.jdk_version }}" + uses: "./.github/actions/set_java_in_container" + with: + jdk_version: ${{ inputs.jdk_version }} + + - name: "Setup Maven package cache" + uses: actions/cache@v3 + with: + path: ${{ env.MAVEN_REPO_FOLDER }} + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + + - name: "Moves relevant checkout content to container-local working directory" + uses: "./.github/actions/move_checkout" + with: + source_directory: ${{ env.MOUNTED_WORKING_DIR }} + target_directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + + - name: "Compile Flink" + uses: "./.github/actions/run_mvn" + with: + working_directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + maven-parameters: "test-compile -Dflink.markBundledAsOptional=false -Dfast" + env: "${{ inputs.environment }}" + + - name: "Collect build artifacts" + working-directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + run: | + ./tools/azure-pipelines/create_build_artifact.sh + + - name: "Upload artifacts to make them available in downstream jobs" + uses: actions/upload-artifact@v3 + with: + name: build-artifacts-${{ steps.workflow-prep-step.outputs.stringified-workflow-name }}-${{ github.run_number }} + path: ${{ env.FLINK_ARTIFACT_DIR }}/${{ env.FLINK_ARTIFACT_FILENAME }} + if-no-files-found: error + # use minimum here because we only need these artifacts to speed up the build + retention-days: 1 + + packaging: + name: "Test packaging/licensing" + needs: compile + runs-on: ubuntu-latest + container: + image: chesnay/flink-ci:java_8_11_17_21_maven_386 + options: --init + + steps: + - name: "Flink Checkout" + uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + persist-credentials: false + + - name: "Set JDK version to Java ${{ inputs.jdk_version }}" + uses: "./.github/actions/set_java_in_container" + with: + jdk_version: ${{ inputs.jdk_version }} + + - name: "Setup Maven package cache" + uses: actions/cache@v3 + with: + path: ${{ env.MAVEN_REPO_FOLDER }} + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + + - name: "Moves relevant checkout content to container-local working directory" + uses: "./.github/actions/move_checkout" + with: + source_directory: ${{ env.MOUNTED_WORKING_DIR }} + target_directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + + - name: "Download build artifacts from compile job" + uses: actions/download-artifact@v3 + with: + name: build-artifacts-${{ needs.compile.outputs.stringified-workflow-name }}-${{ github.run_number }} + path: ${{ env.FLINK_ARTIFACT_DIR }} + + - name: "Unpack build artifact" + working-directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + run: | + ./tools/azure-pipelines/unpack_build_artifact.sh + + - name: "Test" + working-directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + run: | + ${{ inputs.environment }} ./tools/ci/compile_ci.sh || exit $? + + test: + name: "Test (module: ${{ matrix.module }})" + needs: compile + runs-on: ubuntu-latest + container: + image: chesnay/flink-ci:java_8_11_17_21_maven_386 + options: --init + strategy: + fail-fast: false + matrix: + include: + - module: core + stringified-module-name: core + - module: python + stringified-module-name: python + - module: table + stringified-module-name: table + - module: connect + stringified-module-name: connect + - module: tests + stringified-module-name: tests + - module: misc + stringified-module-name: misc + + steps: + - name: "Flink Checkout" + uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + persist-credentials: false + + - name: "Set JDK version to Java ${{ inputs.jdk_version }}" + uses: "./.github/actions/set_java_in_container" + with: + jdk_version: ${{ inputs.jdk_version }} + + - name: "Setup Maven package cache" + uses: actions/cache@v3 + with: + path: ${{ env.MAVEN_REPO_FOLDER }} + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + + - name: "Moves relevant checkout content to container-local working directory" + uses: "./.github/actions/move_checkout" + with: + source_directory: ${{ env.MOUNTED_WORKING_DIR }} + target_directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + + - name: "Set coredump pattern" + working-directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + run: sudo sysctl -w kernel.core_pattern=core.%p + + - name: "Download build artifacts from compile job" + uses: actions/download-artifact@v3 + with: + name: build-artifacts-${{ needs.compile.outputs.stringified-workflow-name }}-${{ github.run_number }} + path: ${{ env.FLINK_ARTIFACT_DIR }} + + - name: "Unpack build artifact" + working-directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + run: | + ./tools/azure-pipelines/unpack_build_artifact.sh + + - name: "Try loading Docker images from Cache" + id: docker-cache + uses: actions/cache@v3 + with: + path: ${{ env.DOCKER_IMAGES_CACHE_FOLDER }} + key: ${{ matrix.module }}-docker-${{ runner.os }}-${{ hashFiles('**/cache_docker_images.sh', '**/flink-test-utils-parent/**/DockerImageVersions.java') }} + restore-keys: ${{ matrix.module }}-docker-${{ runner.os }} + + - name: "Load Docker images if not present in cache, yet" + if: ${{ !cancelled() && !steps.docker-cache.cache.hit }} + working-directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + run: ./tools/azure-pipelines/cache_docker_images.sh load + + - name: "Test - ${{ matrix.module }}" + id: test-run + working-directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + env: + IT_CASE_S3_BUCKET: ${{ secrets.s3_bucket }} + IT_CASE_S3_ACCESS_KEY: ${{ secrets.s3_access_key }} + IT_CASE_S3_SECRET_KEY: ${{ secrets.s3_secret_key }} + timeout-minutes: 240 + run: | + ${{ inputs.environment }} PROFILE="$PROFILE -Pgithub-actions" ./tools/azure-pipelines/uploading_watchdog.sh \ + -a ${{ github.job }} \ + -d ${{ env.FLINK_ARTIFACT_DIR }} \ + -t 480 \ + ./tools/ci/test_controller.sh ${{ matrix.module }} + + - name: "Post-process build artifacts" + working-directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + run: find ${{ steps.test-run.outputs.debug-files-output-dir }} -type f -exec rename 's/[:<>|*?]/-/' {} \; + + - name: "Upload build artifacts" + uses: actions/upload-artifact@v3 + if: ${{ failure() && steps.test-run.outputs.debug-files-output-dir }} != '' + with: + name: logs-test-${{ needs.compile.outputs.stringified-workflow-name }}-${{ github.run_number }}-${{ matrix.stringified-module-name }}-${{ steps.test-run.outputs.debug-files-name }} + path: ${{ steps.test-run.outputs.debug-files-output-dir }} + + - name: "Save Docker images to cache" + working-directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + if: ${{ !cancelled() && (failure() || !steps.docker-cache.cache.hit) }} + run: ./tools/azure-pipelines/cache_docker_images.sh save + + e2e-prereq-check: + name: "Check: Code modified" + needs: compile + runs-on: ubuntu-latest + container: + image: chesnay/flink-ci:java_8_11_17_21_maven_386 + options: --init + outputs: + skip-e2e: ${{ steps.docs-only-pr-check.skip-e2e }} + steps: + - name: "Flink Checkout" + uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + persist-credentials: false + + # Skip e2e test execution if this is a documentation only pull request (master / release builds will still be checked regularly) + - name: "Check if it's a docs-only PR (i.e. e2e tests can be skipped)" + id: docs-only-pr-check + run: | + source ./tools/azure-pipelines/build_properties.sh + if is_docs_only_pullrequest; then + echo "This is a documentation-only change. Skipping e2e execution." + echo "skip-e2e=true" >> $GITHUB_OUTPUT + else + echo "This is a regular CI build. Continuing ..." + fi + shell: bash + + e2e: Review Comment: why are we not configuring the `container`? ########## tools/azure-pipelines/unpack_build_artifact.sh: ########## @@ -24,7 +24,12 @@ if ! [ -e $FLINK_ARTIFACT_DIR ]; then fi echo "Merging cache" -cp -RT "$FLINK_ARTIFACT_DIR" "." +if [ -z "${FLINK_ARTIFACT_FILENAME}" ]; then Review Comment: can we add a comment that this is azure/gha branches respectively in all files? ########## .github/workflows/template.flink-ci.yml: ########## @@ -0,0 +1,438 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Workflow template for triggering the Flink's test suite. + +name: "Apache Flink Test Workflow Template" + +on: + workflow_call: + inputs: + workflow-caller-id: + description: "The calling job's ID that can be used for build artifact names (that need to be different between different jobs of the same workflow)." + default: "" + type: string + environment: + description: "Defines environment variables for downstream scripts." + required: true + type: string + jdk_version: + description: "The Java version to use." + default: 8 + type: number + branch: + description: "The branch the test suite should run on." + default: "master" + type: string + secrets: + s3_bucket: + required: false + s3_access_key: + required: false + s3_secret_key: + required: false + +permissions: read-all + +# Running logic within a container comes with challenges around file permissions (e.g. when trying +# to generate the hash for a certain set of files; see https://github.com/actions/cache/issues/753): +# +# The code is cloned into the runner's workspace /home/runner/work/ but outside the container. +# The runner's workspace folder is then mounted to /__w within the container. Files that were generated +# as part of the checkout will have the runner's user as the owner. Any files that are generated during +# the workflow execution will have the container's user as the owner (i.e. root). That can cause issues +# with actions that need to access the files of the checkout. +# +# We can work around this issue by copying the source code to a separate location (i.e. the container +# user's home folder). It's important to notice that any file that is subject to caching should still +# live in the mounted folder to ensure accessibility by the cache action. +env: + MOUNTED_WORKING_DIR: /__w/flink/flink + CONTAINER_LOCAL_WORKING_DIR: /root/flink + # The following two variables are used by the utility scripts for creating + # and unpacking the build artifacts. + FLINK_ARTIFACT_DIR: /root/artifact-directory + FLINK_ARTIFACT_FILENAME: flink_artifacts.tar.gz + + MAVEN_REPO_FOLDER: /root/.m2/repository + MAVEN_ARGS: -Dmaven.repo.local=/root/.m2/repository + # required by tools/azure-pipelines/cache_docker_images.sh + DOCKER_IMAGES_CACHE_FOLDER: /root/.docker-cache + +jobs: + compile: + name: "Compile" + runs-on: ubuntu-latest + container: + image: chesnay/flink-ci:java_8_11_17_21_maven_386 + options: --init + timeout-minutes: 240 + outputs: + stringified-workflow-name: ${{ steps.workflow-prep-step.outputs.stringified-workflow-name }} + steps: + - name: "Flink Checkout" + uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + persist-credentials: false + + - name: "Stringify workflow name" + id: workflow-prep-step + run: | + stringified_workflow_name=$(echo "${{ github.workflow }}-${{ inputs.workflow-caller-id }}" | tr -C '[:alnum:]._' '-' | tr '[:upper:]' '[:lower:]' | sed -e 's/--*/-/g' -e 's/^-*//g' -e 's/-*$//g') Review Comment: can we add a comment to quickly explain what we do here? ``` convert all special characters except underscores to dashes lowercase everything remove duplicate, trailing and leading dashes ``` ########## tools/azure-pipelines/create_build_artifact.sh: ########## @@ -28,15 +28,15 @@ echo "Minimizing artifact files" # by removing files not required for subsequent stages # jars are re-built in subsequent stages, so no need to cache them (cannot be avoided) -find "$FLINK_ARTIFACT_DIR" -maxdepth 8 -type f -name '*.jar' | xargs rm -rf +find "$FLINK_ARTIFACT_DIR" -maxdepth 8 -type f -name '*.jar' -exec rm -rf {} \; Review Comment: attribute some of these changes to the previous commit about xargs? ########## tools/azure-pipelines/uploading_watchdog.sh: ########## @@ -19,6 +19,17 @@ # b) It prints a warning if the test has reached 80% of it's execution time # c) N minutes before the end of the execution time, it will start uploading the current output as azure artifacts +while getopts 'a:d:t:' flag; do + case "${flag}" in + a) export AGENT_JOBNAME="$OPTARG";; + d) export AGENT_TEMPDIRECTORY="$OPTARG";; + t) export SYSTEM_JOBTIMEOUT="$OPTARG";; + *) echo "Wrong parameter passed. $OPTARG";; Review Comment: ❓ 🤔 ########## .github/workflows/template.flink-ci.yml: ########## @@ -0,0 +1,438 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Workflow template for triggering the Flink's test suite. + +name: "Apache Flink Test Workflow Template" + +on: + workflow_call: + inputs: + workflow-caller-id: + description: "The calling job's ID that can be used for build artifact names (that need to be different between different jobs of the same workflow)." + default: "" + type: string + environment: + description: "Defines environment variables for downstream scripts." + required: true + type: string + jdk_version: + description: "The Java version to use." + default: 8 + type: number + branch: + description: "The branch the test suite should run on." + default: "master" + type: string + secrets: + s3_bucket: + required: false + s3_access_key: + required: false + s3_secret_key: + required: false + +permissions: read-all + +# Running logic within a container comes with challenges around file permissions (e.g. when trying +# to generate the hash for a certain set of files; see https://github.com/actions/cache/issues/753): +# +# The code is cloned into the runner's workspace /home/runner/work/ but outside the container. +# The runner's workspace folder is then mounted to /__w within the container. Files that were generated +# as part of the checkout will have the runner's user as the owner. Any files that are generated during +# the workflow execution will have the container's user as the owner (i.e. root). That can cause issues +# with actions that need to access the files of the checkout. +# +# We can work around this issue by copying the source code to a separate location (i.e. the container +# user's home folder). It's important to notice that any file that is subject to caching should still +# live in the mounted folder to ensure accessibility by the cache action. +env: + MOUNTED_WORKING_DIR: /__w/flink/flink + CONTAINER_LOCAL_WORKING_DIR: /root/flink + # The following two variables are used by the utility scripts for creating + # and unpacking the build artifacts. + FLINK_ARTIFACT_DIR: /root/artifact-directory + FLINK_ARTIFACT_FILENAME: flink_artifacts.tar.gz + + MAVEN_REPO_FOLDER: /root/.m2/repository + MAVEN_ARGS: -Dmaven.repo.local=/root/.m2/repository + # required by tools/azure-pipelines/cache_docker_images.sh + DOCKER_IMAGES_CACHE_FOLDER: /root/.docker-cache + +jobs: + compile: + name: "Compile" + runs-on: ubuntu-latest + container: + image: chesnay/flink-ci:java_8_11_17_21_maven_386 + options: --init + timeout-minutes: 240 + outputs: + stringified-workflow-name: ${{ steps.workflow-prep-step.outputs.stringified-workflow-name }} + steps: + - name: "Flink Checkout" + uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + persist-credentials: false + + - name: "Stringify workflow name" + id: workflow-prep-step + run: | + stringified_workflow_name=$(echo "${{ github.workflow }}-${{ inputs.workflow-caller-id }}" | tr -C '[:alnum:]._' '-' | tr '[:upper:]' '[:lower:]' | sed -e 's/--*/-/g' -e 's/^-*//g' -e 's/-*$//g') + echo "stringified-workflow-name=${stringified_workflow_name}" >> $GITHUB_OUTPUT + + - name: "Set JDK version to Java ${{ inputs.jdk_version }}" + uses: "./.github/actions/set_java_in_container" + with: + jdk_version: ${{ inputs.jdk_version }} + + - name: "Setup Maven package cache" + uses: actions/cache@v3 + with: + path: ${{ env.MAVEN_REPO_FOLDER }} + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + + - name: "Moves relevant checkout content to container-local working directory" + uses: "./.github/actions/move_checkout" + with: + source_directory: ${{ env.MOUNTED_WORKING_DIR }} + target_directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + + - name: "Compile Flink" + uses: "./.github/actions/run_mvn" + with: + working_directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + maven-parameters: "test-compile -Dflink.markBundledAsOptional=false -Dfast" + env: "${{ inputs.environment }}" + + - name: "Collect build artifacts" + working-directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }} + run: | + ./tools/azure-pipelines/create_build_artifact.sh + + - name: "Upload artifacts to make them available in downstream jobs" + uses: actions/upload-artifact@v3 + with: + name: build-artifacts-${{ steps.workflow-prep-step.outputs.stringified-workflow-name }}-${{ github.run_number }} + path: ${{ env.FLINK_ARTIFACT_DIR }}/${{ env.FLINK_ARTIFACT_FILENAME }} + if-no-files-found: error + # use minimum here because we only need these artifacts to speed up the build + retention-days: 1 + + packaging: + name: "Test packaging/licensing" + needs: compile + runs-on: ubuntu-latest + container: + image: chesnay/flink-ci:java_8_11_17_21_maven_386 + options: --init + + steps: + - name: "Flink Checkout" + uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + persist-credentials: false Review Comment: wondering if this could be moved into a composite action? ########## .github/workflows/template.pre-compile-checks.yml: ########## @@ -0,0 +1,109 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This workflow collects all checks that do not require compilation and are, therefore, +# JDK independent. + +name: "Pre-compile Checks" + +on: + workflow_dispatch: + inputs: + jdk_version: + description: "The JDK version that shall be used as a default within the Flink CI Docker container." + default: "8" + type: choice + options: ["8", "11", "17"] + branch: + description: "The branch the source code analysis should run on." + default: "master" + type: string + + workflow_call: + inputs: + jdk_version: + description: "The JDK version that shall be used as a default within the Flink CI Docker container." + default: 8 + type: number + branch: + description: "The branch the source code analysis should run on." + default: "master" + type: string + +permissions: read-all + +# This workflow should only contain steps that do not require the compilation of Flink (and therefore, are +# independent of the used JDK) +jobs: + qa: + name: "Basic QA" + runs-on: ubuntu-latest + container: + image: chesnay/flink-ci:java_8_11_17_21_maven_386 + options: --init + + steps: + - name: "Flink Checkout" + uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + persist-credentials: false + + - name: "Set JDK version to Java ${{ inputs.jdk_version }}" + uses: "./.github/actions/set_java_in_container" + with: + jdk_version: ${{ inputs.jdk_version }} + + - name: "Checkstyle" + uses: "./.github/actions/run_mvn" + with: + maven-parameters: "checkstyle:check -T1C" + + - name: "Spotless" + if: (success() || failure()) + uses: "./.github/actions/run_mvn" + with: + maven-parameters: "spotless:check -T1C" + + - name: "License Headers" + if: (success() || failure()) + uses: "./.github/actions/run_mvn" + with: + maven-parameters: "org.apache.rat:apache-rat-plugin:check -N" + + docs-404-check: + name: "Docs 404 Check" + runs-on: ubuntu-latest + container: + image: chesnay/flink-ci:java_8_11_17_21_maven_386 + steps: + - name: "Checks out Flink" + uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + persist-credentials: false + + - name: "Mark GHA checkout as a safe directory (workaround for https://github.com/actions/checkout/issues/1169)" + run: git config --system --add safe.directory $GITHUB_WORKSPACE + shell: bash + + - name: "Check if PR contains docs change" + run: | + source ./tools/azure-pipelines/build_properties.sh Review Comment: Does this genuinely work as-is on GHA? -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org