coveralls: 
[![Coverage Status](https://coveralls.io/builds/12989449/badge)](https://coveralls.io/builds/12989449)

Coverage decreased (-0.2%) to 84.185% when pulling **bc4f97f25ac83c3272e0bd949d59ef3f7add1168 on luisfarzati:58-fix-credsstore-bug** into **0afce92aedf654855ad35b90623410e6d6c261dd on zalando-stups:master**.

Raffo: @hjacobs The problem looks like it is coming from pierone/api.py line 65 where we read from the local config instead of the temp file. 
Raffo: Ok I figured out the problem, pushed a commit with @luisfarzati , should work now! 
coveralls: 
[![Coverage Status](https://coveralls.io/builds/12992022/badge)](https://coveralls.io/builds/12992022)

Coverage increased (+0.08%) to 84.428% when pulling **2b8aa9d20c68984ea9af219f085e15182c5799d0 on luisfarzati:58-fix-credsstore-bug** into **0afce92aedf654855ad35b90623410e6d6c261dd on zalando-stups:master**.

Raffo: @hjacobs please review. 
luisfarzati: ty @Raffo :)
hjacobs: :+1: 
diff --git a/pierone/api.py b/pierone/api.py
index 35542be..9b0c76a 100644
--- a/pierone/api.py
+++ b/pierone/api.py
@@ -71,6 +71,9 @@ def docker_login_with_token(url, access_token):
     basic_auth = codecs.encode('oauth2:{}'.format(access_token).encode('utf-8'), 'base64').strip().decode('utf-8')
     if 'auths' not in dockercfg:
         dockercfg['auths'] = {}
+    if 'credsStore' in dockercfg:
+        del dockercfg['credsStore']
+
     dockercfg['auths'][url] = {'auth': basic_auth,
                                'email': 'no-mail-required@example.org'}
     with Action('Storing Docker client configuration in {}..'.format(path)):

no basic auth credentials
Today I had an auth issue. While trying to do `docker push` I was getting the following log:

    ➜ pierone login             
    Getting OAuth2 token "pierone".. OK
    Storing Docker client configuration in /Users/whoever/.docker/config.json.. OK
    ➜ docker push myrepo/...
    The push refers to a repository [myrepo/...]
    a5f591aacc10: Preparing 
    ...
    cb11ba605400: Waiting 
    no basic auth credentials

Recreating `~/config.json` saved me.  
There was `"credsStore": "osxkeychain"` setting In the previous version of the `~/config.json` which was causing me troubles.

BTW 
mac os 10.12.3
pierone cli 1.1.27
docker 17.06.0-ce, build 02c1d87
diff --git a/tests/test_api.py b/tests/test_api.py
index 62e1f0a..3ee83be 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -21,6 +21,29 @@ def test_docker_login(monkeypatch, tmpdir):
         assert {'auth': 'b2F1dGgyOjEyMzc3',
                 'email': 'no-mail-required@example.org'} == data.get('auths').get('https://pierone.example.org')
 
+def test_docker_login_with_credsstore(monkeypatch, tmpdir):
+    monkeypatch.setattr('os.path.expanduser', lambda x: x.replace('~', str(tmpdir)))
+    monkeypatch.setattr('pierone.api.get_token', MagicMock(return_value='12377'))
+    path = os.path.expanduser('~/.docker/config.json')
+    os.makedirs(os.path.dirname(path))
+    with open(path, 'w') as fd:
+        json.dump({
+            "auths": {
+                "https://pierone.stups.zalan.do": {
+                    "auth": "xxx",
+                    "email": "no-mail-required@example.org"
+                }
+            },
+            "credsStore": "osxkeychain"
+        }, fd)
+    docker_login('https://pierone.example.org', 'services', 'mytok',
+                 'myuser', 'mypass', 'https://token.example.org', use_keyring=False)
+    with open(path) as fd:
+        data = yaml.safe_load(fd)
+        assert {'auth': 'b2F1dGgyOjEyMzc3',
+                'email': 'no-mail-required@example.org'} == data.get('auths').get('https://pierone.example.org')
+        assert 'credsStore' not in data
+
 
 def test_docker_login_service_token(monkeypatch, tmpdir):
     monkeypatch.setattr('os.path.expanduser', lambda x: x.replace('~', str(tmpdir)))

pip install -e .
parse_log_pytest
requirements.txt
pytest pytest-cov
apt-get update apt-get install -y gcc
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
clickclick==20.10.2
coverage==7.8.0
dnspython==2.7.0
exceptiongroup==1.2.2
idna==3.10
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-cov==6.0.0
PyYAML==6.0.2
requests==2.32.3
stups-cli-support==1.1.22
-e git+https://github.com/zalando-stups/pierone-cli.git@0afce92aedf654855ad35b90623410e6d6c261dd#egg=stups_pierone
stups-tokens==1.1.19
stups-zign==1.2
tomli==2.2.1
urllib3==2.3.0

name: pierone-cli
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - click==8.1.8
      - clickclick==20.10.2
      - coverage==7.8.0
      - dnspython==2.7.0
      - exceptiongroup==1.2.2
      - idna==3.10
      - iniconfig==2.1.0
      - packaging==24.2
      - pluggy==1.5.0
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - pyyaml==6.0.2
      - requests==2.32.3
      - stups-cli-support==1.1.22
      - stups-tokens==1.1.19
      - stups-zign==1.2
      - tomli==2.2.1
      - urllib3==2.3.0
prefix: /opt/conda/envs/pierone-cli

tests/test_api.py::test_docker_login_with_credsstore
tests/test_api.py::test_docker_login tests/test_api.py::test_docker_login_service_token tests/test_api.py::test_docker_login_with_iid tests/test_api.py::test_keep_dockercfg_entries tests/test_api.py::test_get_latest_tag tests/test_api.py::test_get_latest_tag_IOException tests/test_api.py::test_get_latest_tag_non_json tests/test_api.py::test_image_exists tests/test_api.py::test_image_exists_IOException tests/test_api.py::test_image_exists_but_other_version tests/test_api.py::test_image_not_exists tests/test_api.py::test_get_image_tags tests/test_api.py::test_get_image_tag tests/test_api.py::test_get_image_tag_that_does_not_exist
pierone/api.py
pierone/api.py