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

nomad-pack add registry does not honer default main/master branch #490

Open
Thadir opened this issue Mar 7, 2024 · 4 comments
Open

nomad-pack add registry does not honer default main/master branch #490

Thadir opened this issue Mar 7, 2024 · 4 comments
Labels
stage/needs-verification issue needs verifying it still exists theme/registry Relates to registries in general type/bug

Comments

@Thadir
Copy link

Thadir commented Mar 7, 2024

What I tried to do on nomad pack is add our own internal tempaltes. Trough the folwoing command:

nomad-pack registry add arval ssh://gitea@gitea.internal/nomad_pack_templates.git

The target repo I use had main as only branch. However i get the folowing error:

go-getter URL is ssh://gitea@gitea.internal/nomad_pack_templates.git?depth=1
! Could Not Install Registry
 
    Error:   error downloading 'ssh://gitea@ssh://gitea@gitea.internal/nomad_pack_templates.git?depth=1': /usr/bin/git exited with 128: Cloning into '/home/thadir/.cache/nomad/packs/nomad-pack-tmp'...
warning: Could not find remote branch master to clone.
fatal: Remote branch master not found in upstream origin
fatal: The remote end hung up unexpectedly
Gitea: Internal error
 
    Context:
        - Cache Path: /home/thadir/.cache/nomad/packs
        - Registry Source: ssh://gitea@gitea@gitea.internal/nomad_pack_templates.git
        - Registry Name: arval
        - Ref:
        - Pack Name:

Work around is creating a master branch. But our default and only branch was main.

@lm2497358068
Copy link

May I ask how you resolved it

@Thadir
Copy link
Author

Thadir commented Apr 3, 2024

May I ask how you resolved it

Like i said created a master branch again and have that as well. its not a workaround perse but it makes it work.

@angrycub
Copy link
Contributor

angrycub commented Apr 30, 2024

@lm2497358068, @Thadir: You can avoid creating an additional branch by specifying the branch to target using the -ref flag.
Could you share some additional information that might help figure out how to reproduce this issue locally?

  • OS version
  • Computer architecture
  • How did you install pack?
  • Does it persist in v0.1.1?

@angrycub angrycub added type/bug stage/needs-verification issue needs verifying it still exists theme/registry Relates to registries in general labels Apr 30, 2024
@Thadir
Copy link
Author

Thadir commented May 1, 2024

I am running them in containers as part of my pipline. But I would expect that pact will honer the main branch flag and not default to master.

This is my containerised version ill update it later this week to test with the new version v0.1.1:

#hadolint ignore=DL3007
FROM alpine:3.19.1 as verify

#hadolint ignore=DL3018
RUN apk --update add --no-cache unzip gnupg git jq

ARG HASHICORP_FINGERPRINT=c874011f0ab405110d02105534365d9472d7468f
ADD https://keybase.io/hashicorp/pgp_keys.asc?fingerprint=${HASHICORP_FINGERPRINT} /gpg/import/hashicorp.asc
RUN gpg --import /gpg/import/hashicorp.asc

WORKDIR /tmp

ARG NOMAD_VERSION=1.7.6
ARG NOMAD_PACK_VERSION=0.1.0

ADD https://releases.hashicorp.com/nomad/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_SHA256SUMS .
ADD https://releases.hashicorp.com/nomad/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_SHA256SUMS.sig .
ADD https://releases.hashicorp.com/nomad/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_linux_amd64.zip .

# Knwon bug atm in hasicorp certificate
#RUN wget -qO- https://www.hashicorp.com/.well-known/pgp-key.txt | gpg --import && gpg --verify nomad_${NOMAD_VERSION}_SHA256SUMS.sig nomad_${NOMAD_VERSION}_SHA256SUMS

#hadolint ignore=DL4006
RUN grep linux_amd64.zip nomad_${NOMAD_VERSION}_SHA256SUMS | sha256sum -cs
RUN unzip nomad_${NOMAD_VERSION}_linux_amd64.zip -d /usr/local/bin

#As soon as we get somting stable please top upsing a tech preview
ADD https://releases.hashicorp.com/nomad-pack/${NOMAD_PACK_VERSION}/nomad-pack_${NOMAD_PACK_VERSION}_linux_amd64.zip /tmp/nomad-pack.zip
RUN unzip /tmp/nomad-pack.zip -d /usr/local/bin

#hadolint ignore=DL3007
FROM frolvlad/alpine-glibc:alpine-3.19
#hadolint ignore=DL3018
RUN apk upgrade && \
    apk --update add --no-cache git jq

COPY --from=verify /usr/local/bin/* /usr/local/bin/
ENV PATH="$PATH:/usr/local/bin/"
RUN nomad version && \
    nomad-pack version

# Setup nomad pack registry
ENV HOME /home/jenkins/agent
RUN nomad-pack registry add internalcorppackregestry https://git.internalcorp.intranet/nomad_pack_templates.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage/needs-verification issue needs verifying it still exists theme/registry Relates to registries in general type/bug
Projects
None yet
Development

No branches or pull requests

3 participants