1
0
mirror of https://github.com/coreos/ignition.git synced 2026-02-06 18:47:54 +01:00
Commit Graph

51 Commits

Author SHA1 Message Date
yasminvalim
de452c404c fix: Handle unchecked error returns across the codebase and other linter issues
The linter found staticcheck and errorcheck issues.  Deferred statements now  use join  to combine any new error with an existing one, preventing error information from being lost. Other minor error checks, like for printing text  and flushing data have also been addressed.
2025-07-28 19:12:25 -03:00
Madhu Pillai
c6c52924cf *: update to v3_6_experimental spec 2024-10-14 15:33:52 +02:00
Benjamin Gilbert
0e2b63c9d5 *: update to v3_5_experimental spec 2023-02-20 03:09:50 -05:00
Benjamin Gilbert
7814b85b5a Replace io/ioutil
It was deprecated in Go 1.16 and its functions moved elsewhere.
2022-08-09 19:04:31 -04:00
Jonathan Lebon
444d3819df Add ignition-apply entrypoint
This new entrypoint takes an Ignition config and applies it to the
current rootfs (or one provided by `-root`). This tool could then be
used as part of build processes where we want to bake an Ignition
config, such as in CoreOS layering:

https://github.com/coreos/enhancements/blob/main/os/coreos-layering.md

This in turn should also help drain from the MCO the re-implementation
of large parts of the Ignition spec.

Another approach would be to build on top of `ignition -stage=files`,
but in the end I think we want a cleaner dedicated UX for this workflow
long-term (and in fact we should clean up the hacky places where we call
Ignition like this).

It shouldn't be used by end-users to live apply changes to their
Ignition config. A check that we are in a container is added as a
safeguard against this.

By default, unsupported modifications (like partitioning) trigger
errors, though one may pass `-ignore-unsupported` to override this. Also
by default, remote resources are automatically fetched, though one may
pass `-offline` to override this.
2022-02-25 12:17:46 -05:00
Sohan Kunkerkar
d540612a11 internal/providers: refactor handling of unmounting the mount path 2021-11-23 16:15:44 -05:00
Benjamin Gilbert
2a2ebf8c8d tools/docs: notice invalid configs with stable specs
In Ignition 2.x, the Parse() function from an individual config package
doesn't chain to earlier specs, but this code still assumed it does.
As a result, all configs with stable spec versions would fail on
ErrUnknownVersion, but we wouldn't notice because we were only looking
at the report and not the error return.

Switch to the high-level chaining parse function.  Also, check for parse
errors that aren't included in the report.
2021-06-25 14:37:16 -04:00
Benjamin Gilbert
594f5d76e2 tools/docs: fix config printing on non-empty report
Remember the newlines.
2021-06-25 14:37:16 -04:00
Jonathan Lebon
8f520621ee tree: update for stable v3.3.0 and new v3.4.0-experimental 2021-06-24 10:24:02 -04:00
Benjamin Gilbert
ba296323ec *: add some missing newlines in Fprintf() calls 2021-01-14 11:47:00 -05:00
Sohan Kunkerkar
4fa454ce3a *: fix staticcheck warnings
Fixes part of https://github.com/coreos/ignition/issues/1121
2020-12-07 17:09:15 -05:00
Stephen Lowrie
5b75aac6f1 internal: update for new experimental spec 2020-09-28 23:32:07 -05:00
Timothée Ravier
63c21c7a0e test: Use alternative marker for testing ignition config examples
To improve compatibility with Jekyll Markdown support, use an different
marker to signal valid Ignition configs that should be tested in the
documentation.
2020-09-15 13:14:34 +02:00
Timothée Ravier
9a3a0b8f30 docs: Rename doc to docs for GitHub Pages support
Also update path in docs test tool.
2020-09-10 17:36:45 +02:00
Stephen Lowrie
7ffca89581 internal/util/url: don't require networking for empty schemes
Right now Ignition will incorrectly report that it needs networking when
an empty scheme is given. Modify the `UrlNeedsNet` function to allow
both `data` & empty schemes.

A common case that could hit this is a config that writes a file with
empty contents.
2020-06-19 11:40:17 -05:00
Jonathan Lebon
f8be5c1951 fetch-offline: new stage for conditional networking
Add a new `fetch-offline` stage which can optionally be run before the
`fetch` stage. The major difference between the two is that the former
tries to operate in offline mode: if it encounters any resource which
requires network access, it quietly exits, creating a stamp file on the
way out.

This allows OS integrators to make use of this to only bring up
networking if Ignition actually requires it. It does not solve the
harder problem of "partially" up networking, where some fetches might
succeed and some others might fail. However, it provides an incremental
step to get there by reusing the same signalling mechanism.
2020-06-09 17:22:50 -04:00
Benjamin Gilbert
2efaeece19 *: update for new experimental spec
Following instructions in development.md.
2020-05-03 01:42:20 -04:00
Sohan Kunkerkar
61dbbd06f9 Add SHA-256 support for file verification 2020-04-29 11:21:07 -04:00
Andrew Jeddeloh
223d2481b8 internal/util/docs: update to use new validation 2019-05-24 11:28:28 -07:00
Stephen Lowrie
bb6182a393 *: bump import path
Bumps the import path to be `github.com/coreos/ignition/v2`, this is
required to be able to import the v2 of Ignition alongside v0 in other
repositories.
2019-04-09 12:40:08 -05:00
Andrew Jeddeloh
e6ca8952d1 *: switch to using 3.1.0-experimental everywhere 2019-04-04 15:13:20 -07:00
Andrew Jeddeloh
ca84f7ee8e *: stablize spec 3.0.0
Make 3.0.0-experimental into 3.0.0.
2019-03-25 14:38:23 -07:00
Andrew Jeddeloh
380b4dc404 *: use config/ver instead of internal/config
Lets use config/version instead of copying that to internal/config and
translating to it. This allow us to define extra functions on the types
for use by the internal code. This enable us to define functions
describing the "primary key" of all list entries in the config.
2019-03-15 14:24:16 -07:00
Euan Kemp
2699886b1b config/errors: move under 'shared'
Since more than just errors are shared between multiple config versions,
let's collect all the things under 'shared'
2018-03-20 00:02:56 -07:00
Derek Gonyeo
d5de59e75f internal: use to pointer functions in config/util 2018-03-08 16:03:11 -08:00
Derek Gonyeo
3c9dab9274 internal: docs checker fix for new package location
Change the docs checker's config path changed to internal/config, use
config/errors for ErrDeprecated.
2018-03-08 16:03:11 -08:00
Derek Gonyeo
474fedbf56 internal: move hash parts logic into internal/util
Without logic specific to the schema structs in internal/config (keeping
it out of there simplifies stable spec bumps), this logic must be
duplicated into internal.
2018-03-08 16:03:11 -08:00
Derek Gonyeo
d5e1034785 internal: delete prerelease_check.go
prerelease_check.go was used in tag_release.sh, but we no longer set the
Metadata field of the version and thus this check no longer does
anything.
2018-03-08 16:03:11 -08:00
Derek Gonyeo
1d02b8c553 internal: use internal/config and config/errors instead of config
All config references in internal should use internal/config now, and
any errors from config should now come from config/errors.
2018-03-08 16:03:11 -08:00
Derek Gonyeo
644a87dd02 Merge pull request #486 from crawford/tls
*: support additional certificate authorities
2018-01-25 14:42:34 -08:00
Derek Gonyeo
d227dd526b internal: move hashing code from internal/exec/util to internal/util
A following commit will have code in internal/resource use things from
the moved file, and having internal/resource import internal/exec would
result in a dependency loop.
2018-01-23 13:51:04 -08:00
Andrew Jeddeloh
212ce07bc3 tools/docs: change docs tool to work with ignition
Change clct's docs validator to work with Ignition. Disable validation
of snippets and ignore v1 deprecation warnings.
2018-01-23 13:19:40 -08:00
Andrew Jeddeloh
c2c6e25106 tools: add clct's docs validator
Copy verbatim so changes to it in future commits are easy to read
2018-01-23 13:19:40 -08:00
Stephen Lowrie
4cc23ba628 exec: propogate root parameter to baseconfig
If a value is passed to root other than the default of '/' then
the baseConfig will point to the given value rather than
'/sysroot'.

Also updates the RenderFile function from
'internal/exec/util/file.go' to be a member function of Util to
allow the given root parameter to be used rather than always using
'/sysroot'.
2017-06-27 21:32:50 -07:00
Alex Crawford
533141e46c util: add function for creating pointers to bools 2017-06-27 20:36:46 -07:00
Derek Gonyeo
af744681eb internal/exec/stages/files: fix nil pointer dereference
Recent changes allowing node owners to be referenced by user/group names
changed the id field for the user and group to be a pointer, so that it
could be detected when it was left empty vs when it was specified to be
0. The simple example given to justify this was when a user provided a
config saying that the node should be owned by user "core" and uid "0",
if the id was not a pointer it would appear to Ignition as if they had
not provided a uid.

The logic dealing with setting the UID failed to properly handle nil
values here, and can cause nil pointer dereferences. This commit adds a
check and an assignment to fix this for both of these fields.

If a node's owner is unspecified, it will default to the root user and
group.
2017-06-07 17:19:42 -07:00
Alex Crawford
6b9270de7d util/tools: remove semver pre-release check
Ignition now ships with support for an experimental config. Because this
config is experimental, it is denoted with a semantic version
pre-release tag.
2017-02-27 14:50:09 -08:00
Alex Crawford
58baf33913 util: move resource verification into exec/util
This kills off the last of the top-level util package. Should result in
fewer import collisions.
2016-08-26 13:45:26 -07:00
Alex Crawford
eeeda9f48d util: move fetching functionality into resource
Pull all of the fetching functionality out of util and into its own
package.
2016-08-26 13:43:47 -07:00
Alex Crawford
ae547a26c6 util: centralize fetching and export less
This now ensures that all fetching goes through the same entry point,
regardless of URL scheme. This bit us before because providers were
calling into the HttpClient directly, bypassing the scheme-check.
2016-08-26 13:40:43 -07:00
Alex Crawford
6b8539f219 util/http: do not retry non-5xx HTTP results
The original intention of this code was to retry requests if the remote
server didn't return content. This caused issues for the HTTP-based
providers because they will return a 404 when there is no userdata.
Since the underlying purpose of this retry is to handle transient
errors, it makes sense to only retry if there is a network error or if
the remote system returned a 5xx error.
2016-08-15 12:21:20 -07:00
Alex Crawford
c88a2c9084 *: use a single http client
This will allow us to reconfigure the client, adjusting timeouts and
other settings as we fetch and evaluate the config.
2016-08-03 11:24:57 -07:00
Alex Crawford
c730b50e94 util/http: introduce retry logic
All HTTP requests should retry automatically.
2016-08-03 10:52:21 -07:00
Andrew Jeddeloh
41f6c9a330 files: add ability to write empty files 2016-07-06 12:30:17 -07:00
Andrew Jeddeloh
b8c1a75e07 http: timeout based on time until repsonse headers
Switch the http timeout to be for repsonse headers and not the entire
transaction.
2016-07-06 12:30:17 -07:00
Andrew Jeddeloh
4ba2aa7a5d files: use readers instead of reading into memory
Use Readers instead of reading the entire contents of the files into
memory. This allows handling files larger than the amount of memory
available
2016-07-06 12:30:17 -07:00
Alex Crawford
7bda3d75a8 util/url: allow https urls 2016-06-14 14:28:28 -07:00
Alex Crawford
e7e6506862 *: refactor resource fetching into one location
This will allow the cmdline provider to accept data URLs, files to
reference contents on the OEM partition, and configs to reference remote
configs on the OEM partition.
2016-05-12 17:50:33 -07:00
Alex Crawford
c00d4d674e util: add FetchConfigWithHeader 2016-04-07 11:06:24 -07:00
Alex Crawford
8ff11d7f8c util: include request headers when fetching config 2016-04-01 14:46:41 -07:00