AndreMikulec / plr

PL/R - R Procedural Language for PostgreSQL
http://www.joeconway.com
GNU General Public License v2.0
0 stars 0 forks source link

appveyor - Error creating GitHub release: Error reading repository 'postgres-plr/plr' releases: 401 - Unauthorized #40

Open AndreMikulec opened 4 days ago

AndreMikulec commented 4 days ago
THE ONE THAT DID NOT WORK (PUSH THE TAG)
https://github.com/postgres-plr/plr/blob/ae75fe46aa3d8a2401cc1641ecaf6a31800163b8/appveyor.yml

  #
  # last of Github deployments, to try to appear as "latest"
  #
  - provider: GitHub
    release: $(APPVEYOR_REPO_TAG_NAME)
    draft: false
    prerelease: false
    artifact: plr_7z
    auth_token:
      # Token of Dave
      secure: DpxrjrmF0pQsm3G/F8m7EDVz6yhBQhlwXWOtqxgQTmUMiofL1PZD+9Q1dAqyKh9Z
    on:
      APPVEYOR_REPO_TAG: true

Deploying using GitHub provider
Creating "REL8_4_7" release for repository "postgres-plr/plr" tag "REL8_4_7" commit "ae75fe46aa3d8a2401cc1641ecaf6a31800163b8"...Error creating GitHub release: Error reading repository 'postgres-plr/plr' releases: 401 - Unauthorized

https://ci.appveyor.com/project/davecramer/plr-lek5y/builds/50707485
https://ci.appveyor.com/project/davecramer/plr-lek5y/builds/50707485/job/ptcbcg614cb7ekmo?fullLog=true

specifically
https://ci.appveyor.com/project/davecramer/plr-lek5y/builds/50707485/job/ptcbcg614cb7ekmo?fullLog=true#L14135

PREVIOUS PULL REQUEST (NOT A TAG SUBMISSION)

https://github.com/postgres-plr/plr/blob/ae75fe46aa3d8a2401cc1641ecaf6a31800163b8/appveyor.yml

  #
  # last of Github deployments, to try to appear as "latest"
  #
  - provider: GitHub
    release: $(APPVEYOR_REPO_TAG_NAME)
    draft: false
    prerelease: false
    artifact: plr_7z
    auth_token:
      # Token of Dave
      secure: DpxrjrmF0pQsm3G/F8m7EDVz6yhBQhlwXWOtqxgQTmUMiofL1PZD+9Q1dAqyKh9Z
    on:
      APPVEYOR_REPO_TAG: true

https://ci.appveyor.com/project/davecramer/plr-lek5y/builds/50698553/job/c1i11r44uoagin4x

"GitHub" deployment has been skipped as environment variable 
has not matched ("APPVEYOR_REPO_TAG" is "false", should be "true")

-------

(NO CHANGE FROM ABOVE)
THE PREVIOUS ONE THAT DID WORK? LEFT MESSAGE
https://github.com/postgres-plr/plr/blob/21bee6da0434a786e4053225665bcef52f62149f/appveyor.yml

ANDRE: FROM MY KP2 NOTES - MY TOKEN IS - KzS1D

  #
  # last of Github deployments, to try to appear as "latest"
  #
  - provider: GitHub
    release: $(APPVEYOR_REPO_TAG_NAME)
    draft: false
    prerelease: false
    artifact: plr_7z
    auth_token:
      # Token of Dave
      secure: nasXR/dCMdQmmouYtN0t1/9jilLmOA6E5EsGoP6Td5yvp3JK4QPfZO0BEVzMeXW1
      # Token of Andre
      # secure: DpxrjrmF0pQsm3G/F8m7EDVz6yhBQhlwXWOtqxgQTmUMiofL1PZD+9Q1dAqyKh9Z
    on:
      APPVEYOR_REPO_TAG: true

----

appveyor.yml - FURTHEST BLAME BACK
https://github.com/postgres-plr/plr/blame/472cc930659e9e6f8eabc60eed398d981444a96e/appveyor.yml

DOES Dpxrj belong to me?

#   # If the "release" does not pre-exist and thus "secure" will try to create the release
#   # and if "secure" does not have permission to create a release, then an ERROR will occur,
#   # then Appveyor will ERROR.
#   - provider: GitHub
#     release: 0.0.0.0.0.GITHUBCACHE
#     draft: false
#     prerelease: false
#     artifact: pg_7z
#     auth_token:
#       secure: DpxrjrmF0pQsm3G/F8m7EDVz6yhBQhlwXWOtqxgQTmUMiofL1PZD+9Q1dAqyKh9Z
#     # non - "branch, tag, or commit" will still be expected "false" ( githubcache != true )
#     # and never find a pg-*.7z to deploy - and that is OK.

  #
  # last of Github deployments, to try to appear as "latest"
  #
  - provider: GitHub
    release: $(APPVEYOR_REPO_TAG_NAME)
    draft: false
    prerelease: false
    artifact: plr_7z
    auth_token:
      secure: DpxrjrmF0pQsm3G/F8m7EDVz6yhBQhlwXWOtqxgQTmUMiofL1PZD+9Q1dAqyKh9Z
    on:
      APPVEYOR_REPO_TAG: true

------

Commits on Aug 1, 2023
update release token
https://github.com/postgres-plr/plr/commits/master/

----

update release token
https://github.com/postgres-plr/plr/commit/a430854d6471c3092225ccc5ddc8ffdde07e59fc

   auth_token:
      secure: nasXR/dCMdQmmouYtN0t1/9jilLmOA6E5EsGoP6Td5yvp3JK4QPfZO0BEVzMeXW1
    + secure: DpxrjrmF0pQsm3G/F8m7EDVz6yhBQhlwXWOtqxgQTmUMiofL1PZD+9Q1dAqyKh9Z
   on:
      appveyor_repo_tag: true

-----

401 Unauthorized when releasing to GitHub

Common problem here is double-encryption. 
It happens if you encrypt clear text value in 
https://ci.appveyor.com/tools/encrypt, 
then pasted encrypted value into GitHub deployment UI, 
press "lock" (this encrypting it second time) 
and then press "Export YAML". 

Could this happen to you? 
If yes, paste clear text into GitHub deployment UI, 
press "lock" (this encrypting it just once) 
and then press "Export YAML".

https://help.appveyor.com/discussions/problems/8211-401-unauthorized-when-releasing-to-github

----

From: ANDRE
Sent: Monday, September 30, 2024 11:27 PM
To: davecramer@postgres.rocks <davecramer@postgres.rocks>
Subject: github.com/postgres-plr/plr - appveyor.yml - 401 Unauthorized when releasing to GitHub

Dave,

When I push a tag to github.com/postgres-plr/plr, appveyor reads appveyor.yml, begins building.
At the end of an appveyor build job, deployment s attemped if a tag had been submitted.

https://github.com/postgres-plr/plr/blob/ae75fe46aa3d8a2401cc1641ecaf6a31800163b8/appveyor.yml

  #
  # last of Github deployments, to try to appear as "latest"
  #
  - provider: GitHub
    release: $(APPVEYOR_REPO_TAG_NAME)
    draft: false
    prerelease: false
    artifact: plr_7z
    auth_token:
      # Token of Dave
      secure: DpxrjrmF0pQsm3G/F8m7EDVz6yhBQhlwXWOtqxgQTmUMiofL1PZD+9Q1dAqyKh9Z
    on:
      APPVEYOR_REPO_TAG: true

However, at the end of the build job, an error happens:

specifically
https://ci.appveyor.com/project/davecramer/plr-lek5y/builds/50707485/job/ptcbcg614cb7ekmo?fullLog=true#L14135

Deploying using GitHub provider
Creating "REL8_4_7" release for repository "postgres-plr/plr" tag "REL8_4_7" commit "ae75fe46aa3d8a2401cc1641ecaf6a31800163b8"...Error creating GitHub release: Error reading repository 'postgres-plr/plr' releases: 401 - Unauthorized

The following may [or may not] be the possible problem and possible solution.
Would you mind taking a look?

401 Unauthorized when releasing to GitHub
https://help.appveyor.com/discussions/problems/8211-401-unauthorized-when-releasing-to-github

Common problem here is double-encryption.
It happens if you encrypt clear text value in
https://ci.appveyor.com/tools/encrypt,
then pasted encrypted value into GitHub deployment UI,
press "lock" (this encrypting it second time)
and then press "Export YAML".

Could this happen to you?
If yes, paste clear text into GitHub deployment UI,
press "lock" (this encrypting it just once)
and then press "Export YAML".
AndreMikulec commented 1 day ago

----

Status code 401: Unauthorized

Hi Mauro,

Please try to go to 
https://ci.appveyor.com/account, 
remove GitHub authorization 
and 
re-add this again. 
Let us know if this helps.

Ilya.

Status code 401: Unauthorized
Mauro Sampietro
May 16, 2017 @ 05:20 AM
https://help.appveyor.com/discussions/questions/3935-status-code-401-unauthorized

https://ci.appveyor.com/authorizations
  AppVeyor is authorized to act on behalf of 
   AndreMikulec GitHub account with 
       admin:repo_hook, 
       read:org, 
       repo:status 
   scope. 
     Don't see org resources? 
   Ensure organization access 
       postgres-plr
          Read about third-party access.
          https://docs.github.com/en/organizations/managing-oauth-access-to-your-organizations-data/about-oauth-app-access-restrictions
     https://github.com/settings/connections/applications/01881570529737c25f97
   is granted to AppVeyor CI application.

----

So, if the value of CHUMMER_OAUTH_TOKEN variable 
is marked as "secure" on UI  (lock sign is clicked next to it) 
then you could use it as the following in appveyor.yml:

  auth_token: ${CHUMMER_OAUTH_TOKEN}

OK, make sure you encrypt the token 
under the same AppVeyor account which uses it.

401 unauthorised when submitting release
richard.thomas86
Feb 25, 2022 @ 03:43 AM
https://help.appveyor.com/discussions/problems/31535-401-unauthorised-when-submitting-release

----
AndreMikulec commented 1 day ago
----

(NOTHING WAS FOUND THERE IN EARLY OCT 2024)
https://github.com/settings/tokens

PAT_OCT2024__repostatus__repo_deployment__public_repo
ghp_<omitted>

AppVeyor (Account -> Encrypt YAML).
p/5gj6Qtfk4BKm9EBhiDw0r4UkHKtRyH5mIOsQs2QzI128Vul9mjTgT/WM8cnNa6

Example usage in appveyor.yml
environment:
  my_variable:
    secure: p/5gj6Qtfk4BKm9EBhiDw0r4UkHKtRyH5mIOsQs2QzI128Vul9mjTgT/WM8cnNa6

Authenticating with a personal access token

THAT WORKS
https://github.com/AndreMikulec/appveyortest4/commit/22dfc92c97fb104f5058f29b8a4b959e78bbbabe
https://ci.appveyor.com/project/AndreMikulec/appveyortest4/builds/50729519
https://github.com/AndreMikulec/appveyortest4/releases/tag/RELTEST

---

ANOTHER USAGE (OFFTOPIC)

Personal access tokens (classic) function 
like ordinary OAuth access tokens. 
They can be used instead of a password for Git over HTTPS, 
or can be used to authenticate to the API over 
Basic Authentication.
https://github.com/settings/tokens

  Using basic authentication
  Authenticating with a personal access token
  Authenticating to the REST API
  https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api?apiVersion=2022-11-28#basic-authentication

----
AndreMikulec commented 1 day ago
----

Dave,

This works . . .
https://github.com/AndreMikulec/appveyortest4/commit/22dfc92c97fb104f5058f29b8a4b959e78bbbabe
https://ci.appveyor.com/project/AndreMikulec/appveyortest4/builds/50729519
https://github.com/AndreMikulec/appveyortest4/releases/tag/RELTEST

The error exists
  Error creating GitHub release: 
  Error reading repository 'postgres-plr/plr' releases: 
  401 - Unauthorized

To try to solve the error do the following:

1.
In
https://github.com/settings/tokens

i. Make sure that a classic PAT is there (and in my case NOTHING was there)
ii. Make sure that a classic PAT is there and not expired

If neither i. nor ii. is not true then go to (2.)

2.
from
https://github.com/settings/tokens
create a new classic token
(I named mine: PAT_OCT2024__repostatus__repo_deployment__public_repo)
  with 
  i. repo:status, 
  ii. repo_deployment, and 
  iii. public_repo

3.
from (logged in)
https://ci.appveyor.com/tools/encrypt
encrypt that <ghp_ . . .>
and save that encryped value

4.
from
https://github.com/postgres-plr/plr/blob/master/appveyor.yml
at the bottom at "secure:"
  i. after "secure: " place in the new encripted value
  ii. commit with a message and push (and this will try to build)
AndreMikulec commented 1 day ago

From: ANDRE
Sent: Thursday, October 3, 2024 7:07 PM
To: Dave Cramer <davecramer@gmail.com>
Cc: devrim@gunduz.org <devrim@gunduz.org>; myon@debian.org <myon@debian.org>
Subject: Fw: github.com/postgres-plr/plr - appveyor.yml - 401 Unauthorized when releasing to GitHub

Dave,

This is not a PLR release.

This works . . .
https://github.com/AndreMikulec/appveyortest4/commit/22dfc92c97fb104f5058f29b8a4b959e78bbbabe
https://ci.appveyor.com/project/AndreMikulec/appveyortest4/builds/50729519
https://github.com/AndreMikulec/appveyortest4/releases/tag/RELTEST

The error exists
  Error creating GitHub release: 
  Error reading repository 'postgres-plr/plr' releases: 401 - Unauthorized

To try to solve the error do the following:

1.
In
https://github.com/settings/tokens

i. Make sure that a classic PAT is there (and in my case NOTHING was there)
ii. Make sure that a classic PAT is there and not expired

If neither i. nor ii. is not true then go to (2.)
If either i. or ii. is true, try to create a new classic PAT.  Go to (2.)

2.
from
https://github.com/settings/tokens
create a new classic token
(I named mine: PAT_OCT2024__repostatus__repo_deployment__public_repo)
  with 
  i. repo:status, 
  ii. repo_deployment, and 
  iii. public_repo
and save that token

3.
from (logged in)
https://ci.appveyor.com/tools/encrypt
encrypt that token <ghp_ . . .>
and save that encryped value

4.
from
https://github.com/postgres-plr/plr/blob/master/appveyor.yml
at the bottom at "secure:"
  i. after "secure: " place in the new encrypted value
  ii. commit with a message and push (and this will try to build)
AndreMikulec commented 1 day ago

(for Above) technology implementation URLs

GitHub authentication token (auth_token) 
- OAuth token used for authentication against GitHub API. 
You can generate Personal API access token at 
  https://github.com/settings/tokens. 
Minimal token scope is 
  repo or public_repo to release on private or public repositories respectively. 
The permissions 
  repo:status, repo_deployment 
  are necessary for successful deployment of artifacts to GitHub. 
Be sure to encrypt your token using “Encrypt configuration data” page 
in AppVeyor (Account → Encrypt YAML).

https://www.appveyor.com/docs/deployment/github/

Creating a personal access token (classic)
Managing your personal access tokens
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens