From e9feaa3e15dd283a5c2523bba4016c0c10d71f43 Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Mon, 2 Dec 2019 10:41:02 +0100 Subject: [PATCH 01/31] Testing with setting environment variable from .env --- .github/workflows/test.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..0455bf49 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,21 @@ +name: Test + +on: + pull_request: + branches: + - dev-robert + push: + branches: + - dev-robert + +jobs: + + build: + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: | + echo ::set-env name APP_BUILD::$(grep APP_VERSION= .env | cut -d '=' -f2) + echo echo "set APP_BUILD to $APP_BUILD" + From dc47c2731175eaa37a9338e1c5ef844c35d7b2ae Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Mon, 2 Dec 2019 10:42:28 +0100 Subject: [PATCH 02/31] Fix on syntax --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0455bf49..5456956d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,6 +16,6 @@ jobs: steps: - uses: actions/checkout@v1 - run: | - echo ::set-env name APP_BUILD::$(grep APP_VERSION= .env | cut -d '=' -f2) + echo ::set-env name=APP_BUILD::$(grep APP_VERSION= .env | cut -d '=' -f2) echo echo "set APP_BUILD to $APP_BUILD" From 1e7f393e1ccf9fe11ebc3dd8ffc8f7e35b65ee15 Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Mon, 2 Dec 2019 10:47:47 +0100 Subject: [PATCH 03/31] More testing with GREP --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5456956d..8ffbed08 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,6 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 + - run: grep APP_VERSION= .env - run: | echo ::set-env name=APP_BUILD::$(grep APP_VERSION= .env | cut -d '=' -f2) echo echo "set APP_BUILD to $APP_BUILD" From d7c4b61ddab17e2a9b834661d38f8fafaa3f10e8 Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Mon, 2 Dec 2019 10:49:41 +0100 Subject: [PATCH 04/31] Even more testing --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8ffbed08..1416c067 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - run: grep APP_VERSION= .env + - run: grep APP_VERSION= .env | cut -d '=' -f2 - run: | echo ::set-env name=APP_BUILD::$(grep APP_VERSION= .env | cut -d '=' -f2) echo echo "set APP_BUILD to $APP_BUILD" From f22b4064a6db25bdc10c47fdef72478661e43d56 Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Mon, 2 Dec 2019 10:53:05 +0100 Subject: [PATCH 05/31] Export instead of set:: --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1416c067..37b67f81 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,6 @@ jobs: - uses: actions/checkout@v1 - run: grep APP_VERSION= .env | cut -d '=' -f2 - run: | - echo ::set-env name=APP_BUILD::$(grep APP_VERSION= .env | cut -d '=' -f2) + export APP_BUILD=$(grep APP_VERSION= .env | cut -d '=' -f2) echo echo "set APP_BUILD to $APP_BUILD" From e73549da0a70acd4a4f6cd9531a99f023a429238 Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Mon, 2 Dec 2019 10:54:25 +0100 Subject: [PATCH 06/31] Passing between steps? --- .github/workflows/dockerimage.yml | 2 +- .github/workflows/test.yml | 1 + .idea/workspace.xml | 39 ++++++++++++++++++++++++++++--- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index ded88c92..77feb89b 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -38,7 +38,7 @@ jobs: - name: Print definitive APP_ENV run: echo "APP_ENV is now $APP_ENV" - name: Build the Docker image - run: docker-compose build --pull --build-arg APP_ENV=$APP_ENV + run: docker-compose build --pull --build-arg APP_ENV=$APP_ENV APP_BUILD=$APP_BUILD - name: Run the docker image run: docker-compose up -d - name: Taking some sleep diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 37b67f81..8736609f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,4 +19,5 @@ jobs: - run: | export APP_BUILD=$(grep APP_VERSION= .env | cut -d '=' -f2) echo echo "set APP_BUILD to $APP_BUILD" + - run: echo "APP_BUILD is now $APP_BUILD" diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 63cda310..8f27ec44 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,8 +1,9 @@ - + + @@ -226,6 +255,10 @@ - \ No newline at end of file From 8a0bb6983e88b8d51c19679343bd83dbbdc1b45d Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Mon, 2 Dec 2019 11:05:41 +0100 Subject: [PATCH 07/31] export to set-env --- .github/workflows/test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8736609f..73e2c532 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,8 @@ jobs: - uses: actions/checkout@v1 - run: grep APP_VERSION= .env | cut -d '=' -f2 - run: | - export APP_BUILD=$(grep APP_VERSION= .env | cut -d '=' -f2) - echo echo "set APP_BUILD to $APP_BUILD" + export VERSION=$(grep APP_VERSION= .env | cut -d '=' -f2) + echo ::set-env name=APP_BUILD::$VERSION + echo "set APP_BUILD to $APP_BUILD" - run: echo "APP_BUILD is now $APP_BUILD" From 8066e7afb597da94d2b8fc3a95fe56d46ee69d28 Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Mon, 2 Dec 2019 11:22:16 +0100 Subject: [PATCH 08/31] Updates on the design desicions --- DESIGN.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index 34ff5696..01221282 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -36,7 +36,7 @@ Welcome, you are currently viewing the design decisions for the proto component. The European factor ------- -The proto-component isn't just a Dutch Component, it is in essence a Dutch translation of European components, nowhere is this more obvious than in the core code. Our component is based on [API Platform](https://api-platform.com/) an API specific version of the symfony framework. This framework is build by the lovely people of []() and is build with support of the European Commission trough the [EU-FOSSA Hackathon](https://ec.europa.eu/info/news/first-eu-fossa-hackathon-it-happened-2019-may-03_en) and Digital Ocean trough [Hacktoberfest](https://hacktoberfest.digitalocean.com/). +The proto-component isn't just a Dutch Component, it is in essence a Dutch translation of European components, nowhere is this more obvious than in the core code. Our component is based on [API Platform](https://api-platform.com/) an API specific version of the symfony framework. This framework is build by the lovely people of [Les Tilleuls](https://les-tilleuls.coop/en) and is build with support of the European Commission trough the [EU-FOSSA Hackathon](https://ec.europa.eu/info/news/first-eu-fossa-hackathon-it-happened-2019-may-03_en) and Digital Ocean trough [Hacktoberfest](https://hacktoberfest.digitalocean.com/). But it doesn't just end there. The [varnish container](https://hub.docker.com/r/eeacms/varnish/) that we use to speed up the API response is build and maintained by [EEA]() (The European Environment Agency) and the development team at conduction itself is attached to the [Odyssey program](https://www.odyssey.org/) and originated from the [startupinresidence](https://startupinresidence.com/) program. @@ -46,11 +46,13 @@ On standards and standardization ------- The specific goal of the proto component (which this current code base is a version of) is to provide a common architecture for common ground components. As such the common ground principles are leading in design choices, and within those principles international compliancy and technological invocation is deemed most important. **We do not want to make concessions to the current infrastructure.** As such the component might differ on [NL API Strategie](https://docs.geostandaarden.nl/api/API-Strategie), [NORA](https://www.noraonline.nl/wiki/Standaarden), [vng.cloud](https://zaakgerichtwerken.vng.cloud/themas/index) and or other standards if they are deemed incompatible or out of line with (inter)national standards and or good practices. -Unfortunatly (inter)national standards standards can be conflicting. We therefore prioritize standards on two grounds +Unfortunatly (inter)national standards standards can be conflicting. We therefore prioritize standards on sevarl grounds -- International standards are put before local standards +- International is put before local - Standards caried by a standard organisation (like ISO, W3C etc) at put before floating standards (like RFC's) wichs are put before industraty standards, good practices and so on. +So if for instance a **local** standard is out of line with an **internation** good practice we follow the international good practice. + ### Commonground specific standards This component was designed in line with the [NL API Strategie](https://docs.geostandaarden.nl/api/API-Strategie), [NORA](https://www.noraonline.nl/wiki/Standaarden), [vng.cloud](https://zaakgerichtwerken.vng.cloud/themas/index), [commonground principles](https://vng.nl/onderwerpenindex/bestuur/samen-organiseren-2019/common-ground). From 30f752eb1358d80056a98eb4919dcde550219887 Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Mon, 2 Dec 2019 11:23:54 +0100 Subject: [PATCH 09/31] Set APP_BUILD --- .github/workflows/dockerimage.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 77feb89b..df6a1ae8 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -24,16 +24,24 @@ jobs: - name: Setting APP_ENV to dev run: | echo ::set-env name=APP_ENV::dev + echo ::set-env name=APP_BUILD::dev echo "set APP_ENV to $APP_ENV" - name: Setting APP_ENV to prod if: contains( github.ref, 'master' ) || contains( github.base_ref, 'master' ) run: | echo ::set-env name=APP_ENV::prod echo "set APP_ENV to $APP_ENV" + - name: Set APP_BUILD to APP_VERSION + if: contains( github.ref, 'master' ) + run: | + export VERSION=$(grep APP_VERSION= .env | cut -d '=' -f2) + echo ::set-env name=APP_BUILD::$VERSION + echo "set APP_BUILD to $APP_BUILD" - name: Setting APP_ENV to stag if: contains( github.ref, 'staging' ) || contains( github.base_ref, 'staging' ) run: | echo ::set-env name=APP_ENV::stag + echo ::set-env name=APP_BUILD::stag echo "set APP_ENV to $APP_ENV" - name: Print definitive APP_ENV run: echo "APP_ENV is now $APP_ENV" From 764b61a0a0d073cbec16d9725256955f7dc144fa Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Mon, 2 Dec 2019 11:25:56 +0100 Subject: [PATCH 10/31] APP NAME testen --- .github/workflows/dockerimage.yml | 5 +++++ .github/workflows/test.yml | 4 ++++ .idea/workspace.xml | 15 +++++++++++---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index df6a1ae8..35a1ff59 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -21,6 +21,11 @@ jobs: - uses: actions/checkout@v1 - name: Pulling old images, if any run: docker-compose pull --ignore-pull-failures + - name: Setting APP_NAME + run: | + export NAME=$(grep APP_NAME= .env | cut -d '=' -f2) + echo ::set-env name=APP_NAME::$NAME + echo "set APP_NAME to $APP_NAME" - name: Setting APP_ENV to dev run: | echo ::set-env name=APP_ENV::dev diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 73e2c532..f7f59574 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,4 +21,8 @@ jobs: echo ::set-env name=APP_BUILD::$VERSION echo "set APP_BUILD to $APP_BUILD" - run: echo "APP_BUILD is now $APP_BUILD" + - run: | + export NAME=$(grep APP_NAME= .env | cut -d '=' -f2) + echo ::set-env name=APP_NAME::$NAME + echo "set APP_NAME to $APP_NAME" diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8f27ec44..1797973c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,9 +1,8 @@ - + - @@ -259,6 +265,7 @@ - \ No newline at end of file From 435a44df66fe03e354d0107ea73726cda6d06efd Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Mon, 2 Dec 2019 11:26:26 +0100 Subject: [PATCH 11/31] Passing to next? --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f7f59574..23273fc5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,4 +25,4 @@ jobs: export NAME=$(grep APP_NAME= .env | cut -d '=' -f2) echo ::set-env name=APP_NAME::$NAME echo "set APP_NAME to $APP_NAME" - + - run: echo "APP_NAME is now $APP_NAME" From e375777dde08c3ade0e0a43b42d542e067a43ac0 Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Mon, 2 Dec 2019 11:27:33 +0100 Subject: [PATCH 12/31] Docker compose update --- .env | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.env b/.env index 0380f3ac..66007731 100644 --- a/.env +++ b/.env @@ -18,6 +18,8 @@ APP_VERSION=V.0.1 APP_DEBUG=1 # What is the enviroment type you want to use for local production? (choose between dec,stag,prod, acce or test) APP_ENV=dev +# We use a build to tag images, this is swithced to the version on master and to env on other branches +APP_BUILD=dev # The description for this api APP_DESCRIPTION='Naast deze JSON rest API is er ook een [graphql](/graphql) interface beschikbaar.' From 402e180413964b24ac0cab03a935e015d5b42245 Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Mon, 2 Dec 2019 11:36:37 +0100 Subject: [PATCH 13/31] removing test workflow --- .github/workflows/test.yml | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 23273fc5..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Test - -on: - pull_request: - branches: - - dev-robert - push: - branches: - - dev-robert - -jobs: - - build: - - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - run: grep APP_VERSION= .env | cut -d '=' -f2 - - run: | - export VERSION=$(grep APP_VERSION= .env | cut -d '=' -f2) - echo ::set-env name=APP_BUILD::$VERSION - echo "set APP_BUILD to $APP_BUILD" - - run: echo "APP_BUILD is now $APP_BUILD" - - run: | - export NAME=$(grep APP_NAME= .env | cut -d '=' -f2) - echo ::set-env name=APP_NAME::$NAME - echo "set APP_NAME to $APP_NAME" - - run: echo "APP_NAME is now $APP_NAME" From ada871a5c173fd45042339b1aa0681617a68c16a Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Mon, 2 Dec 2019 11:37:46 +0100 Subject: [PATCH 14/31] Added automatic release creation --- .github/workflows/dockerimage.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 35a1ff59..9bda97aa 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -102,3 +102,14 @@ jobs: kubectl rollout restart deployment/${{ secrets.APP_NAME }}-php --kubeconfig="kubeconfig.yaml" --namespace=$APP_ENV kubectl rollout restart deployment/${{ secrets.APP_NAME }}-nginx --kubeconfig="kubeconfig.yaml" --namespace=$APP_ENV kubectl rollout restart deployment/${{ secrets.APP_NAME }}-varnish --kubeconfig="kubeconfig.yaml" --namespace=$APP_ENV + - name: Create Release + if: contains( github.ref, 'master' ) + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: $APP_BUILD + release_name: $APP_BUILD + draft: false + prerelease: false From 8ed7e764c604862c0340fb66ed4a31f3fa1ae002 Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Mon, 2 Dec 2019 11:46:02 +0100 Subject: [PATCH 15/31] fix on build args --- .github/workflows/dockerimage.yml | 2 +- .idea/workspace.xml | 36 +++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 35a1ff59..f4111e45 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -51,7 +51,7 @@ jobs: - name: Print definitive APP_ENV run: echo "APP_ENV is now $APP_ENV" - name: Build the Docker image - run: docker-compose build --pull --build-arg APP_ENV=$APP_ENV APP_BUILD=$APP_BUILD + run: docker-compose build --pull --build-arg APP_ENV=$APP_ENV --build-arg APP_BUILD=$APP_BUILD - name: Run the docker image run: docker-compose up -d - name: Taking some sleep diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1797973c..86564d40 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -237,7 +237,35 @@