HTTPS Download Sourcing Type

Montuer has a built-in HTTPS download sourcing method for its Setup Meta processing function. Here's its working mechanics and specifications.

Purpose

The purpose of facilitating this sourcing method type is for Monteur to source a 3rd-party software package for the repository via HTTPS download, all solely using its built-in functionalities including network interactions.

Data Structure

This function is specifically built into the Setup CI Job. Hence, its data structure is scattered across various parts and sections of the CI Job recipe. In this specification, all its settings are specified in each sub-sections by following the CI Job's recipe's data file from top to bottom.

Sourcing Method Type

To use this method type, simply set Metadata.Type to percisely https-download. This will instruct Monteur to use its internal HTTPS download function for sourcing the 3rd-party target file across the network.

Here is a code snippet of the recipe file:

1
2
3
[Metadata]
...
Type = 'https-download'

Recipe Sourcing Section

This sourcing method employs almost all the fields in the recipe sourcing section. Moreover, the overwriting policy is a great feature to keep most of the settings sane and maintain Don't Repeat Yourself policy.

Generally speaking, you want to define the overall HTTPS interface using the all-all Monteur Platform ID first to unify the server interactions before overwriting it with opreating system specific data. The easiest and greatest example would be the target's checksum value where they have many variants across different platforms and each of them changed between releases.

Here is the recommended fields in its data structure for effective maintenance and readability usage:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[Sources.all-all]
Format = 'tar.gz'
URL = '{{- .BaseURL -}}{{- .Archive -}}'
Archive = 'go{{- .Version -}}.{{- .ComputeSystem -}}.{{- .Format -}}'
Method = 'GET'

[Sources.all-all.Checksum]
Type = 'sha256'
Format = 'hex'

[Sources.all-all.Headers]
"User-Agent" = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148'
"auth-token" = "{{- GetSecret "Github.Token" -}}"

[Sources.darwin-amd64.Checksum]
Value = '874bc6f95e07697380069a394a21e05576a18d60f4ba178646e1ebed8f8b1f89'

[Sources.linux-amd64.Checksum]
Value = '231654bbf2dab3d86c1619ce799e77b03d96f9b50770297c8f4dff8836fc8ca2'

...

[Sources.{OS}-{ARCH}.Checksum]
Valut = '...'

...
  • Sources.{OS}-{ARCH}

    1. COMPULSORY - This setting is used for uniquely grouping and structuring source data between multiple groups of data fields. It is also used for facilitating cross-platform supports like listing all the sources here instead of spinning multiple recipe files.

    2. The Monteur Platform ID for this sourcing data to be effective. Example: [Sources.all-all] and [Sources.linux-amd64].

    3. This field was added since Monteur version v0.0.1.

  • Sources.{OS}-{ARCH}.Format

    1. COMPULSORY - It is used to define the downloaded target archived file format. Monteur uses this field to unpack the archived file.

    2. See Setup Meta Processing for supported algorithms.

    3. This field was added since Monteur version v0.0.1.

  • Sources.{OS}-{ARCH}.URL

    1. COMPULSORY - The location to download the target.

    2. Variables formatting is available for this field.

    3. This field was added since Monteur version v0.0.1.

  • Sources.{OS}-{ARCH}.Archives

    1. COMPULSORY - denotes the naming of the downloaded archived file.

    2. Variables formatting is available for this field.

    3. This field was added since Monteur version v0.0.1.

  • Sources.{OS}-{ARCH}.Method

    1. COMPULSORY - defines the HTTPS method of communications.

    2. This field was added since Monteur version v0.0.1.

  • Sources.{OS}-{ARCH}.Checksum

    1. RECOMMENDED - to ensure the downloaded artifact is with integrity.

    2. This field was added since Monteur version v0.0.1.

  • Sources.{OS}-{ARCH}.Checksum.Type

    1. COMPULSORY - if Sources.{OS}-{ARCH}.Checksum is enabled to select the algorithm type.

    2. See Setup Meta Processing for supported algorithms.

    3. This field was added since Monteur version v0.0.1.

  • Sources.{OS}-{ARCH}.Checksum.Format

    1. COMPULSORY - if Sources.{OS}-{ARCH}.Checksum is enabled for selecting parsing format.

    2. See Setup Meta Processing for supported formats.

    3. This field was added since Monteur version v0.0.1.

  • Sources.{OS}-{ARCH}.Checksum.Value

    1. COMPULSORY - if Sources.{OS}-{ARCH}.Checksum is enabled to define checksum value.

    2. This field was added since Monteur version v0.0.1.

  • Sources.{OS}-{ARCH}.Headers

    1. OPTIONAL - made available in case there is a need for HTTPS headers customization like setting authentication token.

    2. See Setup Meta Processing for its working mechanism.

    3. This field was added since Monteur version v0.0.1.

User Startup Configurations

This sourcing method complies to the original Setup Meta Processing so nothing special is needed.

Here is an example for quick referencing only:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[Config]
linux = """
#!/bin/bash

_name="hugo"

case $1 in
--stop)
	;;
*)
	if [ ! -z "$(type -p "$_name")" ]; then
		1>&2 printf "[ DONE  ] '$_name' is available.\\n"
        else
		1>&2 printf "[ ERROR ] '$_name' is missing.\\n"
	fi
	;;
esac
"""
windows = """
...COMING SOON...
"""
darwin = """
...COMING SOON...
"""
...

Epilogue

That's all for HTTPS downloading sourcing type. If you have any question, please feel free to raise your question at our Issues Section.