Deploy to GCP bucket

I am trying to deploy my Hugo site to GCP bucket per the instructions below and getting this error:

hugo deploy [–target=test]
Error: failed to load modules: failed to read dir “C:\MyStuff\HugoSite\IMS-Site\IMS-site\themes\inventory\IMSSite\themes\inventory\”: “open C:\MyStuff\HugoSite\IMS-Site\IMS-site\themes\inventory\IMSSite\themes\inventory\: The filename, directory name, or volume label syntax is incorrect.”
PS C:\MyStuff\HugoSite\IMS-Site\IMS-site\themes\inventory\IMSSite>

The filename and directory are correct.

This is what I have in the config.yml for the deployment:

deployment:

targets:

# An arbitrary name for this target.

name: test

# URL specifies the Go Cloud Development Kit URL to deploy to. Examples:

#URL: "<FILL ME IN>"

# Google Cloud Storage -- see https://gocloud.dev/howto/blob/#gcs

URL: gs://ims-site-test-depoloyment

do I need to add anything else in my Config.yml file??

When posting code, configuration, or data on this forum, please wrap the text within backticks or use the </> button in the menu.

```
my code
```

Just updated. sorry about that.

Please post your site config.

1 Like
###############################################################################
#                                                                             #
#                            WEBSITE CONFIGURATION                            #
#                                                                             #
###############################################################################


# --- base website settings ---

baseURL: https://unicef.github.io/inventory-hugo-theme/
title: Image Systems
theme: inventory
languageCode: en-us
enableEmoji: true
enableGitInfo: true

# Optional: Add Google Analytics tracking support.
googleAnalytics: ""


# --- security settings ---

security:
  exec:
    allow: ['^dart-sass-embedded$', '^go$', '^npx$', '^postcss$', '^asciidoctor$']


# --- markup settings ---

markup:
  asciidocExt:
    preserveTOC: true
    sectionNumbers: true
  goldmark:
    renderer:
      unsafe: true
  highlight:
    anchorLineNos: false
    codeFences: true
    guessSyntax: false
    hl_Lines: ""
    lineAnchors: ""
    lineNoStart: 1
    lineNos: true
    lineNumbersInTable: false
    noClasses: true
    style: murphy
    tabWidth: 4


# --- privacy settings ---

privacy:
  googleAnalytics:
    anonymizeIP: true
    respectDoNotTrack: true
  twitter:
    enableDNT: true
  vimeo:
    enableDNT: true
  youtube:
    privacyEnhanced: true


# --- custom settings ---

params:
  # "Edit this page" feature: git forge content base link
  # [Example] editPrefix: https://github.com/username/repo-name/blob/main/content
  editPrefix: https://github.com/unicef/inventory-hugo-theme/blob/main/exampleSite/content

  # Shown on all pages. When logo is empty, it will show your site title, set above.
  logo: ""

  # OpenGraph data
  description: Image Management -
  author: Image Management 
  # Tip: Find a royalty-free image from unsplash.com for an OpenGraph image.
  image: "images/banner.jpg"

  # customize color
  primary_color: "#1689b5"
  primary_color_light: "#1b66b1"
  body_color: "#f2f4f6"
  text_color: "#636363"
  text_color_dark: "#374ea2"
  text_title_color: "#ffffff"
  white_color: "#ffffff"
  light_color: "#f8f9fa"

  # font family (choose from https://fonts.google.com/)
  font_family: "Lato"

  # contact form action (works with https://formspree.io)
  #contact_form_action: "#"

  # related article number limit
  article_count: 3

  # brand and identity information
  brand:
    parent_org_name: Image Management 
    parent_org_url: https://sharepoint.com/teams//SitePages/Home.aspx
    parent_org_url_legal: https://sharepoint.com/teams//SitePages/Home.aspx
  footer:
    # parent_org_name: Imaging Services
    # parent_org_url:
    mainSiteName: Imaging Services
    mainSite: 


# --- social platform settings ---
# themify icon pack : https://themify.me/themify-icons

  social:
    - #icon: ti-github
      name: UNICEF Inventory Theme on GitHub
      link: https://github.com/unicef/inventory-hugo-theme
    - #icon: ti-twitter-alt
      name: "@UNICEFinnovate on Twitter"
      link: https://twitter.com/UNICEFinnovate


# --- taxonomy settings ---

taxonomies:
  alert: alerts
  category: categories
  downloadable: downloadBtn


# --- multilingual settings ---

Languages:
############################# English #############################
  en:
    languageName: en
    languageCode: en-us
    weight: 1
    home: Home
    copyright: "Copyright &copy; 2020-2022 a Hugo theme by [IMS Unit](https://sharepoint.com/teams/SitePages/Home.aspx)"
    params:
      banner:
        title: Image Management 
        subtitle: Documentation and knowledge base
        bg_image: images/banner.jpg
        placeholder: Search the site here.
      # cta:
      #   enable: false
      #   title: Formspree integration
      #   content: Create a quick and easy contact form for site visitors to get in touch using built-in Formspree integration.
      #   button:
      #     enable: true
      #     label: See the form
      #     link: contact
      footer:
        #description: UNICEF Inventory Theme documentation and example site. Powered by Hugo, a static site generator. An open source tool from the UNICEF Office of Innovation, Ventures Team.

    # --- navigation menu ---
    menu:
      main:
        # - name: FAQ
        #   weight: 10
        #   url: faq
        - name: Contact
          weight: 20
          url: contact

        - name: pages
          weight: 50
          url: pages
          hasChildren: true
        # Sub-pages in this drop-down should correspond to categories created in /content/
        # - name: 1. About
        #   parent: pages
        #   weight: 10
        #   url: about
        - name:  Oncall Support
          parent: pages
          weight: 20
          url: oncall
        # - name:  Installation
        #   parent: pages
        #   weight: 30
        #   url: install
        # - name:  Contributing
        #   parent: pages
        #   weight: 50
        #   url: contributing




##############################################[deployment]##############################################

deployment:
  targets:
# An arbitrary name for this target.
name: test

# URL specifies the Go Cloud Development Kit URL to deploy to. Examples:
#URL: "<FILL ME IN>"

# Google Cloud Storage -- see https://gocloud.dev/howto/blob/#gcs
URL: gs://ims-site-test-depoloyment

I just noticed that your YAML is malformed. Fix that first.

Your current config has this data structure:

{
  "deployment": {
    "targets": null
  },
  "name": "test",
  "URL": "gs://ims-site-test-depoloyment"
}

You need this data structure instead:

{
  "deployment": {
    "targets": [
      {
        "name": "test",
        "URL": "gs://ims-site-test-depoloyment"
      }
    ]
  }
}

Not sure how it’s malformed when it’s running fine locally. Any specifics to the malformation ?

Look your YAML indentation. One of many reasons I prefer TOML.

Now after the suggested changes , getting this:

config.yaml:198:1": failed to unmarshal YAML: yaml: line 198: could not find expected ’

I have to roll with yaml for now.

I depicted the data structure, not the actual YAML. That’s why I said “data structure”.

a YAML formatter is giving the same error:

deployment:
  targets:
    - name: test
      URL: 'gs://ims-site-test-depoloyment'

ERROR: The filename, directory name, or volume label syntax is incorrect."

OK, we have the YAML fixed. Now let’s look at the error:

C:\MyStuff\HugoSite\IMS-Site\IMS-site\themes\inventory\IMSSite\themes\inventory\”

Do you know why the path looks like that, with repeated segments? Is there anything unusual about your Windows setup? Hard links, symlinks, etc.?

It’s not actually repeated:

C:\MyStuff\HugoSite\IMS-Site\IMS-site\themes\inventory\IMSSite\themes
I have a module compiled in the themes folder now if I move it one folder up I get this error:

module “inventory” not found in “C:\MyStuff\HugoSite\IMS-Site\IMS-site\themes\inventory\IMSSite\themes\inventory”; either add it as a Hugo Module or store it in “C:\MyStuff\HugoSite\IMS-Site\IMS-site\themes\inventory\IMSSite\themes”.: module does not exist

I don’t know what this means.

Here’s what I would do. Start with a simple test site:

hugo new site my-site
cd my-site/
hugo new theme my-theme

Then edit hugo.toml:

  1. Set theme = 'my-theme'.
  2. Add the deploy settings
  3. Test

That will verify that hugo deploy works as expected on Windows with the target you defined.

Just did, here it is:
hugo.toml:

baseURL = 'https://example.org/'
languageCode = 'en-us'
title = 'My New Hugo Site'
set theme = 'my-theme'

[[deployment.targets]]
name = "test"
URL = "gs://ims-site-test-depoloyment"

hugo deploy [–target=test]
Error: no deployment targets found

Oh no. Really? The command is:

hugo deploy --target=test

or

hugo deploy --target test

In documentation, help, or man pages, when you see a flag in brackets it means optional.

My mistake. In you config file it should be:

theme = 'my-theme'

No problem, Thank you for that.

Now, I am having credentials issue with GCP. is there a documentation on that ?

This is more of a GCP issue than a Hugo issue, but…

https://gohugo.io/hosting-and-deployment/hugo-deploy/#assumptions