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

airshipctl document pull does not work if a repo has a detached HEAD #479

Closed
StevTheDev opened this issue Mar 8, 2021 · 6 comments
Closed
Assignees
Labels
1-Core Relates to airshipctl core components (i.e. go code) bug Something isn't working priority/medium Default priority for items size m
Milestone

Comments

@StevTheDev
Copy link

Describe the bug
airshipctl document pull does not work if a repo has a detached HEAD.

Steps To Reproduce

  • Have a detached head (eg from Gerrit PS Checkout)
steven@airship-2:~/treasuremap$ git status
HEAD detached at FETCH_HEAD
nothing to commit, working tree clean
steven@airship-2:~/treasuremap$ git log
commit 258b58add93e58e6756c22c2541af1494db4d128 (HEAD)
...
  • Observe the correct SHA in the config generated by gating script 22_test_configs.sh
  treasuremap_ci:
    inventoryRepositoryName: primary
    metadataPath: manifests/site/test-site/metadata.yaml
    phaseRepositoryName: primary
    repositories:
      airshipctl:
        checkout:
          branch: ""
          commitHash: 5820e22d9f436df2f93d8b71286b2ad0492279bc
          force: false
          localBranch: false
          tag: ""
        url: https://opendev.org/airship/airshipctl.git
      primary:
        checkout:
          branch: ""
          commitHash: 258b58add93e58e6756c22c2541af1494db4d128
          force: false
          localBranch: false
          tag: ""
        url: /home/steven/treasuremap
    targetPath: /tmp/default
  • Run airshipctl document pull --debug and observe reference not found
steven@airship-2:~/treasuremap$ airshipctl document pull --debug
[airshipctl] 2021/03/08 15:29:15 opendev.org/airship/airshipctl@/pkg/document/pull/pull.go:36: Reading current context manifest information from /home/steven/.airship/config
[airshipctl] 2021/03/08 15:29:15 opendev.org/airship/airshipctl@/pkg/document/pull/pull.go:51: Downloading airshipctl repository airshipctl from https://opendev.org/airship/airshipctl.git into /tmp/default
[airshipctl] 2021/03/08 15:29:15 opendev.org/airship/airshipctl@/pkg/document/repo/repo.go:141: Attempting to download the repository airshipctl
[airshipctl] 2021/03/08 15:29:15 opendev.org/airship/airshipctl@/pkg/document/repo/repo.go:126: Attempting to clone the repository airshipctl from https://opendev.org/airship/airshipctl.git
[airshipctl] 2021/03/08 15:29:19 opendev.org/airship/airshipctl@/pkg/document/repo/repo.go:110: Attempting to checkout the repository airshipctl from commit hash 5820e22d9f436df2f93d8b71286b2ad0492279bc
[airshipctl] 2021/03/08 15:29:19 opendev.org/airship/airshipctl@/pkg/document/pull/pull.go:51: Downloading primary repository treasuremap from /home/steven/treasuremap into /tmp/default
[airshipctl] 2021/03/08 15:29:19 opendev.org/airship/airshipctl@/pkg/document/repo/repo.go:141: Attempting to download the repository treasuremap
[airshipctl] 2021/03/08 15:29:19 opendev.org/airship/airshipctl@/pkg/document/repo/repo.go:126: Attempting to clone the repository treasuremap from /home/steven/treasuremap
unexpected client error: reference not found
  • Attach the HEAD to some branch git checkout -b asdfasdfas and rerun the command:
steven@airship-2:~/treasuremap$ git checkout -b asdfasdfas
Switched to a new branch 'asdfasdfas'
steven@airship-2:~/treasuremap$ sudo rm -rf /tmp/default/
steven@airship-2:~/treasuremap$ airshipctl document pull --debug
[airshipctl] 2021/03/08 15:31:05 opendev.org/airship/airshipctl@/pkg/document/pull/pull.go:36: Reading current context manifest information from /home/steven/.airship/config
[airshipctl] 2021/03/08 15:31:05 opendev.org/airship/airshipctl@/pkg/document/pull/pull.go:51: Downloading airshipctl repository airshipctl from https://opendev.org/airship/airshipctl.git into /tmp/default
[airshipctl] 2021/03/08 15:31:05 opendev.org/airship/airshipctl@/pkg/document/repo/repo.go:141: Attempting to download the repository airshipctl
[airshipctl] 2021/03/08 15:31:05 opendev.org/airship/airshipctl@/pkg/document/repo/repo.go:126: Attempting to clone the repository airshipctl from https://opendev.org/airship/airshipctl.git
[airshipctl] 2021/03/08 15:31:08 opendev.org/airship/airshipctl@/pkg/document/repo/repo.go:110: Attempting to checkout the repository airshipctl from commit hash 5820e22d9f436df2f93d8b71286b2ad0492279bc
[airshipctl] 2021/03/08 15:31:08 opendev.org/airship/airshipctl@/pkg/document/pull/pull.go:51: Downloading primary repository treasuremap from /home/steven/treasuremap into /tmp/default
[airshipctl] 2021/03/08 15:31:08 opendev.org/airship/airshipctl@/pkg/document/repo/repo.go:141: Attempting to download the repository treasuremap
[airshipctl] 2021/03/08 15:31:08 opendev.org/airship/airshipctl@/pkg/document/repo/repo.go:126: Attempting to clone the repository treasuremap from /home/steven/treasuremap
[airshipctl] 2021/03/08 15:31:09 opendev.org/airship/airshipctl@/pkg/document/repo/repo.go:110: Attempting to checkout the repository treasuremap from commit hash 258b58add93e58e6756c22c2541af1494db4d128
steven@airship-2:~/treasuremap$

Expected behavior
airshipctl document pull resolves the commitHash specified in the checkout section

Environment

  • airshipctl Version: master
  • Operating System: Ubuntu 18.04.5 LTS
  • Kernel version: 4.15.0-136-generic
  • Kubernetes Version: v1.18.6
  • Go version: go1.13.9
  • Hardware specs (e.g. 4 vCPUs, 16GB RAM, bare metal vs VM):
    • VM
    • 8 vCPU
    • 24GB RAM
@StevTheDev StevTheDev added bug Something isn't working triage Needs evaluation by project members labels Mar 8, 2021
@jezogwza jezogwza added priority/medium Default priority for items 1-Core Relates to airshipctl core components (i.e. go code) and removed triage Needs evaluation by project members labels Mar 17, 2021
@jezogwza jezogwza added this to the v2.1 milestone Mar 17, 2021
@vetbijaya
Copy link
Contributor

I can work on this one. Please assign this issue to me.

@eak13
Copy link

eak13 commented Mar 22, 2021

@vetbijaya done, please let us know t-shirt size once you've had a chance to evaluate. Thanks!

@vetbijaya
Copy link
Contributor

@ak3216, for now you can put as Medium t-shirt size.

@eak13 eak13 added the size m label Mar 23, 2021
@vetbijaya
Copy link
Contributor

@StevTheDev, I followed the steps in treasuremap which works fine for me. So, unable to reproduce the error.
Steps followed:

  1. clone treasuremap repo and run airshipctl document pull --debug
  2. Git checkout as detached HEAD from Gerrit and rerun document pull --debug
    Can we close this issue if this has been resolved? Thanks.

@StevTheDev
Copy link
Author

Hey @vetbijaya sorry for the prolonged delay - but I'm just getting back to work with airshipctl, and observed the same problem today. The command fails when not attached to any branch, but after doing so, the command is successful:

STDERR:

+ ./tools/deployment/23_pull_documents.sh
+ NO_CHECKOUT=true
+ echo 'Pull site documents using airshipctl'
+ '[' true == true ']'
+ airshipctl document pull -n --debug
[airshipctl] 2021/05/20 21:11:41 opendev.org/airship/airshipctl/pkg/document/pull/pull.go:36: Reading current context manifest information from /home/steven/.airship/config
[airshipctl] 2021/05/20 21:11:41 opendev.org/airship/airshipctl/pkg/document/pull/pull.go:51: Downloading primary repository airshipctl from /home/steven/airshipctl into /tmp/airship
[airshipctl] 2021/05/20 21:11:41 opendev.org/airship/airshipctl/pkg/document/repo/repo.go:141: Attempting to download the repository airshipctl
[airshipctl] 2021/05/20 21:11:41 opendev.org/airship/airshipctl/pkg/document/repo/repo.go:126: Attempting to clone the repository airshipctl from /home/steven/airshipctl
object not found

...

steven@airship-3:~/airshipctl$ git status
HEAD detached at origin/master
nothing to commit, working tree clean

steven@airship-3:~/airshipctl$ git checkout -b saldkfjasdfasdf
Switched to a new branch 'saldkfjasdfasdf'

steven@airship-3:~/airshipctl$ ./tools/deployment/23_pull_documents.sh
+ NO_CHECKOUT=true
+ echo 'Pull site documents using airshipctl'
Pull site documents using airshipctl
+ '[' true == true ']'
+ airshipctl document pull -n --debug
[airshipctl] 2021/05/20 21:12:24 opendev.org/airship/airshipctl/pkg/document/pull/pull.go:36: Reading current context manifest information from /home/steven/.airship/config
[airshipctl] 2021/05/20 21:12:24 opendev.org/airship/airshipctl/pkg/document/pull/pull.go:51: Downloading primary repository airshipctl from /home/steven/airshipctl into /tmp/airship
[airshipctl] 2021/05/20 21:12:24 opendev.org/airship/airshipctl/pkg/document/repo/repo.go:141: Attempting to download the repository airshipctl
[airshipctl] 2021/05/20 21:12:24 opendev.org/airship/airshipctl/pkg/document/repo/repo.go:126: Attempting to clone the repository airshipctl from /home/steven/airshipctl
[airshipctl] 2021/05/20 21:12:24 opendev.org/airship/airshipctl/pkg/document/repo/repo.go:120: Attempting to open repository airshipctl

@jezogwza
Copy link
Contributor

jezogwza commented Jul 7, 2021

We are going to recommend closing this, if another user encounters this problem again we can reopen it. But at the moment it feels that this is fixed.

@jezogwza jezogwza closed this as completed Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-Core Relates to airshipctl core components (i.e. go code) bug Something isn't working priority/medium Default priority for items size m
Projects
None yet
Development

No branches or pull requests

4 participants