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

Act is hardcoded to a specific image #132

Open
andre15silva opened this issue Dec 7, 2023 · 0 comments
Open

Act is hardcoded to a specific image #132

andre15silva opened this issue Dec 7, 2023 · 0 comments

Comments

@andre15silva
Copy link
Member

The setup of our Act abstraction is hard-coded to a specific runner image.

If we are using another image (which perhaps does not need building), this will not work.

@staticmethod
def __setup_act():
with Act.__SETUP_LOCK:
if Act.__ACT_SETUP:
return
# Checks act installation
run = subprocess.run(
f"{Act.__ACT_PATH} --help", shell=True, capture_output=True
)
if run.returncode != 0:
logging.error("Act is not correctly installed")
exit(-1)
# Creates crawler image
client = docker.from_env()
if len(client.images.list(name="gitbugactions")) > 0:
client.images.remove(image="gitbugactions")
with open("Dockerfile", "w") as f:
client = docker.from_env()
dockerfile = "FROM catthehacker/ubuntu:full-latest\n"
dockerfile += f"RUN sudo groupadd -o -g {os.getgid()} {grp.getgrgid(os.getgid()).gr_name}\n"
dockerfile += f"RUN sudo usermod -G {os.getgid()} runner\n"
dockerfile += f"RUN sudo usermod -u {os.getuid()} runner\n"
f.write(dockerfile)
client.images.build(path="./", tag="gitbugactions", forcerm=True)
os.remove("Dockerfile")
Act.__ACT_SETUP = True

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

1 participant