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

Image that references GH_ACCESS_TOKEN #4

Open
alex-96-eng opened this issue Aug 18, 2023 · 2 comments
Open

Image that references GH_ACCESS_TOKEN #4

alex-96-eng opened this issue Aug 18, 2023 · 2 comments

Comments

@alex-96-eng
Copy link

I am trying to use this actions file, but I get an error because my image references an internal private repo. Here is the image:

FROM python:3.10-alpine

ENV LISTEN_PORT=8000
EXPOSE 8000

WORKDIR /app
ARG GH_ACCESS_TOKEN
COPY requirements.txt /

RUN apk update && \
  apk add --no-cache --virtual .build-deps cargo make gcc g++ python3-dev musl-dev libxml2-dev libxslt-dev libffi-dev openssl-dev && \
  apk add --no-cache postgresql-dev libstdc++ libxslt git && \
  git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/ && \
  pip install --no-cache-dir -U pip wheel versioneer && \
  pip install --no-cache-dir -r /requirements.txt && \
  apk del .build-deps

The actions file fails due to this line:

git config --global url.https://[email protected]/.insteadOf https://github.com/ && \

because:

#8 20.38   Running command git clone --filter=blob:none --quiet https://github.com/sayhiya-org/core-commons /tmp/pip-install-0_bkim9g/commons_9840c85f3d994d04be3a73d4d994c6fd
#8 20.57   fatal: could not read Password for 'https://github.com/': No such device or address
#8 20.57   error: subprocess-exited-with-error

How can I pass through the password?

@alex-96-eng
Copy link
Author

After reading more, I try to use the extra_build_args attribute and have something like:

extra_build_args: GH_ACCESS_TOKEN=${{ secrets.GH_ACCESS_TOKEN }}

but I get:

ERROR: "docker buildx build" requires exactly 1 argument.

@vitr
Copy link
Owner

vitr commented Aug 18, 2023

Yep, actually, I'm using this action in the same way that you do, but I have this line with username:

RUN git config --global url."https://GitHub-Username:${GITHUBCOM_PERSONAL_ACCESS_TOKEN}@github.com".insteadOf "https://github.com"

In my case, GitHub-Username is vitr, and it works OK for me.
I believe this is the correct syntax for GitHub private repos:

https://<YOUR_USERNAME>:<YOUR_TOKEN>@github.com

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

2 participants