Build the yarn and composer images for Professor M's School for Gifted Coders
1.2K
Professor M's School for Gifted Coders is a module loadable package that can be installed in Sugar. The following sections explain more about the scenario and how to install the package and sample data.
Setting up your development environment
Generating the Professor M module loadable packages locally
Continuous integration with Travis CI
Continuous integration with Jenkins
How to fix your Sugar instance without starting completely over
Professor M aka Professor Marum has created an exclusive not-for-profit school for gifted coders.
Learn more about the implemented Use Cases in the docs.
Want a quick summary? Watch the video below.

Watch the video below for instructions on how to install the scenario. Text-based instructions follow.

disable_unknown_platforms property is set to false or is not in the file.We've created a custom package you can install. The package will create and customize the modules you'll need for the scenario. The following instructions will walk you throw how to install the package.
Hint for Windows users: If you receive a warning with the message "Full extraction path exceed MAXPATHLEN (260)...", try the following:
package/src directory have been deemed short
enough to be included in a typical Windows installation and you will need to generate the zips yourself locally
on your own machine (see Generating the Professor M module loadable packages locally
for instructions on how to do so).If the above installation still fails due to a MAXPATHLEN error, we recommend generating the zips yourself locally on your own machine. See Generating the Professor M module loadable packages locally for instructions on how to do so.
Sugar will display many modules by default that you will not be using while working on the tutorials. To make things simpler, we'll hide the modules that won't be used and rearrange the modules that are displayed.
In order to create the Professor M sample data, you'll use Postman to run a collection of Sugar REST API calls. Each call in the collection has one or more simple tests associated with it to ensure the call was successful.
If you are using an Enterprise or Ultimate edition of Sugar, you can use the features that leverage Advanced Workflow. Save a copy of ProfessorM_PostmanCollection_AdvancedWorkflow.json and (https://raw.githubusercontent.com/sugarcrm/school/master/data/Application_Routing.bpm) to your local filesystem. Update the reference to Application_Routing.bpm in ProfessorM_PostmanCollection_AdvancedWorkflow.json to point to your local filesystem location for that file. Then follow the steps above to import the collection and run it.
If you want to generate the Professor M module loadable packages yourself or make changes to the code in this repo, you will need to set up a development environment. You do NOT need to set up a development environment if you simply want to install the Professor M scenario as-is in your Sugar instance.
school/package directory in order to install the dependencies:composer install
You may also want to set up your development environment so you can execute the unit tests. See Automated tests for more information.
Professor M's School is open source, and we would love for you to get involved! Below are some ways you can contribute to this project:
We utilize ZenHub to organize our backlog and track our Issues. You can view our ZenHub board inside the GitHub web interface if you have a ZenHub browser extension installed. You can also view our ZenHub board at https://app.zenhub.com/workspace/o/sugarcrm/school/boards?repos=109023666.
When viewing our ZenHub board, you can view our prioritized backlog as well which stories are currently in progress, blocked, under review, and closed.
The Professor M module loadable packages can be found on the Releases page of this GitHub repo. You may want to generate the module loadable packages yourself if you are a Windows user with a long Sugar directory path or if you want to make changes to the package.
package directory inside of your school directory../pack.php -v versionNameOrNumber./pack.php -v versionNameOrNumber -w lengthOfWindowsSugarDirectoryPathThis repository is configured to work with Travis CI. Whenever a commit is pushed to the repository or a Pull Request is made, Travis CI will automatically kick off a build.
You can view the Travis CI build results at https://travis-ci.org/sugarcrm/school.
You can view the latest build status at the top of this README ().
Clicking on the build status will open the detailed results in Travis CI.
You can also view build results in Pull Requests. Toward the bottom of each Pull Request, you can click "Show all checks" to see the Travis CI build results for that Pull Request.

You can then click Details to open the build results in Travis CI.

The build has four Environment Variables that have been configured in the project settings in Travis CI:

The build is configured in .travis.yml. Currently, the build has three stages:
All of the jobs in each stage must pass before the jobs in the following stage will begin.
The Test PackageGenerator stage is run first and has two jobs:
The next stage to run is the Run Tests stage. Each job in this stage deploys Sugar, installs the Professor M Module Loadable Package, runs the setup for the PHPUnit tests that Sugar provides, runs the PHPUnit tests written specifically for our Professor M Module Loadable Package, and runs the Postman tests. Each job in this stage is run against a different combination of Sugar versions and editions. See PHPUnit tests for the Professor M Module Loadable Package for details.
The final stage to run is the Build & Post on GitHub stage. Note that this stage is only run when the branch is Master. This stage executes the pack.php script to generate the Professor M Module Loadable Packages as zips. The zips will be automatically posted to GitHub: https://github.com/sugarcrm/school/releases.
If you want the Build & Post on GitHub stage to be kicked off for a branch other than master, you should do both of the following in .travis.yml.
stages section deploy:
provider: releases
file: releases/sugarcrm-ProfessorM-latest.zip
api_key:
secure: mykey
skip_cleanup: true
on:
branch: mybranchname
This repository can be configured for continuous integration with Jenkins. Jenkins can be configured so that whenever a commit is pushed to the repository or at certain time intervals, Jenkins will automatically kick off a build.
Before beginning, you'll need to set up your own installation of Jenkins. Check out the Jenkins Installation Guide for more details.
To help you get started, we have provided PrepareJenkinsDockerContainer.sh that you can run to start Jenkins inside of a Docker container. The machine or container where Jenkins is running will need to have Docker Compose and Perl installed. PrepareJenkinsDockerContainer.sh will take care of installing both for you. If you use PrepareJenkinsDockerContainer.sh, you should be able to access Jenkins at http://localhost:8080.
We recommend installing the Jenkins suggested plugins. You will also need to install the EnvInject Plugin.
The build you will create in Jenkins needs access to credentials and configurations. We will store these using Jenkins Credentials.
The instructions below will walk you through how to create the necessary credentials and configurations. For more information on how to store credentials in Jenkins, see Credentials Binding Plugin.
Now you're ready to create a new project in Jenkins that will build the school project.
On the Jenkins dashboard, click New Item.
Name your new item something like ProfessorM.
Select Freestyle project and click OK. The item configuration page will display.
In the Source Code Management section, select Git.
Input your Repository URL (for example, https://github.com/sugarcrm/school) and select the GitHub credentials you
created in the previous section.
Configure the Build Triggers section as you'd like. If you do not want to configure this now, you can skip this step and manually trigger the builds instead.
In the Build Environment section, select the Delete workspace before build starts option and the Use secret text(s) or file(s) option.
In the Bindings section, select Add > Username and password (separated). Then input the following:
GITHUB_USERNAMEGITHUB_PASSWORDIn the Bindings section, select Add > Username and password (separated). Then input the following:
SUGARCRM_USERNAMESUGARCRM_PASSWORDIn the Bindings section, select Add > Secret text. Then input the following:
SUGAR_LICENSE_KEYIn the Bindings section, select the Inject environment variables to the build process checkbox. If you do not see this checkbox, you may need to install the EnvInject Plugin. Then...
/Users/lschaefer/jenkins and your Jenkins project is named ProfessorM, you would input the following:
WORKSPACE_PATH=/Users/lschaefer/jenkins/workspace/ProfessorMPATH_TO_SUGAR_DOCKER_ON_HOST=$WORKSPACE_PATH/scripts/workspace/sugardocker
If you want to customize where Sugar Docker is stored, you can update this variable to reflect that.In the Build section, click Add build step and select Execute shell.
In the Command box that appears, input the following:
# The Sugar version you want to test
SUGAR_VERSION="7.11"
# The Sugar Edition you want to test. Options: Pro, Ent, and Ult
SUGAR_EDITION="Ent"
# Path to where the Sugar Docker directory should be stored. If you do not have a preference, leave this as is.
SUGAR_DOCKER_DIRECTORY="workspace/sugardocker"
# This variable is completely optional. If you want to store the Sugar source zips on your local machine instead
# of downloading them from the SugarCRM Developer Builds space or Sugar Store, input the path to where the Sugar
# source zips are stored. For example: /var/sugardocker/data/app/sugar_source_zips. Note that your Sugar source zips
# MUST follow this naming convention: Sugar$sugarEdition-$sugarVersion.zip (for example: SugarEnt-7.11.zip).
# SUGAR_SOURCE_ZIPS_DIRECTORY=""
cd scripts
bash -ex RunPackUnitTestsAndBuildProfMPackage.sh $SUGAR_WORKSPACE_PATH
bash SetupEnvAndRunTests.sh $SUGARCRM_USERNAME $SUGARCRM_PASSWORD $SUGAR_VERSION $SUGAR_EDITION $GITHUB_USERNAME $GITHUB_PASSWORD $SUGAR_DOCKER_DIRECTORY $SUGAR_SOURCE_ZIPS_DIRECTORY
Be sure to update the variables appropriately.
In the Post-build Actions section, click Add post-build action and select Archive the artifacts.
In the Files to archive box that appears, input the following: package/releases/*.zip
Click Save.
Once you have your Jenkins project created, it's time to see if it works!
Navigate to your ProfessorM project in Jenkins. Trigger your build manually by clicking Build Now.
View the Build History panel to quickly browse the build results. If you see a blue dot, you know all of the tests passed!

Click on a build to view more details. If the build passed, the Professor M module loadable packages will be stored as build artifacts.

To see more details on a build, click Console Output. If any step in the process fails (for example, a Jasmine test fails), the remaining steps will not be run. If everything succeeds, you'll be able to find the Jasmine test results for PackageGenerator, the PHPUnit test results for PackageGenerator, the PHPUnit test results for Sugar, the PHPUnit tests for the Professor M Module Loadable Package, and the results of the Professor M module loadable packages being generated, copied, and archived.
Jasmine results for PackageGenerator:

PHPUnit results for PackageGenerator:

PHPUnit results for the Professor M Module Loadable Package:

Postman test results:

Professor M package results:

Tip: If you see errors in the Console Output about git not being found, you may need to update your Jenkins configuration.
On the Jenkins dashboard, click Manage Jenkins. Click Conifgure System. In the Global Properties section,
enable the Tool Locations checkbox. In the Name box, select (Git) Default. In the Home box, input the path
to the Git installation (for example, /usr/bin/git). Click Save.
Tip for those running Jenkins in Docker: If you see errors in the Console Output similar to 'Fatal error: Unable to
find local grunt', you may need to update your Jenkins job. The likely cause is that your
$SUGAR_WORKSPACE_PATH is not pointing to the path of the workspace that is storing the school repo's files that are being pulled out of
GitHub. You can diagnose if this is the issue by adding docker exec my-yarn pwd and `docker exec my-yarn ls
Content type
Image
Digest
Size
247.8 MB
Last updated
over 7 years ago
docker pull sugarcrmdev/school:yarn