Skip to content

Commit

Permalink
Merge pull request #42 from ec-europa/develop
Browse files Browse the repository at this point in the history
Release beta7: hotfix and improvements
  • Loading branch information
verbruggenalex authored Nov 21, 2017
2 parents 11232b2 + 650c1e1 commit e37ca9b
Show file tree
Hide file tree
Showing 23 changed files with 769 additions and 458 deletions.
26 changes: 13 additions & 13 deletions .jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,34 @@ def createWorkflow() {
])

// Set some variables.
def buildId = sh(returnStdout: true, script: 'date | md5sum | head -c 5').trim()
def buildName = "${env.JOB_NAME}".replaceAll('ec-europa/','').replaceAll('-reference/','').replaceAll('/','_').replaceAll('-','_').trim()
def buildLink = "<${env.BUILD_URL}consoleFull|${buildName} #${env.BUILD_NUMBER}>"
def repoName = sh(returnStdout: true, script: 'git config remote.origin.url').trim().replaceAll('https://github.com/', '').replaceAll('-reference\\.git', '')
def branchName = "${env.BRANCH_NAME}"
def repoUrl = sh(returnStdout: true, script: 'git config remote.origin.url').trim().replaceAll('\\.git', '')
def buildLink = "<${env.BUILD_URL}consoleFull|build #${env.BUILD_NUMBER}> for <${repoUrl}|${repoName}> on ${branchName}"
def buildName = "${repoName}-${branchName}-${env.BUILD_NUMBER}".replaceAll('/', '-')

withEnv(["COMPOSE_PROJECT_NAME=${buildName}_${buildId}","WORKSPACE=${env.WORKSPACE}","PATH+toolkit=${env.WORKSPACE}/vendor/ec-europa/toolkit/bin"]) {

withEnv(["COMPOSE_PROJECT_NAME=${buildName}","WORKSPACE=${env.WORKSPACE}","PATH+toolkit=${env.WORKSPACE}/vendor/ec-europa/toolkit/bin"]) {

stage('Init') {
setBuildStatus("Build started.", "PENDING");
slackSend color: "good", message: "Subsite build ${buildLink} started."
slackSend color: "good", message: "Subsite ${buildLink} started."
shellExecute('jenkins', 'phing', "docker-compose-up -D'docker.project.id'='${env.COMPOSE_PROJECT_NAME}'")
sh './resources/composer/scripts/post-install-cmd/install-reps-platform || true'
sh './resources/composer/scripts/post-install-cmd/install-nems-platform || true'
shellExecute('docker', 'phing', 'toolkit-starterkit-upgrade')
}

try {
stage('Check') {
//shellExecute('docker', 'phing', 'test-run-phpcs')
stage('Phpcs') {
shellExecute('docker', 'phing', 'test-run-phpcs')
}

stage('Build') {
shellExecute('docker', 'phing', 'build-platform build-subsite-dev')
}
stage('Install') {
stage('Clone') {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'ASDA', usernameVariable: 'ASDA_USER', passwordVariable: 'ASDA_PASS']]) {
shellExecute('docker', 'phing', "install-clone -Ddrupal.db.name=${env.COMPOSE_PROJECT_NAME} -Ddb.dl.username=$ASDA_USER -Ddb.dl.password=$ASDA_PASS")
}
}
stage('Test') {
stage('Behat') {
timeout(time: 2, unit: 'HOURS') {
shellExecute('docker', 'phing', 'test-run-behat')
}
Expand All @@ -51,6 +50,7 @@ def createWorkflow() {
} finally {
shellExecute('jenkins', 'phing', "docker-compose-stop -D'docker.project.id'='${env.COMPOSE_PROJECT_NAME}'")
shellExecute('jenkins', 'phing', "docker-compose-down -D'docker.project.id'='${env.COMPOSE_PROJECT_NAME}'")
slackSend color: "good", message: "Subsite build ${buildLink} ended succesfully."
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/configuring-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ of your project.
This file is never loaded into active configuration and purely acts as an
overview of all build properties that are available to you.

<details><summary>Example of the <code>build.default.project</code> file</summary><p>
<details><summary>Example of the <code>build.default.props</code> file</summary><p>

```yaml
# Toolkit location: ./includes/phing/build/boot.props
Expand Down
161 changes: 89 additions & 72 deletions docs/upgrading.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,108 @@
## Upgrade from 2.0.x to 3.0.x
## Upgrade subsite-starterkit to toolkit

Subsite Starterkit 3.0.0 introduces itself as a Composer package. In order
to provide that a new building procedure has been put in place. These
upgrade instructions assume that your subsite is a "git fork" of the old
repository at https://github.com/ec-europa/subsite-starterkit.
<a href="http://www.youtube.com/watch?feature=player_embedded&v=cwGZilB3BjQ
" target="_blank"><img src="http://img.youtube.com/vi/cwGZilB3BjQ/0.jpg"
alt="Upgrade screencast" width="50%" align="left" /></a>

### 1.1 Phing upgrade
This screencast explains how to upgrade a subsite-starterkit based project to
the composer package based toolkit. To complete the upgrade you need to execute
the 5 steps listed below in the upgrade steps. After the upgrade you might have
to fix some files that may have been altered by the upgrade script. It is best
to use a dedicated branch for the upgrade so your master branch stays unaffected
until the pull request has been merged into the master of reference.

If your project has no custom Phing targets and has not altered any composer
files that were provided by the subsite-starterkit you should not encounter any
problems during this upgrade process.

### Upgrade guide

#### Up-to-date branch

Check out new dedicated branch and make sure it is up to date with master of the
reference repository.

>```bash
> git checkout -b starterkit/upgrade
> git remote add reference https://github.com/ec-europa/<project-id>-reference.git
> git fetch reference
> git merge reference/master
>```
#### Upgrade steps
These are the 5 steps needed to complete the upgrade.
>```bash
> curl https://raw.githubusercontent.com/ec-europa/toolkit/master/includes/templates/subsite/composer.json > composer.json
> curl https://raw.githubusercontent.com/ec-europa/toolkit/master/includes/templates/subsite/build.xml > build.xml
> rm -rf ./vendor ./bin ./composer.lock
> composer install
> ./toolkit/phing toolkit-upgrade-starterkit
> ./toolkit/phing toolkit-starterkit-upgrade
>```
The biggest structural change is in the lib folder. Because of the new symlink system the structure in the build folder will match the structure in the lib folder. To align all projects we request to make the following lib structure:
* libraries
* modules
* custom
* features
* profiles (platform only)
* src
* themes
Other tasks that need to happen:
- merge the projects gitignore with the new toolkit gitignore file. This
will probably happen through a build target.
- remove the build-custom target from the build.project.xml. Toolkit
should provide a new template if the original one wasn't altered.
-
### 1.2 Manual process
Manually delete all files that are only specific to the starterkit.
Below is a list of files *to keep*. So anything not mentioned below should
be deleted.
<b>Starterkit 3.0.0 templates</b>: (fetch)
>
#### Gitignore
After the upgrade is complete you should check what files have changed and that
your gitignore file does not allow to commit new files placed by the toolkit. If
you want to make sure you have a correct gitignore file you can download it from
the toolkit subsite templates folder.
>```bash
>- composer.json
>- build.xml
>- Jenkinsfile
> git status
> curl https://raw.githubusercontent.com/ec-europa/toolkit/master/includes/templates/subsite/.gitignore > .gitignore
> git status
>```
<b>Subsite specific files</b>: (to keep)
>
>```bash
>- .git/
>- .gitattributes
>- .gitignore
>- build.project.props
>- lib/features/*
>- lib/modules/*
>- lib/themes/*
>- resources/site.make
>- resources/composer.json
>- resources/composer.lock
>- tests/*
> ```
<b>Subsite specific files</b>: (to keep and rename)
>
#### Files renamed
Good to know is that there have been some files renamed. Here is a list of the
most important ones.
|subsite-starterkit|toolkit|Description|
|:---|:---|:---|
|./resources/phpcs-custom.xml|./phpcs-ruleset.xml|The phpcs exclusion rules defined by the project.|
|./resources/build.custom.xml|./build.project.xml|Custom Phing build targets defined by the project.|
|./build.properties|./build.project.props|Properties defined by the project.|
|./build.properties.dist|./build.default.props|List of all available properties.|
|./build.properties.local|./build.develop.props|Local properties for credentials and developer settings.|
#### Build properties
During the upgrade your build.properties file will be renamed to
build.project.props. In toolkit this file is required for CI purposes and you
need a minimum of properties defined there:
[required.props](../includes/phing/props/required.props)
The toolkit is not backwards compatible with
subsite-starterkit so you might have to rename some properties. View a list
of old property names mapped to new property names here:
[deprecated.props](../includes/phing/build/help/deprecated.props).
#### Phpcs
After you completed the upgrade you also need to make sure your codebase is in
compliance with the new version of coder. To run PHPCS you can use a Phing
target:
>```bash
>- resources/build.custom.xml => ../build.project.xml
>- resources/phpcs-custom.xml => ../phpcs-ruleset.xml
> ./toolkit/phing test-run-phpcs
> ./toolkit/phpcbf
> ./toolkit/phing test-run-phpcs
>```
### 1.3 Upgrade through upstream merge
If you are absolutely certain that you have no starterkit modifications in any other
files then we can let you try an upgrade path. But we do not guarantee a working
starterkit after you merge the branch. So if you decide to merge the upgrade branch,
please use an intermediary to forward a pull request so you can review it fully.
#### Behat
> ```
> $ git checkout -b intermediary
> $ git remote add starterkit https://github.com/ec-europa/subsite-starterkit.git
> $ git fetch starterkit
> $ git merge starterkit/upgrade
> ```
Your ./tests folder is overridden by the `./toolkit/phing toolkit-starterkit-upgrade`
target. The new ./tests folder contains a couple of generic tests that we will
be using on CI tools. If you do not wish to use the generic tests and you have
provided your own you can checkout your own tests again.
And last but not least we should remove the remote that has been replaced by the new
Subsite Starterkit package in your composer.json. Then you are ready to update the
new Subsite Starterkit for the first time.
>```bash
> rm -rf ./tests
> git checkout master ./tests
>```
> ```
> $ git remote rm starterkit
> $ composer update
> ```
After you have made sure all is working correctly you can commit and push your
upgrade. When it's ready for review create a pull request to the reference
repository and a MULTISITE ticket so it can be QA'ed.
2 changes: 1 addition & 1 deletion includes/composer/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"require-dev": {
"behat/behat": "~3.1.0@rc",
"drupal/drupal-extension": "~3.1.0",
"ec-europa/qa-automation": "dev-release/3.0"
"ec-europa/qa-automation": "~3.0.5"
},
"_comment_minimum_stability": "Remove the 'minimum-stability' and 'prefer-stable' directives once new releases of Coder and PHP CodeSniffer are available.",
"minimum-stability": "dev",
Expand Down
Loading

0 comments on commit e37ca9b

Please sign in to comment.