diff --git a/.github/actions/env-load-from-yaml/action.yml b/.github/actions/env-load-from-yaml/action.yml index b52d592ca..dcae34f5f 100644 --- a/.github/actions/env-load-from-yaml/action.yml +++ b/.github/actions/env-load-from-yaml/action.yml @@ -1,5 +1,5 @@ name: "env-load-from-yaml" -description: "Mimic loading of a yaml with globals to ease migration from Travis CI" +description: "Load environment variables from a yaml file" inputs: ignore_regex: description: "Bash regex to ignore certain lines" diff --git a/docs/README.md b/docs/README.md index 96328821e..b436d58c2 100644 --- a/docs/README.md +++ b/docs/README.md @@ -19,7 +19,6 @@ Here follows the list of GitHub Actions topics available in the current document - [Setup Maven Credentials](#setup-maven-credentials) - [Setup Maven Build Options](#setup-maven-build-options) - [GitHub Actions provided by community](#github-actions-provided-by-community) - - [Auto cancel builds](#auto-cancel-builds) - [Docker build and push](#docker-build-and-push) - [Docker login](#docker-login) - [EC2 GitHub runner](#ec2-github-runner) @@ -159,9 +158,6 @@ env: run: mvn deploy ${{ env.MAVEN_CLI_OPTS }} -DskipTests ``` -When migrating from Travis, depending on the previous configuration, docker.skip and docker.tag properties might need -to be setup on the command line. - Here is a sample way to extract a branch name that would be used for docker images built with the `build-and-push-docker-images.sh` script, although using the [dedicated action](#docker-build-and-push) can also be useful. @@ -176,10 +172,6 @@ useful. ## GitHub Actions provided by community -### Auto cancel builds - -[This action](https://github.com/styfle/cancel-workflow-action) is a replacement for the Travis settings **Auto cancel branch builds** and **Auto cancel pull request builds**. - ### Docker build and push Consider using this official [Docker action](https://github.com/marketplace/actions/build-and-push-docker-images) for building and pushing containers instead of doing it by hand, for buildx support, caching and more. @@ -515,9 +507,7 @@ Examples: ### env-load-from-yaml -To ease the migration to GitHub Actions of repositories that contains one or -more yaml files containing an `env.global` section of Travis CI. It supports env vars -referencing as value env vars defined early in the file (like Travis does). +Load environment variables from a yaml file ```yaml - uses: Alfresco/alfresco-build-tools/.github/actions/env-load-from-yaml@ref diff --git a/docs/travis.md b/docs/travis.md deleted file mode 100644 index b1f65097e..000000000 --- a/docs/travis.md +++ /dev/null @@ -1,111 +0,0 @@ -# Travis - -- [Travis](#travis) - - [Travis snippets](#travis-snippets) - - [Migrate from Travis to GitHub Actions](#migrate-from-travis-to-github-actions) - - [Default environment variables](#default-environment-variables) - - [Get back maven build output](#get-back-maven-build-output) - - [Workflow schema validation](#workflow-schema-validation) - - [Retrieve secure environment variables in Travis](#retrieve-secure-environment-variables-in-travis) - -## Travis snippets - -This repository provides in the root directory a bunch of common configuration -files that can be imported in any travis.yml by adding: - -```yaml -import: - - source: Alfresco/alfresco-build-tools:.travis..yml@master -``` - -Travis snippets should be considered in maintenance mode only since we are actively -migrating all of our repos to GitHub Actions. - -## Migrate from Travis to GitHub Actions - -Before starting migrating your first repository, make sure you read [Migrating from Travis CI to GitHub Actions](https://docs.github.com/en/actions/migrating-to-github-actions/migrating-from-travis-ci-to-github-actions). - -Hosted runners come with many bundled packages, see -[Available Environments](https://github.com/actions/virtual-environments#available-environments) -for details of what is already available when running GitHub Actions. - -Here follows a table to ease migrating Travis build that were using config offered by this repo: - -| Travis CI config file | GitHub Actions replacement | -|-------------------------------------------|-------------------------------------------------------------------------------| -| .travis.aws-iam-authenticator_install.yml | Not yet determined | -| .travis.awscli_install.yml | Preinstalled | -| .travis.checkov_install.yml | [bridgecrewio/checkov-action](https://github.com/bridgecrewio/checkov-action) | -| .travis.common.yml | Outdated: use equivalent steps in the workflow | -| .travis.docker-buildx_install.yml | [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | -| .travis.docker_hub_login.yml | [docker/login-action](README.md#docker-login) | -| .travis.docker_login.yml | [docker/login-action](README.md#docker-login) | -| .travis.gh_install.yml | Preinstalled | -| .travis.helm-docs_install.yml | [setup-helm-docs](/.github/actions/setup-helm-docs/action.yml) | -| .travis.helm.yml | Not yet determined | -| .travis.helm_install.yml | Preinstalled | -| .travis.home_bin_path.yml | Not yet determined | -| .travis.java.yml | See [Java Setup section](README.md#setup-maven-build-options) | -| .travis.java_config.yml | See [Java Setup section](README.md#java-setup) | -| .travis.java_docker.yml | See [Java Setup section](README.md#setup-maven-build-options) | -| .travis.jq_install.yml | Preinstalled | -| .travis.kcadm_install.yml | Not yet determined | -| .travis.kubepug_install.yml | [setup-kubepug](/.github/actions/setup-kubepug/action.yml) | -| .travis.kubernetes_install.yml | Preinstalled | -| .travis.maven_config.yml | See [Java Setup section](README.md#java-setup) | -| .travis.pre-commit.yml | [pre-commit](/.github/actions/pre-commit) | -| .travis.rancher_cli_config.yml | [setup-rancher-cli](/.github/actions/setup-rancher-cli/action.yml) | -| .travis.rancher_cli_install.yml | [setup-rancher-cli](/.github/actions/setup-rancher-cli/action.yml) | -| .travis.rancher_cli_kubernetes_config.yml | [setup-rancher-cli](/.github/actions/setup-rancher-cli/action.yml) | -| .travis.srcclr_install.yml | Not yet determined | -| .travis.terraform-docs_install.yml | [setup-terraform-docs](/.github/actions/setup-terraform-docs/action.yml) | -| .travis.terraform_install.yml | Preinstalled | -| .travis.tflint_install.yml | Not yet determined | -| .travis.trigger.yml | Not yet determined | -| .travis.veracode.yml | [veracode](/.github/actions/veracode) | -| .travis.yq_install.yml | Preinstalled | - -### Default environment variables - -| Travis CI | GitHub Actions | -|---------------------|-------------------------| -| ${TRAVIS_BRANCH} | ${{ github.ref_name }} | -| ${TRAVIS_BUILD_DIR} | ${{ github.workspace }} | -| ${TRAVIS_COMMIT} | ${{ github.sha }} | - -### Get back maven build output - -Travis is very strict regarding maximum size of the build logs output and builds -that exceed 5MB in output will fail with `The job exceeded the maximum log -length, and has been terminated`. GitHub Actions doesn't have this kind of -limitation and it's highly recommended to **remove any logs suppression** of the -build tool. - -With Maven this is usually achieved by using the `-q` option, that is usually -set globally inside the `MAVEN_CLI_OPTS` environment variable. Please remove any -usage of `-q` when migrating from Travis. - -### Workflow schema validation - -The `.pre-commit-config.yaml` configuration should be updated to remove the obsolete `check-travis` hook and replace it with `check-github-workflows`. -Note that a recent version of the `check-jsonschema` hook should be used to support reusable workflows. -Here is a sample configuration: - -```yml - - repo: https://github.com/sirosen/check-jsonschema - rev: 0.17.0 - hooks: - - id: check-github-workflows - - id: check-jsonschema - alias: check-dependabot - name: "Validate Dependabot Config" - files: '.github/dependabot\.yml$' - args: ["--schemafile", "https://json.schemastore.org/dependabot-2.0.json"] -``` - -### Retrieve secure environment variables in Travis - -In order to migrate credentials from Travis secure environment variables to GitHub Actions secrets, you may need to retrieve the current values from the existing Travis build if those credentials were not stored elsewhere (e.g. password manager). - -- If the repository is private, you can simply run a debug build and retrieve current values just by doing an `echo $SECURE_VAR`. -- If the repository is public, then debug builds are not available but you can encrypt values with a new secret so you can securely retrieve them from the build logs using the `ccrypt` utility, as described [here](https://stackoverflow.com/a/59165606/547195)