From d3d268567afd7d7bd95b328a1912c86fda9e5392 Mon Sep 17 00:00:00 2001 From: Pedro Filipe <35262512+puzzledbytheweb@users.noreply.github.com> Date: Wed, 22 Apr 2020 09:48:56 +0100 Subject: [PATCH 1/9] Create gitlab-continuous-integration.md A small recipe with a minimal example on how to setup gitlab ci/cd for a gatsby project --- .../recipes/gitlab-continuous-integration.md | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 docs/docs/recipes/gitlab-continuous-integration.md diff --git a/docs/docs/recipes/gitlab-continuous-integration.md b/docs/docs/recipes/gitlab-continuous-integration.md new file mode 100644 index 0000000000000..0a0cda5f9429f --- /dev/null +++ b/docs/docs/recipes/gitlab-continuous-integration.md @@ -0,0 +1,42 @@ +--- +title: "Recipes: Continuous Integration on Gitlab" +tableOfContentsDepth: 1 +--- + +Push your code to gitlab and automate your production build! + +### Prerequisites + +- A [Gatsby site](/docs/quick-start) +- A [Gitlab](https://gitlab.com/) account + +### Directions + +1. Stop your development server if it is running (`Ctrl + C` on your command line in most cases) + +2. Create a `.gitlab-ci.yml` with the following content: + +``` +image: node:12.16.1 + +cache: + paths: + - node_modules/ + +stages: + - build + +build: + stage: build + script: + - yarn + - yarn build +``` + +3. `git push ` +4. Check out your pipeline working! + +### Additional resources + +- See how you can develop this simple file into something more real world [Gitlab CI/CD Docs](https://docs.gitlab.com/ee/ci/README.html) +- Check this especially to learn how to make your newly build available for a next job - [Gitlab Job Artifacts Docs](https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html) From 29397a251955facdcdc3313f4e0b1ef235540814 Mon Sep 17 00:00:00 2001 From: Pedro Filipe <35262512+puzzledbytheweb@users.noreply.github.com> Date: Wed, 22 Apr 2020 15:48:39 +0100 Subject: [PATCH 2/9] Update docs/docs/recipes/gitlab-continuous-integration.md Co-Authored-By: Obinna Ekwuno --- docs/docs/recipes/gitlab-continuous-integration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/recipes/gitlab-continuous-integration.md b/docs/docs/recipes/gitlab-continuous-integration.md index 0a0cda5f9429f..c5cec8ddb6ad2 100644 --- a/docs/docs/recipes/gitlab-continuous-integration.md +++ b/docs/docs/recipes/gitlab-continuous-integration.md @@ -34,7 +34,7 @@ build: ``` 3. `git push ` -4. Check out your pipeline working! +4. Check out your pipeline under the CI/CD option. ### Additional resources From 40941f72b4cb3c54fb7df34d1baed9815a753ad4 Mon Sep 17 00:00:00 2001 From: Pedro Filipe <35262512+puzzledbytheweb@users.noreply.github.com> Date: Wed, 22 Apr 2020 15:49:03 +0100 Subject: [PATCH 3/9] Update docs/docs/recipes/gitlab-continuous-integration.md Co-Authored-By: Obinna Ekwuno --- docs/docs/recipes/gitlab-continuous-integration.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/docs/recipes/gitlab-continuous-integration.md b/docs/docs/recipes/gitlab-continuous-integration.md index c5cec8ddb6ad2..810fe88796746 100644 --- a/docs/docs/recipes/gitlab-continuous-integration.md +++ b/docs/docs/recipes/gitlab-continuous-integration.md @@ -40,3 +40,5 @@ build: - See how you can develop this simple file into something more real world [Gitlab CI/CD Docs](https://docs.gitlab.com/ee/ci/README.html) - Check this especially to learn how to make your newly build available for a next job - [Gitlab Job Artifacts Docs](https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html) + +- [Getting started with GitLab CI/CD](https://gitlab.com/help/ci/quick_start/README) From 6b92831f7ca91b44be1c1db76cac482dadf40683 Mon Sep 17 00:00:00 2001 From: Pedro Filipe <35262512+puzzledbytheweb@users.noreply.github.com> Date: Wed, 22 Apr 2020 15:55:39 +0100 Subject: [PATCH 4/9] docs: include steps to create a gatsby site --- .../docs/recipes/gitlab-continuous-integration.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/docs/recipes/gitlab-continuous-integration.md b/docs/docs/recipes/gitlab-continuous-integration.md index 810fe88796746..1a3006686da7c 100644 --- a/docs/docs/recipes/gitlab-continuous-integration.md +++ b/docs/docs/recipes/gitlab-continuous-integration.md @@ -7,14 +7,23 @@ Push your code to gitlab and automate your production build! ### Prerequisites -- A [Gatsby site](/docs/quick-start) +- Make sure you have the [Gatsby CLI](https://www.gatsbyjs.org/docs/gatsby-cli) installed - A [Gitlab](https://gitlab.com/) account ### Directions +1. Create a gatsby site +```shell +gatsby new {your-project-name} +``` +2. Change directory and start a development server +```shell +cd {your-project-name} +yarn develop +``` -1. Stop your development server if it is running (`Ctrl + C` on your command line in most cases) +3. Stop your development server (`Ctrl + C` on your command line in most cases) -2. Create a `.gitlab-ci.yml` with the following content: +4. Create a `.gitlab-ci.yml` with the following content: ``` image: node:12.16.1 From 774f65336a0ceb9b454307bfc813b297a83ca9c0 Mon Sep 17 00:00:00 2001 From: Pedro Filipe <35262512+puzzledbytheweb@users.noreply.github.com> Date: Wed, 22 Apr 2020 16:54:55 +0100 Subject: [PATCH 5/9] Update to use relative links Co-Authored-By: Obinna Ekwuno --- docs/docs/recipes/gitlab-continuous-integration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/recipes/gitlab-continuous-integration.md b/docs/docs/recipes/gitlab-continuous-integration.md index 1a3006686da7c..a88551260af52 100644 --- a/docs/docs/recipes/gitlab-continuous-integration.md +++ b/docs/docs/recipes/gitlab-continuous-integration.md @@ -7,7 +7,7 @@ Push your code to gitlab and automate your production build! ### Prerequisites -- Make sure you have the [Gatsby CLI](https://www.gatsbyjs.org/docs/gatsby-cli) installed +- Make sure you have the [Gatsby CLI](/docs/gatsby-cli) installed - A [Gitlab](https://gitlab.com/) account ### Directions From 7e1cbc19101da9e20c92f5e77357ec0913ca8bb0 Mon Sep 17 00:00:00 2001 From: Pedro Filipe <35262512+puzzledbytheweb@users.noreply.github.com> Date: Wed, 22 Apr 2020 16:55:20 +0100 Subject: [PATCH 6/9] build: add params Co-Authored-By: Obinna Ekwuno --- .../recipes/gitlab-continuous-integration.md | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/docs/docs/recipes/gitlab-continuous-integration.md b/docs/docs/recipes/gitlab-continuous-integration.md index a88551260af52..d481b2cd3e3d1 100644 --- a/docs/docs/recipes/gitlab-continuous-integration.md +++ b/docs/docs/recipes/gitlab-continuous-integration.md @@ -26,20 +26,22 @@ yarn develop 4. Create a `.gitlab-ci.yml` with the following content: ``` -image: node:12.16.1 - -cache: - paths: - - node_modules/ - -stages: - - build - -build: - stage: build - script: - - yarn - - yarn build + image: node:latest + + stages: + - build + + cache: + paths: + - node_modules/ + + install_dependencies: + stage: build + script: + - npm install + artifacts: + paths: + - node_modules/ ``` 3. `git push ` From 81e2f52ef3665607911d23399e088d943b1d022e Mon Sep 17 00:00:00 2001 From: gatsbybot Date: Wed, 22 Apr 2020 20:27:55 +0000 Subject: [PATCH 7/9] chore: format --- docs/docs/recipes/gitlab-continuous-integration.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/docs/recipes/gitlab-continuous-integration.md b/docs/docs/recipes/gitlab-continuous-integration.md index d481b2cd3e3d1..cb5ecf699dbbe 100644 --- a/docs/docs/recipes/gitlab-continuous-integration.md +++ b/docs/docs/recipes/gitlab-continuous-integration.md @@ -8,14 +8,18 @@ Push your code to gitlab and automate your production build! ### Prerequisites - Make sure you have the [Gatsby CLI](/docs/gatsby-cli) installed -- A [Gitlab](https://gitlab.com/) account +- A [Gitlab](https://gitlab.com/) account ### Directions + 1. Create a gatsby site + ```shell gatsby new {your-project-name} ``` + 2. Change directory and start a development server + ```shell cd {your-project-name} yarn develop @@ -45,7 +49,7 @@ yarn develop ``` 3. `git push ` -4. Check out your pipeline under the CI/CD option. +4. Check out your pipeline under the CI/CD option. ### Additional resources From 4d0302782198ac6024a4d0338c16d989a133b4b1 Mon Sep 17 00:00:00 2001 From: Obinna Ekwuno Date: Wed, 22 Apr 2020 22:22:34 +0100 Subject: [PATCH 8/9] Update intro to Recipe --- docs/docs/recipes/gitlab-continuous-integration.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/docs/recipes/gitlab-continuous-integration.md b/docs/docs/recipes/gitlab-continuous-integration.md index cb5ecf699dbbe..26e7010a8914c 100644 --- a/docs/docs/recipes/gitlab-continuous-integration.md +++ b/docs/docs/recipes/gitlab-continuous-integration.md @@ -3,7 +3,8 @@ title: "Recipes: Continuous Integration on Gitlab" tableOfContentsDepth: 1 --- -Push your code to gitlab and automate your production build! +Continuous Integration works by pushing small code chunks to your application’s code base hosted in a Git repository, and, to every push, run a pipeline of scripts to build, test, and validate the code changes before merging them into the main branch. +This recipe helps you set up CI/CD on Gitlab and automate your production build!. ### Prerequisites From 4cd17fc76b1b1fa7464cf94958ef333faf3a0c4f Mon Sep 17 00:00:00 2001 From: gatsbybot Date: Wed, 22 Apr 2020 21:30:35 +0000 Subject: [PATCH 9/9] chore: format --- docs/docs/recipes/gitlab-continuous-integration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/recipes/gitlab-continuous-integration.md b/docs/docs/recipes/gitlab-continuous-integration.md index 26e7010a8914c..eb3ae7967219f 100644 --- a/docs/docs/recipes/gitlab-continuous-integration.md +++ b/docs/docs/recipes/gitlab-continuous-integration.md @@ -4,7 +4,7 @@ tableOfContentsDepth: 1 --- Continuous Integration works by pushing small code chunks to your application’s code base hosted in a Git repository, and, to every push, run a pipeline of scripts to build, test, and validate the code changes before merging them into the main branch. -This recipe helps you set up CI/CD on Gitlab and automate your production build!. +This recipe helps you set up CI/CD on Gitlab and automate your production build!. ### Prerequisites