4. Project opinions

In this section we will go through the assumptions we’ve made in the project structure and project properties.

4.1 Cloud Foundry project opinions

We’ve taken the following opinionated decisions for a Cloud Foundry based project:

  • application built using Maven or Gradle wrappers
  • application deployment to Cloud Foundry
  • you application needs a manifest.yml Cloud Foundry descriptor
  • For Maven (example project):

    • usage of Maven Wrapper
    • settings.xml is parametrized to pass the credentials to push code to Artifactory

      • M2_SETTINGS_REPO_ID - server id for Artifactory / Nexus deployment
      • M2_SETTINGS_REPO_USERNAME - username for Artifactory / Nexus deployment
      • M2_SETTINGS_REPO_PASSWORD - password for Artifactory / Nexus deployment
    • artifacts deployment by ./mvnw clean deploy
    • stubrunner.ids property to retrieve list of collaborators for which stubs should be downloaded
    • repo.with.binaries property - (Injected by the pipeline) will contain the URL to the repo containing binaries (e.g. Artifactory)
    • distribution.management.release.id property - (Injected by the pipeline) ID of the distribution management. Corresponds to server id in settings.xml
    • distribution.management.release.url property - (Injected by the pipeline) Will contain the URL to the repo containing binaries (e.g. Artifactory)
    • running API compatibility tests via the apicompatibility Maven profile
    • latest.production.version property - (Injected by the pipeline) will contain the latest production version for the repo (retrieved from Git tags)
    • running smoke tests on a deployed app via the smoke Maven profile
    • running end to end tests on a deployed app via the e2e Maven profile
  • For Gradle (example project check the gradle/pipeline.gradle file):

    • usage of Gradlew Wrapper
    • deploy task for artifacts deployment
    • REPO_WITH_BINARIES_FOR_UPLOAD env var - (Injected by the pipeline) will contain the URL to the repo containing binaries (e.g. Artifactory)
    • M2_SETTINGS_REPO_USERNAME env var - Username used to send the binary to the repo containing binaries (e.g. Artifactory)
    • M2_SETTINGS_REPO_PASSWORD env var - Password used to send the binary to the repo containing binaries (e.g. Artifactory)
    • running API compatibility tests via the apiCompatibility task
    • latestProductionVersion property - (Injected by the pipeline) will contain the latest production version for the repo (retrieved from Git tags)
    • running smoke tests on a deployed app via the smoke task
    • running end to end tests on a deployed app via the e2e task
    • groupId task to retrieve group id
    • artifactId task to retrieve artifact id
    • currentVersion task to retrieve the current version
    • stubIds task to retrieve list of collaborators for which stubs should be downloaded
  • For PHP (example project):

    • usage of Composer
    • composer install is called to fetch libraries
    • the whole application is compressed to tar.gz and uploaded to binary storage

      • REPO_WITH_BINARIES_FOR_UPLOAD env var - (Injected by the pipeline) will contain the URL to the repo containing binaries (e.g. Artifactory)
      • M2_SETTINGS_REPO_USERNAME env var - Username used to send the binary to the repo containing binaries (e.g. Artifactory)
      • M2_SETTINGS_REPO_PASSWORD env var - Password used to send the binary to the repo containing binaries (e.g. Artifactory)
    • group-id Composer task that echos the group id
    • app-name Composer task that echos application name
    • test-apicompatibility Composer task that is executed for api compatibility tests
    • test-smoke Composer task that is executed for smoke testing (APPLICATION_URL and STUBRUNNER_URL env vars are available here to be used)
    • test-e2e Composer task that is executed for end to end testing (APPLICATION_URL env vars is available here to be used)
    • target is assumed to be the output folder. Put it to .gitignore
  • For NodeJS (example project):

    • usage of npm
    • npm install is called to fetch libraries
    • npm test is called to run tests
    • npm run group-id npm task that echos the group id
    • npm run app-name npm task that echos application name
    • npm run test-apicompatibility npm task that is executed for api compatibility tests
    • npm run test-smoke npm task that is executed for smoke testing
    • npm run test-e2e npm task that is executed for end to end testing
    • target is assumed to be the output folder. Put it to .gitignore

4.2 Kubernetes project opinions

We’ve taken the following opinionated decisions for a Cloud Foundry based project:

  • application built using Maven or Gradle wrappers
  • application deployment to Kubernetes
  • The produced Java Docker image needs to allow passing of system properties via SYSTEM_PROPS env variable
  • For Maven (example project):

    • usage of Maven Wrapper
    • settings.xml is parametrized to pass the credentials to push code to Artifactory and Docker repository

      • M2_SETTINGS_REPO_ID - server id for Artifactory / Nexus deployment
      • M2_SETTINGS_REPO_USERNAME - username for Artifactory / Nexus deployment
      • M2_SETTINGS_REPO_PASSWORD - password for Artifactory / Nexus deployment
      • DOCKER_SERVER_ID - server id for Docker image pushing
      • DOCKER_USERNAME - username for Docker image pushing
      • DOCKER_PASSWORD - password for Docker image pushing
      • DOCKER_EMAIL - email for Artifactory / Nexus deployment
    • DOCKER_REGISTRY_URL env var - (Overridable - defaults to DockerHub) URL of the Docker registry
    • DOCKER_REGISTRY_ORGANIZATION - env var containing the organization where your Docker repo lays
    • artifacts and Docker image deployment by ./mvnw clean deploy
    • stubrunner.ids property to retrieve list of collaborators for which stubs should be downloaded
    • repo.with.binaries property - (Injected by the pipeline) will contain the URL to the repo containing binaries (e.g. Artifactory)
    • distribution.management.release.id property - (Injected by the pipeline) ID of the distribution management. Corresponds to server id in settings.xml
    • distribution.management.release.url property - (Injected by the pipeline) Will contain the URL to the repo containing binaries (e.g. Artifactory)
    • deployment.yml contains the Kubernetes deployment descriptor
    • service.yml contains the Kubernetes service descriptor
    • running API compatibility tests via the apicompatibility Maven profile
    • latest.production.version property - (Injected by the pipeline) will contain the latest production version for the repo (retrieved from Git tags)
    • running smoke tests on a deployed app via the smoke Maven profile
    • running end to end tests on a deployed app via the e2e Maven profile
  • For Gradle (example project check the gradle/pipeline.gradle file):

    • usage of Gradlew Wrapper
    • deploy task for artifacts deployment
    • REPO_WITH_BINARIES_FOR_UPLOAD env var - (Injected by the pipeline) will contain the URL to the repo containing binaries (e.g. Artifactory)
    • M2_SETTINGS_REPO_USERNAME env var - Username used to send the binary to the repo containing binaries (e.g. Artifactory)
    • M2_SETTINGS_REPO_PASSWORD env var - Password used to send the binary to the repo containing binaries (e.g. Artifactory)
    • DOCKER_REGISTRY_URL env var - (Overridable - defaults to DockerHub) URL of the Docker registry
    • DOCKER_USERNAME env var - Username used to send the the Docker image
    • DOCKER_PASSWORD env var - Password used to send the the Docker image
    • DOCKER_EMAIL env var - Email used to send the the Docker image
    • DOCKER_REGISTRY_ORGANIZATION - env var containing the organization where your Docker repo lays
    • deployment.yml contains the Kubernetes deployment descriptor
    • service.yml contains the Kubernetes service descriptor
    • running API compatibility tests via the apiCompatibility task
    • latestProductionVersion property - (Injected by the pipeline) will contain the latest production version for the repo (retrieved from Git tags)
    • running smoke tests on a deployed app via the smoke task
    • running end to end tests on a deployed app via the e2e task
    • groupId task to retrieve group id
    • artifactId task to retrieve artifact id
    • currentVersion task to retrieve the current version
    • stubIds task to retrieve list of collaborators for which stubs should be downloaded