Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yaml formatting error with projectId #253

Closed
tasomaniac opened this issue May 7, 2021 · 20 comments
Closed

Yaml formatting error with projectId #253

tasomaniac opened this issue May 7, 2021 · 20 comments

Comments

@tasomaniac
Copy link
Contributor

tasomaniac commented May 7, 2021

Hi, we came across a very weird error while using fladle on a new project. Our project id on Firebase has dash - in it. And this creates an issue parsing the configuration since dash is a reserved char. According to my google search, this actually depends on yaml parser.

I was thinking of creating a PR but I was not sure what is the best way to handle this. Should we just wrap the value into quotes?

# instead of this
  projectId: some-funny-name

# this
  projectId: "some-funny-name"

Here is the error I receive:

> Task :app:execFlankCriticalPath
version: v21.03.1
revision: **redacted**
session id: **redacted**

Invalid value for [project]: no argument value found
@runningcode
Copy link
Owner

@tasomaniac would you be able to paste the error you are seeing here?

@bootstraponline would this help? Can flank parse a project with a - in it?

@tasomaniac
Copy link
Contributor Author

Sorry, I cannot believe I forgot :) It was on my clipboard. I will update above.

@bootstraponline
Copy link

project: flank-open-source is what we use on flank. We can parse projects with -.

I think the key should be project not projectId in the yaml. Maybe fladle exposes this as projectId?

@pawelpasterz Do you have additional context?

@runningcode
Copy link
Owner

@tasomaniac can you also explain how you are specifying the project id in the fladle configuration block?

Can you also let us know if you are using a service account or user authentication?

@tasomaniac
Copy link
Contributor Author

Service account works fine. I wanted to use the service account only on the CI. And developers in the team can use flankAuth to setup locally. Not sure if it makes a difference but we also have numbers in the id.

I will try to run the generated yaml with flank directly. Let's see 🤞

We just tried the following config

fladle {
  projectId.set("some-project-12345")
} 

@tasomaniac
Copy link
Contributor Author

Yes, I can reproduce it by running manually via flank.jar. Unfortunately putting single or double quotes does not help.

@runningcode
Copy link
Owner

@tasomaniac can you clarify what is working and what is not working?
Can you share the following details?
Is the projectId specified in the fladle config?
Are you using user auth or a service credential?
What version of fladle are you using?
What version of flank are you using?
Can you share the results of printYml?

@tasomaniac
Copy link
Contributor Author

Here is my yaml file. I guess this should be an issue on Flank actually. I was just wondering if there could be a way to workaround here.

gcloud:
  app: /path/app/build/outputs/apk/debug/app-debug.apk
  test: /path/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk
  device:
  - model: Pixel2
    version: 28

  use-orchestrator: true
  auto-google-login: false
  record-video: true
  performance-metrics: true
  timeout: 15m

flank:
  max-test-shards: 10
  project: some-project-54934
  keep-file-path: false
  ignore-failed-tests: false
  disable-sharding: false
  smart-flank-disable-upload: false
  legacy-junit-result: false
  full-junit-result: false
  output-style: single

@runningcode
Copy link
Owner

runningcode commented May 7, 2021

Hi @tasomaniac thanks for sharing the yaml file. Can you please share the following details?

Is the projectId specified in the fladle config?
Are you using user auth or a service credential?
What version of fladle are you using?
What version of flank are you using?

When using the above configuration you specify, what is the error you are seeing?

@bootstraponline
Copy link

What's the output of java -jar flank.jar doctor? On your sample, I'm seeing this:

Warning: Version should be string gcloud -> device["Pixel2"] -> version[28]

@tasomaniac
Copy link
Contributor Author

@runningcode

  • Yes, projectId specified in fladle. And fladle successfully generates the above yaml file. If not porjectId were provided, the yaml wouldn't include it.
  • I'm using user auth. Using service credentials without providing projectId works fine.
  • Fladle version: 0.15.1
  • Flank version is not specified in configuration and automatically uses: version: v21.03.1
  • The error output is posted in the original message above.

@bootstraponline I ran it, it said it is not valid. And I used the --fix option. The only thing it did was to add 3 dashes as first line ---. After that, running doctor again said Valid yml file but I see the same error still.

@tasomaniac
Copy link
Contributor Author

tasomaniac commented May 7, 2021

Something interesting I realized. If I put a random projectId with dash and a number sequence, it works successfully and give me 404 error where I can see that the project id successfully parsed in the error output.

I believe there is something wrong with our project id. I'm afraid some other error is happening internally and the output is misleading. I tried using --debug argument but that did not give anything else than Request/Response of the Google Clous API calls.

@runningcode
Copy link
Owner

Thanks for reporting. I don't think there is anything wrong with the way that fladle is providing the projectId to flank.

That being said, this confusion often happens in the following scenario:

  1. A build succeeds on CI when using a service account credential configured in the fladle block.
  2. A local developer tries to build the same but has local user auth configured in ~/.flank (either for this project or another project). This ~/flank credential overrides any service account configured in the build.gradle files or in flank.yml.
  3. User auth stored in ~/.flank requires the projectId to be specified or otherwise does not have permission to the project's gcloud bucket.
  4. A build will produce inconsistent results depending on the local contents of the ~/.flank.

Please vote the following issue up on the flank repo so that flank results will produce consistent results: Flank/flank#1831

@tasomaniac
Copy link
Contributor Author

I am not sure if my case is one of those actually. It works fine in another project exactly the way I do it. It is an authorization issue, Flank actually does a successful request to gcloud and gives proper error message about permissions missing. In this case, it just says the value is not found.

In any case, I also think it is not a fladle issue since it happens also when I run flank without Gradle.

@juliocbcotta
Copy link

@bootstraponline I had the same problem today, and the fix for me was

                    "model"      : "\"Pixel2\"",
                    "version"    : "\"29\"", 

I tested with

flankVersion = "21.08.0"
classpath "com.osacky.flank.gradle:fladle:0.16.2"

@bootstraponline
Copy link

oh, firebase requires these values to be quoted.

maybe fladle could handle quoting automatically

@runningcode
Copy link
Owner

@BugsBunnyBR do you have a sample that reproduces the issue so that I can test the fix?

@tasomaniac
Copy link
Contributor Author

@BugsBunnyBR do you mean you had the same problems with projectId and that happened because model and version were unquoted?

@juliocbcotta
Copy link

juliocbcotta commented Aug 3, 2021

@BugsBunnyBR do you mean you had the same problems with projectId and that happened because model and version were unquoted?

No, but I had this log and some error that I can't remember precisely...

Warning: Version should be string gcloud -> device["Pixel2"] -> version[28]

and remember that I was using

projectId("myProject")

instead of

projectId "myProject"

(because it was from the configuration page https://runningcode.github.io/fladle/configuration/)

Anyway, I think that quoting the values should solve the problem for the projectId with dashes and for that warning about the device...

I will try to get a sample to reproduce the problem...

@juliocbcotta
Copy link

here it is my project
https://github.com/BugsBunnyBR/fladle-bug-report/blob/main/fladle.gradle

Even though I am not able to reproduce this issue original problem, my build would fail if I don't quote the model and version when running ./gradlew flankDoctor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants