From becdf37c0bca1ece6cd7e1a4895cd693e4f7b2bb Mon Sep 17 00:00:00 2001 From: Alex Tiernan-Berry Date: Tue, 28 Jan 2020 21:04:33 +0000 Subject: [PATCH 01/12] Merge branch '10-typeerror-undefined-is-not-an-object-evaluating-l-color' into 'develop' Resolve "TypeError: undefined is not an object (evaluating 'l.color')" Closes #10 See merge request alextiernan6/pocketlab!27 (cherry picked from commit d97ff38822070e3ef735f7e2ba8d79dc28452728) 2abe4cf9 Catch any pipelines that don't have a valid status fe53eb50 Add an error boundary to gracefully catch any errors e06a29c9 Catch any pipelines in the list view that don't have a valid status --- src/App.js | 4 +++- src/components/ErrorBoundary.js | 29 +++++++++++++++++++++------- src/views/projects/Pipelines/List.js | 17 ++++++++++++++-- src/views/projects/Pipelines/View.js | 11 +++++++++-- 4 files changed, 49 insertions(+), 12 deletions(-) diff --git a/src/App.js b/src/App.js index a116cab..8b600f1 100644 --- a/src/App.js +++ b/src/App.js @@ -265,7 +265,9 @@ const App = props => { backgroundColor: '#FAFAFA', paddingTop: 10, }}> - + + + diff --git a/src/components/ErrorBoundary.js b/src/components/ErrorBoundary.js index 36b2ca5..bceb779 100644 --- a/src/components/ErrorBoundary.js +++ b/src/components/ErrorBoundary.js @@ -1,10 +1,13 @@ import React from 'react'; import {View, Text, Button} from 'react-native'; +import {withRouter} from 'react-router-native'; +import * as Sentry from '@sentry/react-native'; class ErrorBoundary extends React.Component { constructor(props) { super(props); this.state = {hasError: false, error: null}; + this.previousError = null; } static getDerivedStateFromError(error) { @@ -13,8 +16,13 @@ class ErrorBoundary extends React.Component { } componentDidCatch(error, errorInfo) { - // You can also log the error to an error reporting service - console.warn(error, errorInfo); + if ( + this.previousError == null || + error.toString() !== this.prevError.toString() + ) { + this.prevError = error; + Sentry.captureException(error); + } } render() { @@ -22,11 +30,18 @@ class ErrorBoundary extends React.Component { // You can render any custom fallback UI return ( - Something went wrong - {this.state.error.toString()} + + Something went wrong + + + We've been made aware of the issue, and are working on a fix + ; } - const issueUrl = `/projects/${item.project.id}/${ - todoTypes[item.target_type] - }/${item.target.iid}`; + const onPress = () => { + if (todoTypes[item.target_type] !== undefined) { + const issueUrl = `/projects/${item.project.id}/${ + todoTypes[item.target_type] + }/${item.target.iid}`; + props.history.push(issueUrl); + } + }; + const when = moment(item.created_at).fromNow(); return ( { description={when} titleNumberOfLines={3} titleStyle={item.state == 'done' ? styles.todoDone : {}} - onPress={() => props.history.push(issueUrl)} + onPress={onPress} right={props => button} /> ); -- GitLab From 80b99e40aba5f7a9c6f401af67dbd735fa9ccf70 Mon Sep 17 00:00:00 2001 From: Alex Tiernan Date: Thu, 13 Feb 2020 23:00:24 +0000 Subject: [PATCH 03/12] Update sentry project name --- android/sentry.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/sentry.properties b/android/sentry.properties index 3c1dbd6..2294fbc 100644 --- a/android/sentry.properties +++ b/android/sentry.properties @@ -1,5 +1,5 @@ defaults.url=https://sentry.io/ defaults.org=alex-tiernan-berry -defaults.project=alex-tiernan-berry +defaults.project=pocketlab auth.token=c3b258f9433444db8f9f3c52659d620fcf37396458aa40ccac89143e0622ee76 cli.executable=node_modules/@sentry/cli/bin/sentry-cli -- GitLab From 13256bfefc65ece4b9b3657365ebaf15f0c6dde0 Mon Sep 17 00:00:00 2001 From: Alex Tiernan Date: Fri, 14 Feb 2020 21:05:07 +0000 Subject: [PATCH 04/12] v1.3.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c93c0d3..cc57790 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "PocketLab", - "version": "1.3.1", + "version": "1.3.2", "private": true, "scripts": { "android": "react-native run-android", -- GitLab From 663f35a1909e8f07bf201065c424915501008d4b Mon Sep 17 00:00:00 2001 From: Alex Tiernan-Berry Date: Sat, 15 Feb 2020 23:28:27 +0000 Subject: [PATCH 05/12] Cherry pick fastlane --- .gitignore | 1 + .gitlab-ci.yml | 26 ++++++++++++++++++++++---- fastlane/Appfile | 1 + fastlane/Fastfile | 22 ++++++++++++++++++++++ fastlane/README.md | 29 +++++++++++++++++++++++++++++ fastlane/report.xml | 13 +++++++++++++ 6 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 fastlane/Appfile create mode 100644 fastlane/Fastfile create mode 100644 fastlane/README.md create mode 100644 fastlane/report.xml diff --git a/.gitignore b/.gitignore index 6d4ba9a..d4ea77b 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,4 @@ buck-out/ gitlabConfig.json licenses.json +fastlane/google-service-account.json diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9d027cd..e512912 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,15 @@ stages: - test - preBuild - build +- deploy + +include: + - template: License-Management.gitlab-ci.yml + - template: Dependency-Scanning.gitlab-ci.yml + - template: Code-Quality.gitlab-ci.yml + +variables: + DS_DEFAULT_ANALYZERS: "retire.js" lint: image: node @@ -35,20 +44,29 @@ build android release: - node_modules/ - .gradle/ before_script: + - gem install fastlane -NV - export GRADLE_USER_HOME=$(pwd)/.gradle - chmod +x ./android/gradlew + - base64 -d $KEYSTORE_FILE > ./android/app/mykeystore.keystore script: - yarn install - yarn jetify - - base64 -d $KEYSTORE_FILE > ./android/app/mykeystore.keystore - - cat $API_CONFIG > ./gitlabConfig.json - echo fs.inotify.max_user_watches=524288 | tee -a /etc/sysctl.conf && sysctl -p - - cd android - - ./gradlew assembleRelease + - fastlane android build + only: + - /^v(\d*).(\d*).(\d*)$/i + except: + - branches artifacts: paths: - android/app/build/outputs/apk/release/app-release.apk +deploy: + image: reactnativecommunity/react-native-android + stage: deploy only: - /^v(\d*).(\d*).(\d*)$/i except: - branches + script: + - base64 -d $FASTLANE_SERVICE_ACCOUNT > ./fastlane/google-service-account.json + - fastlane android release diff --git a/fastlane/Appfile b/fastlane/Appfile new file mode 100644 index 0000000..fc9441a --- /dev/null +++ b/fastlane/Appfile @@ -0,0 +1 @@ +json_key_file "fastlane/google-service-account.json" diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 0000000..560b9f1 --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,22 @@ +fastlane_version '2.53.1' + +platform :android do + desc 'Build the Android application.' + lane :build do + if ENV['CI_JOB_ID'].nil? + UI.user_error!('This should only be run by the GitLab CI/CD pipeline') + end + + gradle(task: 'clean', project_dir: 'android/') + gradle( + task: 'assemble', + build_type: 'Release', + project_dir: 'android/', + properties: { 'versionCode' => ENV['CI_JOB_ID']} + ) + end + lane :release do + build + supply(track: 'production') + end +end diff --git a/fastlane/README.md b/fastlane/README.md new file mode 100644 index 0000000..005b509 --- /dev/null +++ b/fastlane/README.md @@ -0,0 +1,29 @@ +fastlane documentation +================ +# Installation + +Make sure you have the latest version of the Xcode command line tools installed: + +``` +xcode-select --install +``` + +Install _fastlane_ using +``` +[sudo] gem install fastlane -NV +``` +or alternatively using `brew cask install fastlane` + +# Available Actions +## Android +### android build +``` +fastlane android build +``` +Build the Android application. + +---- + +This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run. +More information about fastlane can be found on [fastlane.tools](https://fastlane.tools). +The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools). diff --git a/fastlane/report.xml b/fastlane/report.xml new file mode 100644 index 0000000..c96765a --- /dev/null +++ b/fastlane/report.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + -- GitLab From 58d6c2369190596b5f40f516cb9006ff0647fb90 Mon Sep 17 00:00:00 2001 From: Alex Tiernan Date: Sun, 16 Feb 2020 00:23:12 +0000 Subject: [PATCH 06/12] Add fastlane gem install --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e512912..8a5dcc1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -63,6 +63,8 @@ build android release: deploy: image: reactnativecommunity/react-native-android stage: deploy + before_script: + - gem install fastlane -NV only: - /^v(\d*).(\d*).(\d*)$/i except: -- GitLab From 2b2b9f1622e107382252faffebce245b2b5cbaaf Mon Sep 17 00:00:00 2001 From: Alex Tiernan-Berry Date: Sun, 16 Feb 2020 09:11:24 +0000 Subject: [PATCH 07/12] Remove build from the fast lane release lane Build is done as a separate job in the CI/CD pipeline --- fastlane/Fastfile | 1 - 1 file changed, 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 560b9f1..d839df7 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -16,7 +16,6 @@ platform :android do ) end lane :release do - build supply(track: 'production') end end -- GitLab From 72b18e2fe79fe6c45855d834ae3177bfc8c980fe Mon Sep 17 00:00:00 2001 From: Alex Tiernan-Berry Date: Wed, 19 Feb 2020 16:27:55 +0000 Subject: [PATCH 08/12] Use the cache for the deploy job --- .gitlab-ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8a5dcc1..4d2f6df 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -63,6 +63,11 @@ build android release: deploy: image: reactnativecommunity/react-native-android stage: deploy + cache: + key: ${CI_PROJECT_ID} + paths: + - node_modules/ + - .gradle/ before_script: - gem install fastlane -NV only: -- GitLab From e61916dd1342171c21f6ff4ee3b511e6c02d5014 Mon Sep 17 00:00:00 2001 From: Alex Tiernan-Berry Date: Wed, 19 Feb 2020 16:29:28 +0000 Subject: [PATCH 09/12] Update build.gradle --- android/app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 52d9a5f..e55cb5c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -132,8 +132,8 @@ android { applicationId "com.pocketlab" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 4 - versionName "1.3.1" + versionCode 5 + versionName "1.3.2" manifestPlaceholders = [ appAuthRedirectScheme: 'pocketlab' ] -- GitLab From 459c12fdcbf884fcd063ad8230a4629326b1ab9d Mon Sep 17 00:00:00 2001 From: Alex Tiernan Date: Wed, 19 Feb 2020 21:01:50 +0000 Subject: [PATCH 10/12] Change to a different docker image --- .gitlab-ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8a5dcc1..d255df4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -61,10 +61,8 @@ build android release: paths: - android/app/build/outputs/apk/release/app-release.apk deploy: - image: reactnativecommunity/react-native-android + image: webcuisine/gitlab-ci-react-native-android stage: deploy - before_script: - - gem install fastlane -NV only: - /^v(\d*).(\d*).(\d*)$/i except: -- GitLab From edcf265048d54879ac2da2c077d977651adc23a5 Mon Sep 17 00:00:00 2001 From: Alex Tiernan Date: Wed, 19 Feb 2020 21:51:12 +0000 Subject: [PATCH 11/12] add package_name and apk to fastfile --- fastlane/Fastfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index d839df7..88fb617 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -12,10 +12,13 @@ platform :android do task: 'assemble', build_type: 'Release', project_dir: 'android/', - properties: { 'versionCode' => ENV['CI_JOB_ID']} ) end lane :release do - supply(track: 'production') + supply( + track: 'production', + package_name: 'com.pocketlab', + apk: 'android/app/build/outputs/apk/release/app-release.apk' + ) end end -- GitLab From 822f84b347a9814be4c58ef96cb20c818e6a4514 Mon Sep 17 00:00:00 2001 From: Alex Tiernan-Berry Date: Thu, 20 Feb 2020 23:26:30 +0000 Subject: [PATCH 12/12] Change docker image to updated version --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a2ff180..6fe288e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -61,7 +61,7 @@ build android release: paths: - android/app/build/outputs/apk/release/app-release.apk deploy: - image: webcuisine/gitlab-ci-react-native-android + image: registry.gitlab.com/alextiernan6/gitlab-ci-react-native-android stage: deploy cache: key: ${CI_PROJECT_ID} -- GitLab