CircleCI build fails when setting up add_ssh_keys config - flutter

We have a repository which now draws from a private repository for a particular component.
A BitBucket SSH key is required to get access to this.
It is a Flutter app and the private repo reference in pubspec.yaml looks like this:
our_private_api-repo:
git:
url: git#bitbucket.org:our_org/our-private-api-repo.git
ref: master
That all works just fine for local development.
Now I am trying to make the CircleCI deployment work.
I worked from these instructions, and these, successfully adding my "Additional SSH Key".
The problem has arisen with the step where I am supposed to add reference to the ssh key, as per the instructions:
- add_ssh_keys:
fingerprints:
- "SO:ME:FIN:G:ER:PR:IN:T"
I've got the correct fingerprint from the CircleCI backend, and I've put the lines in the correct place (just under the steps section for my job, but when I push this change, CircleCI now reports the following errors:
> # | | 3. [#/jobs/my-job/steps/3/fingerprints] no subschema matched out of the total 2 subschemas
> # | | | 1. [#/jobs/my-job/steps/3/fingerprints] expected type: Mapping, found: Sequence
> # | | | | SCHEMA:
> # | | | | type:
> # | | | | - object
> # | | | | - string
> # | | | | INPUT:
> # | | | | - 84:1a:fe:etc..(this is not it exactly)..:31:0f
> # | | | 2. [#/jobs/my-job/steps/3/fingerprints] expected type: String, found: Sequence
> # | | | | SCHEMA:
> # | | | | type:
> # | | | | - object
> # | | | | - string
> # | | | | INPUT:
> # | | | | - 84:1a:fe:etc..(this is not it exactly)..:31:0f
The error goes away if I remove the add_ssh_keys/fingerprints/fingerprint lines.

This was due to missing a tab in my config.yml file.
Changed:
- add_ssh_keys:
fingerprints:
- "84:1a:fe:SO:ME:FIN:G:ER:PR:IN:T"
To:
- add_ssh_keys:
fingerprints:
- "84:1a:fe:SO:ME:FIN:G:ER:PR:IN:T"

Related

Nexus Repository upload plugin for Fastlane

I am working on a mobile CI/CD and using Fastlane for the scripting / actions support. The organization wants to put the Android and IOS artifacts in the Nexus Repository Manager, so I looked for an action and/or plugin for FastLane. Sure enough there is an action: Fastlane action for nexus upload and a plugin (source) in GitHub: Source for nexus_upload plugin to Fastlane.
I am unable to get the action to work and it throws a mysterious error:
$ bundle exec fastlane uploadToServer
[✔] 🚀
+----------------------------------+---------+------------------+
| Used plugins |
+----------------------------------+---------+------------------+
| Plugin | Version | Action |
+----------------------------------+---------+------------------+
| fastlane-plugin-upload_to_server | 0.1.6 | upload_to_server |
+----------------------------------+---------+------------------+
[13:30:01]: ------------------------------
[13:30:01]: --- Step: default_platform ---
[13:30:01]: ------------------------------
[13:30:01]: Lane name 'env' is invalid! Invalid names are run, init, new_action, lanes, list, docs, action, actions, enable_auto_complete, new_plugin, add_plugin, install_plugins, update_plugins, search_plugins, help, env, update_fastlane.
[!] Lane name 'env' is invalid
Try the following to get the parameters.
enter $ fastlane action nexus_upload
[✔] 🚀
[13:35:41]: fastlane detected a Gemfile in the current directory
[13:35:41]: However, it seems like you didn't use `bundle exec`
[13:35:41]: To launch fastlane faster, please use
[13:35:41]:
[13:35:41]: $ bundle exec fastlane action nexus_upload
[13:35:41]:
[13:35:41]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
+----------------------------------+---------+------------------+
| Used plugins |
+----------------------------------+---------+------------------+
| Plugin | Version | Action |
+----------------------------------+---------+------------------+
| fastlane-plugin-upload_to_server | 0.1.6 | upload_to_server |
+----------------------------------+---------+------------------+
Loading documentation for nexus_upload:
+--------------------------------------------------------------------------+
| nexus_upload |
+--------------------------------------------------------------------------+
| Upload a file to "Sonatype Nexus platform" (https://www.sonatype.com 🔗) |
| |
| Created by xfreebird, mdio |
+--------------------------------------------------------------------------+
+----------------------+-----------------------------------------------+-------------------------------+---------+
| nexus_upload Options |
+----------------------+-----------------------------------------------+-------------------------------+---------+
| Key | Description | Env Var | Default |
+----------------------+-----------------------------------------------+-------------------------------+---------+
| file | File to be uploaded to Nexus | FL_NEXUS_FILE | |
| repo_id | Nexus repository id e.g. artefacts | FL_NEXUS_REPO_ID | |
| repo_group_id | Nexus repository group id e.g. com.company | FL_NEXUS_REPO_GROUP_ID | |
| repo_project_name | Nexus repository commandect name. Only | FL_NEXUS_REPO_PROJECT_NAME | |
| | letters, digits, underscores(_), hyphens(-), | | |
| | and dots(.) are allowed | | |
| repo_project_version | Nexus repository commandect version | FL_NEXUS_REPO_PROJECT_VERSION | |
| repo_classifier | Nexus repository artifact classifier | FL_NEXUS_REPO_CLASSIFIER | |
| | (optional) | | |
| endpoint | Nexus endpoint e.g. http://nexus:8081 | FL_NEXUS_ENDPOINT | |
| mount_path | Nexus mount path (Nexus 3 instances have | FL_NEXUS_MOUNT_PATH | /nexus |
| | this configured as empty by default) | | |
| username | Nexus username | FL_NEXUS_USERNAME | |
| password | Nexus password | FL_NEXUS_PASSWORD | |
| ssl_verify | Verify SSL | FL_NEXUS_SSL_VERIFY | true |
| nexus_version | Nexus major version | FL_NEXUS_MAJOR_VERSION | 2 |
| verbose | Make detailed output | FL_NEXUS_VERBOSE | false |
| proxy_username | Proxy username | FL_NEXUS_PROXY_USERNAME | |
| proxy_password | Proxy password | FL_NEXUS_PROXY_PASSWORD | |
| proxy_address | Proxy address | FL_NEXUS_PROXY_ADDRESS | |
| proxy_port | Proxy port | FL_NEXUS_PROXY_PORT | |
+----------------------+-----------------------------------------------+-------------------------------+---------+
* = default value is dependent on the user's system
More information can be found on https://docs.fastlane.tools/actions/nexus_upload here
Missing parameters will result in a dialog for the needed parameters:
$ bundle exec fastlane run nexus_upload username:"mobibob" password:"secretpassword" file:"./app/build/outputs/apk/debug/app-debug.apk"
[✔] 🚀
+----------------------------------+---------+------------------+
| Used plugins |
+----------------------------------+---------+------------------+
| Plugin | Version | Action |
+----------------------------------+---------+------------------+
| fastlane-plugin-upload_to_server | 0.1.6 | upload_to_server |
+----------------------------------+---------+------------------+
[13:34:22]: --------------------------
[13:34:22]: --- Step: nexus_upload ---
[13:34:22]: --------------------------
[13:34:22]: To not be asked about this value, you can specify it using 'repo_id'
[13:34:22]: Nexus repository id e.g. artefacts:

Perl catalyst development server not accepting connections

Here is the stdout
[lzhou#localhost script]$ perl dbauthtest_server.pl You are loading Catalyst::Engine::HTTP explicitly.
This is almost certainly a bad idea, as Catalyst::Engine::HTTP has been removed in this version of Catalyst.
Please update your application's scripts with:
catalyst.pl -force -scripts MyApp
to update your scripts to not do this. [debug] Debug messages enabled [debug] Statistics enabled [warn] You are running an old script!
Please update by running (this will overwrite existing files):
catalyst.pl -force -scripts DBAuthTest
or (this will not overwrite existing files):
catalyst.pl -scripts DBAuthTest
[debug] Loaded Config "/home/lzhou/ä¸è¼ /def-guide-to-catalyst-master/4439/catalyst-book-code/Chapter_6/DBAuthTest/dbauthtest.conf" [debug] Loaded plugins: .--------------------------------------------------------------------------------. | Catalyst::Plugin::ConfigLoader 0.34 | '--------------------------------------------------------------------------------'
[debug] Loaded PSGI Middleware: .--------------------------------------------------------------------------------. | Catalyst::Middleware::Stash | | Plack::Middleware::HTTPExceptions | | Plack::Middleware::RemoveRedundantBody 0.06 | | Plack::Middleware::FixMissingBodyInRedirect 0.12 | | Plack::Middleware::ContentLength | | Plack::Middleware::MethodOverride 0.20 | | Plack::Middleware::Head | '--------------------------------------------------------------------------------'
[debug] Loaded Request Data Handlers: .--------------------------------------------------------------------------------. | application/json | | application/x-www-form-urlencoded | '--------------------------------------------------------------------------------'
[debug] Loaded dispatcher "Catalyst::Dispatcher" [debug] Loaded engine "Catalyst::Engine" [debug] Found home "/home/lzhou/ä¸è¼ /def-guide-to-catalyst-master/4439/catalyst-book-code/Chapter_6/DBAuthTest" [debug] Loaded components: .---------------------------------------------------------------------+----------. | Class | Type |
+---------------------------------------------------------------------+----------+ | DBAuthTest::Controller::AuthUsers | instance | | DBAuthTest::Controller::Root | instance | | DBAuthTest::Model::AuthDB | instance | | DBAuthTest::Model::AuthDB::Roles | class | | DBAuthTest::Model::AuthDB::UserRoles | class | | DBAuthTest::Model::AuthDB::Users | class | | DBAuthTest::View::Web | instance | '---------------------------------------------------------------------+----------'
[debug] Loaded Private actions: .----------------------+--------------------------------------+------------------. | Private | Class | Method |
+----------------------+--------------------------------------+------------------+ | /end | DBAuthTest::Controller::Root | end | | /default | DBAuthTest::Controller::Root | default | | /authusers/profile | DBAuthTest::Controller::AuthUsers | profile | | /authusers/base | DBAuthTest::Controller::AuthUsers | base | | /authusers/add | DBAuthTest::Controller::AuthUsers | add | | /authusers/user | DBAuthTest::Controller::AuthUsers | user | '----------------------+--------------------------------------+------------------'
[debug] Loaded Path actions: .---------------------------------------+----------------------------------------. | Path | Private |
+---------------------------------------+----------------------------------------+ | /... | /default | '---------------------------------------+----------------------------------------'
[debug] Loaded Chained actions: .---------------------------------------+----------------------------------------. | Path Spec | Private |
+---------------------------------------+----------------------------------------+ | /authusers/add | /authusers/base (0) | | | => /authusers/add (0) | | /authusers/*/profile | /authusers/base (0) | | | -> /authusers/user (1) | | | => /authusers/profile (0) | '---------------------------------------+----------------------------------------'
[info] DBAuthTest powered by Catalyst 5.90124
But when i visit http://localhost:3000/ , connection is refused . it appears that there is no server running.

Filter duplicate output over consecutive rolling period on Postgres

I have a simple table with daily regression test results and would like to get an output of tests that fail consecutively in the last 3 days.
The table looks something like this.
| ID | rule | status | environment | date | note |
------------------------------------------
| 1 | Test01 | pass | dev | 2018-05-23 |
| 2 | Test02 | pass | dev | 2018-05-23 |
| 3 | Test03 | pass | dev | 2018-05-23 |
| 4 | Test01 | pass | staging | 2018-05-23 |
| 5 | Test02 | pass | staging | 2018-05-23 |
| 6 | Test03 | pass | staging | 2018-05-23 |
| 7 | Test01 | pass | dev | 2018-05-24 |
| 8 | Test02 | fail | dev | 2018-05-24 | fail note
| 9 | Test03 | pass | dev | 2018-05-24 |
| 10 | Test01 | fail | dev | 2018-05-24 | fail note
| 11 | Test02 | fail | dev | 2018-05-24 | fail note
| 12 | Test03 | pass | dev | 2018-05-24 |
| 13 | Test01 | pass | dev | 2018-05-25 |
| 14 | Test02 | fail | dev | 2018-05-25 | fail note
| 15 | Test03 | fail | dev | 2018-05-25 | fail note
| 16 | Test01 | pass | dev | 2018-05-26 |
| 17 | Test02 | fail | dev | 2018-05-26 | fail note
| 18 | Test03 | pass | dev | 2018-05-26 |
So, assuming today is 2018-05-26 how do I output a result that shows the Test02 has been failing in the last 3 days or ID (rolling period) in Postgres?
The reason why I want it consecutive is because there may be tests that fail one day and pass the next and fail the next due to network issues so having consecutive requirement ensures elimination of that. Additionally there are also duplicate test runs during the same day (so Test01 can run multiple times during the same day potentially)
In respect to current date, you want to look through records that are dating maximum 2 days back from it and show only these rules for which you've found that a test has failed all the times it was done (for each environment separately):
select rule, environment
from t
where date > current_date - 3 -- for your sample data it's '2018-05-26'
group by rule, environment
having sum(case when status = 'fail' then 1 end) = count(*)
Output for your sample data and where date > '2018-05-26'::date - 3:
rule | environment
--------+-------------
Test02 | dev

Trigger jenkins build when PR is raised

I have gone through numerous post on triggering Jenkins build when a PR is raised in github.
I have checked Git hub Pull Request Builder Option in jenkins job and also provided ${sha1} as branch.
Apart from above , I have added webhook and jenkins Github plugin as service in my repo.
Anything else being missed here . I dont see build getting triggered when PR is raised.
You can use Generic Webhook Trigger Plugin to do that.
Setup a webhook in GitHub.
Configure Generic Webhook Trigger Plugin with variable action with expression $.action
Configure the filter text as $action and the filter regexp as: ^(opened|reopened|synchronize)$
Now this job will run any time a PR is opened, re-opened or new commits are pushed.
You can also pick other values from the webhook like:
| variable | expression | expressionType | defaultValue | regexpFilter |
| action | $.action | JSONPath | | |
| pr_id | $.pull_request.id | JSONPath | | |
| pr_state | $.pull_request.state | JSONPath | | |
| pr_title | $.pull_request.title | JSONPath | | |
| pr_from_ref | $.pull_request.head.ref | JSONPath | | |
| pr_from_sha | $.pull_request.head.sha | JSONPath | | |
| pr_from_git_url | $.pull_request.head.repo.git_url | JSONPath | | |
| pr_to_ref | $.pull_request.base.ref | JSONPath | | |
| pr_to_sha | $.pull_request.base.sha | JSONPath | | |
| pr_to_git_url | $.pull_request.base.repo.git_url | JSONPath | | |
| repo_git_url | $.repository.git_url | JSONPath | | |
There is a test case showing this feature here: https://github.com/jenkinsci/generic-webhook-trigger-plugin/blob/master/src/test/resources/org/jenkinsci/plugins/gwt/bdd/github/github-pull-request.feature

Define array in env file for snapshot

In my projet I have several targets to build several variants of my app. In order to handle this with snapshot, I use environnements as described here: https://github.com/fastlane/fastlane/blob/master/docs/Advanced.md#environment-variables
It works fine for defining my scheme but I do not manage to use it for languages.
.env.first_environment
SCHEME = MyScheme
LANGUAGES = en-GB,es-ES
Snapfile
languages([
ENV['LANGUAGES']
])
# The name of the scheme which contains the UI Tests
scheme ENV['SCHEME']
If I have only one language it works, but as soon as there is a comma in the env variable, I have some problems. When I launch fastlane I have:
+----------------------------+------------------------------+
| Summary for snapshot 1.2.2 |
+----------------------------+------------------------------+
| workspace | ./my_app.xcworkspace |
| devices | ["iPhone 4s"] |
| languages | ["en-GB,es-ES"] |
| output_directory | ./fastlane/Snapshots/MyScheme|
| ios_version | 9.1 |
| stop_after_first_error | false |
| skip_open_summary | false |
| clear_previous_screenshots | false |
| buildlog_path | ~/Library/Logs/snapshot |
| clean | false |
| scheme | My-Scheme |
+----------------------------+------------------------------+
For the language option I have "en-GB,es-ES" instead of "en-GB","es-ES".
Answer from #AliSoftware:
In env file
...
LANGUAGES = "en-GB,es-ES"
...
In Snapfile
...
languages(
ENV['LANGUAGES'].split(",")
)
...
Thanks.