# 2.5 - Integração Contínua

Para que sempre que ocorra um commit o Openshift faça de forma automática o processo de build e deploy, iremos configurar\
um webhook, dessa forma o servidor git avisará o Openshift sempre que um commit novo ocorrer.

## Configuração webhook

Acesse a parte de builds.

![](https://234867593-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAEwgr-WgRQOV34G4b9%2F-LAFPZkxNGM9WP5LMTpH%2F-LAFPj36fuRxaBoqYIpE%2Fmenu_261.png?generation=1523915103782488\&alt=media)

Depois selecione `workshop-ocp`

![](https://234867593-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAEwgr-WgRQOV34G4b9%2F-LAFPZkxNGM9WP5LMTpH%2F-LAFPj416esnREjY7P3n%2FSelection_262.png?generation=1523915104214637\&alt=media)

Clique em `Configuration` e copie o link clicando no icone a direita

![](https://234867593-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAEwgr-WgRQOV34G4b9%2F-LAFPZkxNGM9WP5LMTpH%2F-LAFPj4rB5TQgIvPiU7H%2FSelection_264.png?generation=1523915103806972\&alt=media)

No _Github.com_:

* Selecione `Settings` no menu horizontal

![](https://234867593-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAEwgr-WgRQOV34G4b9%2F-LAFPZkxNGM9WP5LMTpH%2F-LAFPj6CYcCzQiIN4VK8%2FSelection_258.png?generation=1523915104276015\&alt=media)

* Selecione o `Webhooks` no menu lateral esquerdo&#x20;

![](https://234867593-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAEwgr-WgRQOV34G4b9%2F-LAFPZkxNGM9WP5LMTpH%2F-LAFPj7-m3Fj-dkDXwnu%2FSelection_259.png?generation=1523915114809108\&alt=media)

* Selecione `Add Webhooks`, cole a URL copiada no campo `Payload URL`, no campo `Content Type` selecione a opção `application/json`
* Clique em `Disable SSL verification`
* Finalize no botão `Add webhook`

![](https://234867593-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAEwgr-WgRQOV34G4b9%2F-LAFPZkxNGM9WP5LMTpH%2F-LAFPj9UWbEy_I2s1x83%2FSelection_088.png?generation=1523915114788669\&alt=media)

## Altere a aplicação

Para fazermos uma alteração na aplicação, vamos alterar a versão na página inicial da aplicação.

Clique no `Index.php`

![](https://234867593-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAEwgr-WgRQOV34G4b9%2F-LAFPZkxNGM9WP5LMTpH%2F-LAFPjAkWsmGgMBYn2_9%2FSelection_265.png?generation=1523915104908732\&alt=media)

Depois clique no lapis para editar

![](https://234867593-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAEwgr-WgRQOV34G4b9%2F-LAFPZkxNGM9WP5LMTpH%2F-LAFPjBIQDpzAVcSF3h1%2FSelection_266.png?generation=1523915115347871\&alt=media)

No `index.php` altere a linha com a versão da aplicação para versão 2.0.

![](https://234867593-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAEwgr-WgRQOV34G4b9%2F-LAFPZkxNGM9WP5LMTpH%2F-LAFPjCWbDTUaIatWmXN%2FSelection_268.png?generation=1523915104783476\&alt=media)

```
echo "<h1>Openshift Workshop v2.0</h1>";
```

Clique em `Commit changes`

![](https://234867593-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAEwgr-WgRQOV34G4b9%2F-LAFPZkxNGM9WP5LMTpH%2F-LAFPjEKrkbTygfym0Uj%2FSelection_269.png?generation=1523915105455234\&alt=media)

Ou use a linha de comando do git para fazer essa alteraçao:

```bash
git add index.php
git commit -m "webhook adicionado"
git push
```

## Acompanhe o rolling deployment

![](https://234867593-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAEwgr-WgRQOV34G4b9%2F-LAtOOSFrx7YWG8h7NiF%2F-LAtOUmKxuos92lfIfdd%2FScreen%20Shot%202018-04-24%20at%2017.43.06.png?alt=media\&token=cadb4e4c-cc87-4a65-a6e1-47d02e849515)

Observe que não ocorre indisponibilidade durante o deployment
