How to manage signing keystore in Gitlab CI for android
up vote
1
down vote
favorite
Dear stackoverflow community, once more I turn to you :)
I've recently come across the wonder of Gitlab and their very nice bundled CI/CD solution. It works gallantly however, we all need to sign our binaries don't we and I've found no way to upload a key as I would to a Jenkins server for doing this.
So, how can I, without checking in my keys and secrets sign my android (actually flutter) application when building a release?
From what I see, most people define the build job with signing settings referring to a non-committed key.properties file specifying a local keystore.jks. This works fine when building APKs locally but if I would like to build and archive them as a part of the CI/CD job, how do I?
For secret keys, for example the passwords to the keystore itself, I've found that I can simply store them as protected variables but the actual keystore file itself. What can I do about that?
Any ideas, suggestions are dearly welcome.
Cheers
android gitlab flutter code-signing continuous-deployment
add a comment |
up vote
1
down vote
favorite
Dear stackoverflow community, once more I turn to you :)
I've recently come across the wonder of Gitlab and their very nice bundled CI/CD solution. It works gallantly however, we all need to sign our binaries don't we and I've found no way to upload a key as I would to a Jenkins server for doing this.
So, how can I, without checking in my keys and secrets sign my android (actually flutter) application when building a release?
From what I see, most people define the build job with signing settings referring to a non-committed key.properties file specifying a local keystore.jks. This works fine when building APKs locally but if I would like to build and archive them as a part of the CI/CD job, how do I?
For secret keys, for example the passwords to the keystore itself, I've found that I can simply store them as protected variables but the actual keystore file itself. What can I do about that?
Any ideas, suggestions are dearly welcome.
Cheers
android gitlab flutter code-signing continuous-deployment
You should look into App Signing inside the google play console.
– Oliver
Aug 7 at 11:16
I've seen that one but I didn't catch you can build without key. I expected you'll need an upload key or so anyway. I'll reread it and see if I can get it. Thanks!
– Almund
Aug 7 at 12:00
Yes, you will still need a Keystore. But you can invalidate this keystore in the play console, if it gets leaked, because this one isn't your "real" keystore.
– Oliver
Aug 7 at 12:15
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Dear stackoverflow community, once more I turn to you :)
I've recently come across the wonder of Gitlab and their very nice bundled CI/CD solution. It works gallantly however, we all need to sign our binaries don't we and I've found no way to upload a key as I would to a Jenkins server for doing this.
So, how can I, without checking in my keys and secrets sign my android (actually flutter) application when building a release?
From what I see, most people define the build job with signing settings referring to a non-committed key.properties file specifying a local keystore.jks. This works fine when building APKs locally but if I would like to build and archive them as a part of the CI/CD job, how do I?
For secret keys, for example the passwords to the keystore itself, I've found that I can simply store them as protected variables but the actual keystore file itself. What can I do about that?
Any ideas, suggestions are dearly welcome.
Cheers
android gitlab flutter code-signing continuous-deployment
Dear stackoverflow community, once more I turn to you :)
I've recently come across the wonder of Gitlab and their very nice bundled CI/CD solution. It works gallantly however, we all need to sign our binaries don't we and I've found no way to upload a key as I would to a Jenkins server for doing this.
So, how can I, without checking in my keys and secrets sign my android (actually flutter) application when building a release?
From what I see, most people define the build job with signing settings referring to a non-committed key.properties file specifying a local keystore.jks. This works fine when building APKs locally but if I would like to build and archive them as a part of the CI/CD job, how do I?
For secret keys, for example the passwords to the keystore itself, I've found that I can simply store them as protected variables but the actual keystore file itself. What can I do about that?
Any ideas, suggestions are dearly welcome.
Cheers
android gitlab flutter code-signing continuous-deployment
android gitlab flutter code-signing continuous-deployment
asked Aug 7 at 11:10
Almund
2,6821726
2,6821726
You should look into App Signing inside the google play console.
– Oliver
Aug 7 at 11:16
I've seen that one but I didn't catch you can build without key. I expected you'll need an upload key or so anyway. I'll reread it and see if I can get it. Thanks!
– Almund
Aug 7 at 12:00
Yes, you will still need a Keystore. But you can invalidate this keystore in the play console, if it gets leaked, because this one isn't your "real" keystore.
– Oliver
Aug 7 at 12:15
add a comment |
You should look into App Signing inside the google play console.
– Oliver
Aug 7 at 11:16
I've seen that one but I didn't catch you can build without key. I expected you'll need an upload key or so anyway. I'll reread it and see if I can get it. Thanks!
– Almund
Aug 7 at 12:00
Yes, you will still need a Keystore. But you can invalidate this keystore in the play console, if it gets leaked, because this one isn't your "real" keystore.
– Oliver
Aug 7 at 12:15
You should look into App Signing inside the google play console.
– Oliver
Aug 7 at 11:16
You should look into App Signing inside the google play console.
– Oliver
Aug 7 at 11:16
I've seen that one but I didn't catch you can build without key. I expected you'll need an upload key or so anyway. I'll reread it and see if I can get it. Thanks!
– Almund
Aug 7 at 12:00
I've seen that one but I didn't catch you can build without key. I expected you'll need an upload key or so anyway. I'll reread it and see if I can get it. Thanks!
– Almund
Aug 7 at 12:00
Yes, you will still need a Keystore. But you can invalidate this keystore in the play console, if it gets leaked, because this one isn't your "real" keystore.
– Oliver
Aug 7 at 12:15
Yes, you will still need a Keystore. But you can invalidate this keystore in the play console, if it gets leaked, because this one isn't your "real" keystore.
– Oliver
Aug 7 at 12:15
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
I've used git-secret in the past to check-in password protected secret files. Then pass the password via a secret/protected environmental variable (as you already know) and modify the .gitlab-ci.yml to use the password to open the files and use them.
Sounds reasonable, I've read in other places about using different repos and such to store the secret files. I'll give it a try and come back once it's done. Thank you!
– Almund
Aug 8 at 13:47
Sure.. there is also a fastlane plugin that encrypts keystores github.com/hjanuschka/fastlane-plugin-cryptex (haven't tried). Plus here is a (dated) article about how NOT to manage certificates in Google Play Store researchcenter.paloaltonetworks.com/2014/08/…
– mmccabe
Aug 8 at 14:45
add a comment |
up vote
0
down vote
Usually I store keystore file (as base64 string), alias and passwords to Gitlab's secrets variables.
In the .gitlab-ci.yml do something like:
create_property_files:
stage: prepare
only:
- master
script:
- echo $KEYSTORE | base64 -d > my.keystore
- echo "keystorePath=my.keystore" > signing.properties
- echo "keystorePassword=$KEYSTORE_PASSWORD" >> signing.properties
- echo "keyAlias=$ALIAS" >> signing.properties
- echo "keyPassword=$KEY_PASSWORD" >> signing.properties
artifacts:
paths:
- my.keystore
- signing.properties
expire_in: 10 mins
And, finally, in your build gradle:
signingConfigs {
release {
file("../signing.properties").with { propFile ->
if (propFile.canRead()) {
def properties = new Properties()
properties.load(new FileInputStream(propFile))
storeFile file(properties['keystorePath'])
storePassword properties['keystorePassword']
keyAlias properties['keyAlias']
keyPassword properties['keyPassword']
} else {
println 'Unable to read signing.properties'
}
}
}
}
In this case you have all your sensitive data lying about in artifacts though, don't you ?
– zlandorf
Nov 27 at 14:52
Yes, for 10 minutes. To prevent this, you can write signing.properties directly in build stage
– IvanP
Nov 28 at 8:46
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
I've used git-secret in the past to check-in password protected secret files. Then pass the password via a secret/protected environmental variable (as you already know) and modify the .gitlab-ci.yml to use the password to open the files and use them.
Sounds reasonable, I've read in other places about using different repos and such to store the secret files. I'll give it a try and come back once it's done. Thank you!
– Almund
Aug 8 at 13:47
Sure.. there is also a fastlane plugin that encrypts keystores github.com/hjanuschka/fastlane-plugin-cryptex (haven't tried). Plus here is a (dated) article about how NOT to manage certificates in Google Play Store researchcenter.paloaltonetworks.com/2014/08/…
– mmccabe
Aug 8 at 14:45
add a comment |
up vote
1
down vote
I've used git-secret in the past to check-in password protected secret files. Then pass the password via a secret/protected environmental variable (as you already know) and modify the .gitlab-ci.yml to use the password to open the files and use them.
Sounds reasonable, I've read in other places about using different repos and such to store the secret files. I'll give it a try and come back once it's done. Thank you!
– Almund
Aug 8 at 13:47
Sure.. there is also a fastlane plugin that encrypts keystores github.com/hjanuschka/fastlane-plugin-cryptex (haven't tried). Plus here is a (dated) article about how NOT to manage certificates in Google Play Store researchcenter.paloaltonetworks.com/2014/08/…
– mmccabe
Aug 8 at 14:45
add a comment |
up vote
1
down vote
up vote
1
down vote
I've used git-secret in the past to check-in password protected secret files. Then pass the password via a secret/protected environmental variable (as you already know) and modify the .gitlab-ci.yml to use the password to open the files and use them.
I've used git-secret in the past to check-in password protected secret files. Then pass the password via a secret/protected environmental variable (as you already know) and modify the .gitlab-ci.yml to use the password to open the files and use them.
answered Aug 8 at 3:08
mmccabe
976915
976915
Sounds reasonable, I've read in other places about using different repos and such to store the secret files. I'll give it a try and come back once it's done. Thank you!
– Almund
Aug 8 at 13:47
Sure.. there is also a fastlane plugin that encrypts keystores github.com/hjanuschka/fastlane-plugin-cryptex (haven't tried). Plus here is a (dated) article about how NOT to manage certificates in Google Play Store researchcenter.paloaltonetworks.com/2014/08/…
– mmccabe
Aug 8 at 14:45
add a comment |
Sounds reasonable, I've read in other places about using different repos and such to store the secret files. I'll give it a try and come back once it's done. Thank you!
– Almund
Aug 8 at 13:47
Sure.. there is also a fastlane plugin that encrypts keystores github.com/hjanuschka/fastlane-plugin-cryptex (haven't tried). Plus here is a (dated) article about how NOT to manage certificates in Google Play Store researchcenter.paloaltonetworks.com/2014/08/…
– mmccabe
Aug 8 at 14:45
Sounds reasonable, I've read in other places about using different repos and such to store the secret files. I'll give it a try and come back once it's done. Thank you!
– Almund
Aug 8 at 13:47
Sounds reasonable, I've read in other places about using different repos and such to store the secret files. I'll give it a try and come back once it's done. Thank you!
– Almund
Aug 8 at 13:47
Sure.. there is also a fastlane plugin that encrypts keystores github.com/hjanuschka/fastlane-plugin-cryptex (haven't tried). Plus here is a (dated) article about how NOT to manage certificates in Google Play Store researchcenter.paloaltonetworks.com/2014/08/…
– mmccabe
Aug 8 at 14:45
Sure.. there is also a fastlane plugin that encrypts keystores github.com/hjanuschka/fastlane-plugin-cryptex (haven't tried). Plus here is a (dated) article about how NOT to manage certificates in Google Play Store researchcenter.paloaltonetworks.com/2014/08/…
– mmccabe
Aug 8 at 14:45
add a comment |
up vote
0
down vote
Usually I store keystore file (as base64 string), alias and passwords to Gitlab's secrets variables.
In the .gitlab-ci.yml do something like:
create_property_files:
stage: prepare
only:
- master
script:
- echo $KEYSTORE | base64 -d > my.keystore
- echo "keystorePath=my.keystore" > signing.properties
- echo "keystorePassword=$KEYSTORE_PASSWORD" >> signing.properties
- echo "keyAlias=$ALIAS" >> signing.properties
- echo "keyPassword=$KEY_PASSWORD" >> signing.properties
artifacts:
paths:
- my.keystore
- signing.properties
expire_in: 10 mins
And, finally, in your build gradle:
signingConfigs {
release {
file("../signing.properties").with { propFile ->
if (propFile.canRead()) {
def properties = new Properties()
properties.load(new FileInputStream(propFile))
storeFile file(properties['keystorePath'])
storePassword properties['keystorePassword']
keyAlias properties['keyAlias']
keyPassword properties['keyPassword']
} else {
println 'Unable to read signing.properties'
}
}
}
}
In this case you have all your sensitive data lying about in artifacts though, don't you ?
– zlandorf
Nov 27 at 14:52
Yes, for 10 minutes. To prevent this, you can write signing.properties directly in build stage
– IvanP
Nov 28 at 8:46
add a comment |
up vote
0
down vote
Usually I store keystore file (as base64 string), alias and passwords to Gitlab's secrets variables.
In the .gitlab-ci.yml do something like:
create_property_files:
stage: prepare
only:
- master
script:
- echo $KEYSTORE | base64 -d > my.keystore
- echo "keystorePath=my.keystore" > signing.properties
- echo "keystorePassword=$KEYSTORE_PASSWORD" >> signing.properties
- echo "keyAlias=$ALIAS" >> signing.properties
- echo "keyPassword=$KEY_PASSWORD" >> signing.properties
artifacts:
paths:
- my.keystore
- signing.properties
expire_in: 10 mins
And, finally, in your build gradle:
signingConfigs {
release {
file("../signing.properties").with { propFile ->
if (propFile.canRead()) {
def properties = new Properties()
properties.load(new FileInputStream(propFile))
storeFile file(properties['keystorePath'])
storePassword properties['keystorePassword']
keyAlias properties['keyAlias']
keyPassword properties['keyPassword']
} else {
println 'Unable to read signing.properties'
}
}
}
}
In this case you have all your sensitive data lying about in artifacts though, don't you ?
– zlandorf
Nov 27 at 14:52
Yes, for 10 minutes. To prevent this, you can write signing.properties directly in build stage
– IvanP
Nov 28 at 8:46
add a comment |
up vote
0
down vote
up vote
0
down vote
Usually I store keystore file (as base64 string), alias and passwords to Gitlab's secrets variables.
In the .gitlab-ci.yml do something like:
create_property_files:
stage: prepare
only:
- master
script:
- echo $KEYSTORE | base64 -d > my.keystore
- echo "keystorePath=my.keystore" > signing.properties
- echo "keystorePassword=$KEYSTORE_PASSWORD" >> signing.properties
- echo "keyAlias=$ALIAS" >> signing.properties
- echo "keyPassword=$KEY_PASSWORD" >> signing.properties
artifacts:
paths:
- my.keystore
- signing.properties
expire_in: 10 mins
And, finally, in your build gradle:
signingConfigs {
release {
file("../signing.properties").with { propFile ->
if (propFile.canRead()) {
def properties = new Properties()
properties.load(new FileInputStream(propFile))
storeFile file(properties['keystorePath'])
storePassword properties['keystorePassword']
keyAlias properties['keyAlias']
keyPassword properties['keyPassword']
} else {
println 'Unable to read signing.properties'
}
}
}
}
Usually I store keystore file (as base64 string), alias and passwords to Gitlab's secrets variables.
In the .gitlab-ci.yml do something like:
create_property_files:
stage: prepare
only:
- master
script:
- echo $KEYSTORE | base64 -d > my.keystore
- echo "keystorePath=my.keystore" > signing.properties
- echo "keystorePassword=$KEYSTORE_PASSWORD" >> signing.properties
- echo "keyAlias=$ALIAS" >> signing.properties
- echo "keyPassword=$KEY_PASSWORD" >> signing.properties
artifacts:
paths:
- my.keystore
- signing.properties
expire_in: 10 mins
And, finally, in your build gradle:
signingConfigs {
release {
file("../signing.properties").with { propFile ->
if (propFile.canRead()) {
def properties = new Properties()
properties.load(new FileInputStream(propFile))
storeFile file(properties['keystorePath'])
storePassword properties['keystorePassword']
keyAlias properties['keyAlias']
keyPassword properties['keyPassword']
} else {
println 'Unable to read signing.properties'
}
}
}
}
answered Nov 22 at 15:37
IvanP
439711
439711
In this case you have all your sensitive data lying about in artifacts though, don't you ?
– zlandorf
Nov 27 at 14:52
Yes, for 10 minutes. To prevent this, you can write signing.properties directly in build stage
– IvanP
Nov 28 at 8:46
add a comment |
In this case you have all your sensitive data lying about in artifacts though, don't you ?
– zlandorf
Nov 27 at 14:52
Yes, for 10 minutes. To prevent this, you can write signing.properties directly in build stage
– IvanP
Nov 28 at 8:46
In this case you have all your sensitive data lying about in artifacts though, don't you ?
– zlandorf
Nov 27 at 14:52
In this case you have all your sensitive data lying about in artifacts though, don't you ?
– zlandorf
Nov 27 at 14:52
Yes, for 10 minutes. To prevent this, you can write signing.properties directly in build stage
– IvanP
Nov 28 at 8:46
Yes, for 10 minutes. To prevent this, you can write signing.properties directly in build stage
– IvanP
Nov 28 at 8:46
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51725339%2fhow-to-manage-signing-keystore-in-gitlab-ci-for-android%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You should look into App Signing inside the google play console.
– Oliver
Aug 7 at 11:16
I've seen that one but I didn't catch you can build without key. I expected you'll need an upload key or so anyway. I'll reread it and see if I can get it. Thanks!
– Almund
Aug 7 at 12:00
Yes, you will still need a Keystore. But you can invalidate this keystore in the play console, if it gets leaked, because this one isn't your "real" keystore.
– Oliver
Aug 7 at 12:15