agora inbox for [email protected]help / color / mirror / Atom feed
[PATCH v16 10/10] pg_ls_* to show file type and show special files 11+ messages / 1 participants [nested] [flat]
* [PATCH v16 10/10] pg_ls_* to show file type and show special files @ 2020-03-31 19:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 11+ messages in thread From: Justin Pryzby @ 2020-03-31 19:40 UTC (permalink / raw) --- src/backend/utils/adt/genfile.c | 58 ++++++++++++++++---- src/include/catalog/pg_proc.dat | 38 ++++++------- src/test/regress/expected/misc_functions.out | 40 +++++++------- src/test/regress/output/tablespace.source | 8 +-- src/test/regress/sql/misc_functions.sql | 6 +- 5 files changed, 94 insertions(+), 56 deletions(-) diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c index 10780d3fb1..57b52625a0 100644 --- a/src/backend/utils/adt/genfile.c +++ b/src/backend/utils/adt/genfile.c @@ -36,11 +36,12 @@ #include "utils/syscache.h" #include "utils/timestamp.h" +static char get_file_type(mode_t mode, const char *path); static void tuple_from_stat(struct stat *fst, const char *path, Datum *values, bool *isnull); static Datum pg_ls_dir_files(FunctionCallInfo fcinfo, const char *dir, int flags); -#define LS_DIR_ISDIR (1<<0) /* Show column: isdir */ +#define LS_DIR_TYPE (1<<0) /* Show column: type */ #define LS_DIR_METADATA (1<<1) /* Show columns: mtime, size */ #define LS_DIR_MISSING_OK (1<<2) /* Ignore ENOENT if the toplevel dir is missing */ #define LS_DIR_SKIP_DOT_DIRS (1<<3) /* Do not show . or .. */ @@ -55,7 +56,7 @@ static Datum pg_ls_dir_files(FunctionCallInfo fcinfo, const char *dir, int flags #define LS_DIR_HISTORIC (LS_DIR_SKIP_DIRS|LS_DIR_SKIP_HIDDEN|LS_DIR_SKIP_SPECIAL|LS_DIR_METADATA) /* Shortcut for common behavior */ -#define LS_DIR_COMMON (LS_DIR_SKIP_HIDDEN|LS_DIR_SKIP_SPECIAL|LS_DIR_METADATA) +#define LS_DIR_COMMON (LS_DIR_SKIP_HIDDEN|LS_DIR_METADATA) /* * Convert a "text" filename argument to C string, and check it's allowable. @@ -369,6 +370,43 @@ pg_read_binary_file_all(PG_FUNCTION_ARGS) return pg_read_binary_file(fcinfo); } +/* Return a character indicating the type of file, or '?' if unknown type */ +static char +get_file_type(mode_t mode, const char *path) +{ + if (S_ISREG(mode)) + return '-'; + + if (S_ISDIR(mode)) + return 'd'; +#ifndef WIN32 + if (S_ISLNK(mode)) + return 'l'; +#else + if (pgwin32_is_junction(path)) + return 'l'; +#endif + +#ifdef S_ISCHR + if (S_ISCHR(mode)) + return 'c'; +#endif +#ifdef S_ISBLK + if (S_ISBLK(mode)) + return 'b'; +#endif +#ifdef S_ISFIFO + if (S_ISFIFO(mode)) + return 'p'; +#endif +#ifdef S_ISSOCK + if (S_ISSOCK(mode)) + return 's'; +#endif + + return '?'; +} + /* * Populate values and isnull from fst and path. * Used for pg_stat_file() and pg_stat_dir_files() @@ -388,7 +426,7 @@ tuple_from_stat(struct stat *fst, const char *path, Datum *values, bool *isnull) isnull[3] = true; values[4] = TimestampTzGetDatum(time_t_to_timestamptz(fst->st_ctime)); #endif - values[5] = BoolGetDatum(S_ISDIR(fst->st_mode)); + values[5] = CharGetDatum(get_file_type(fst->st_mode, path)); } /* @@ -438,7 +476,7 @@ pg_stat_file(PG_FUNCTION_ARGS) TupleDescInitEntry(tupdesc, (AttrNumber) 5, "creation", TIMESTAMPTZOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 6, - "isdir", BOOLOID, -1, 0); + "type", CHAROID, -1, 0); BlessTupleDesc(tupdesc); memset(isnull, false, sizeof(isnull)); @@ -507,10 +545,10 @@ pg_ls_dir_files(FunctionCallInfo fcinfo, const char *dir, int flags) MemoryContext oldcontext; TypeFuncClass tuptype ; - /* isdir depends on metadata */ - Assert(!(flags&LS_DIR_ISDIR) || (flags&LS_DIR_METADATA)); - /* Unreasonable to show isdir and skip dirs */ - Assert(!(flags&LS_DIR_ISDIR) || !(flags&LS_DIR_SKIP_DIRS)); + /* type depends on metadata */ + Assert(!(flags&LS_DIR_TYPE) || (flags&LS_DIR_METADATA)); + /* Unreasonable to show type and skip dirs XXX */ + Assert(!(flags&LS_DIR_TYPE) || !(flags&LS_DIR_SKIP_DIRS)); /* check the optional arguments */ if (PG_NARGS() == 3) @@ -708,7 +746,7 @@ pg_ls_dir_metadata(PG_FUNCTION_ARGS) char *dirname = convert_and_check_filename(PG_GETARG_TEXT_PP(0)); return pg_ls_dir_files(fcinfo, dirname, - LS_DIR_METADATA | LS_DIR_SKIP_SPECIAL | LS_DIR_ISDIR); + LS_DIR_METADATA | LS_DIR_SKIP_SPECIAL | LS_DIR_TYPE); } /* @@ -723,5 +761,5 @@ pg_ls_dir_metadata_1arg(PG_FUNCTION_ARGS) char *dirname = convert_and_check_filename(PG_GETARG_TEXT_PP(0)); return pg_ls_dir_files(fcinfo, dirname, - LS_DIR_METADATA | LS_DIR_SKIP_SPECIAL | LS_DIR_ISDIR); + LS_DIR_METADATA | LS_DIR_SKIP_SPECIAL | LS_DIR_TYPE); } diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index 34ee5a8f97..6e1682dafb 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -6158,16 +6158,16 @@ { oid => '2623', descr => 'get information about file', proname => 'pg_stat_file', provolatile => 'v', prorettype => 'record', proargtypes => 'text', - proallargtypes => '{text,int8,timestamptz,timestamptz,timestamptz,timestamptz,bool}', + proallargtypes => '{text,int8,timestamptz,timestamptz,timestamptz,timestamptz,char}', proargmodes => '{i,o,o,o,o,o,o}', - proargnames => '{filename,size,access,modification,change,creation,isdir}', + proargnames => '{filename,size,access,modification,change,creation,type}', prosrc => 'pg_stat_file_1arg' }, { oid => '3307', descr => 'get information about file', proname => 'pg_stat_file', provolatile => 'v', prorettype => 'record', proargtypes => 'text bool', - proallargtypes => '{text,bool,int8,timestamptz,timestamptz,timestamptz,timestamptz,bool}', + proallargtypes => '{text,bool,int8,timestamptz,timestamptz,timestamptz,timestamptz,char}', proargmodes => '{i,i,o,o,o,o,o,o}', - proargnames => '{filename,missing_ok,size,access,modification,change,creation,isdir}', + proargnames => '{filename,missing_ok,size,access,modification,change,creation,type}', prosrc => 'pg_stat_file' }, { oid => '2624', descr => 'read text from a file', proname => 'pg_read_file', provolatile => 'v', prorettype => 'text', @@ -10880,13 +10880,13 @@ { oid => '3353', descr => 'list files in the log directory', proname => 'pg_ls_logdir', procost => '10', prorows => '20', proretset => 't', provolatile => 'v', prorettype => 'record', proargtypes => '', - proallargtypes => '{text,int8,timestamptz,timestamptz,timestamptz,timestamptz,bool}', proargmodes => '{o,o,o,o,o,o,o}', - proargnames => '{name,size,access,modification,change,creation,isdir}', prosrc => 'pg_ls_logdir' }, + proallargtypes => '{text,int8,timestamptz,timestamptz,timestamptz,timestamptz,char}', proargmodes => '{o,o,o,o,o,o,o}', + proargnames => '{name,size,access,modification,change,creation,type}', prosrc => 'pg_ls_logdir' }, { oid => '3354', descr => 'list of files in the WAL directory', proname => 'pg_ls_waldir', procost => '10', prorows => '20', proretset => 't', provolatile => 'v', prorettype => 'record', proargtypes => '', - proallargtypes => '{text,int8,timestamptz,timestamptz,timestamptz,timestamptz,bool}', proargmodes => '{o,o,o,o,o,o,o}', - proargnames => '{name,size,access,modification,change,creation,isdir}', prosrc => 'pg_ls_waldir' }, + proallargtypes => '{text,int8,timestamptz,timestamptz,timestamptz,timestamptz,char}', proargmodes => '{o,o,o,o,o,o,o}', + proargnames => '{name,size,access,modification,change,creation,type}', prosrc => 'pg_ls_waldir' }, { oid => '5031', descr => 'list of files in the archive_status directory', proname => 'pg_ls_archive_statusdir', procost => '10', prorows => '20', proretset => 't', provolatile => 'v', prorettype => 'record', @@ -10896,32 +10896,32 @@ { oid => '5029', descr => 'list files in the pgsql_tmp directory', proname => 'pg_ls_tmpdir', procost => '10', prorows => '20', proretset => 't', provolatile => 'v', prorettype => 'record', proargtypes => '', - proallargtypes => '{text,int8,timestamptz,timestamptz,timestamptz,timestamptz,bool}', proargmodes => '{o,o,o,o,o,o,o}', - proargnames => '{name,size,access,modification,change,creation,isdir}', prosrc => 'pg_ls_tmpdir_noargs' }, + proallargtypes => '{text,int8,timestamptz,timestamptz,timestamptz,timestamptz,char}', proargmodes => '{o,o,o,o,o,o,o}', + proargnames => '{name,size,access,modification,change,creation,type}', prosrc => 'pg_ls_tmpdir_noargs' }, { oid => '5030', descr => 'list files in the pgsql_tmp directory', proname => 'pg_ls_tmpdir', procost => '10', prorows => '20', proretset => 't', provolatile => 'v', prorettype => 'record', proargtypes => 'oid', - proallargtypes => '{oid,text,int8,timestamptz,timestamptz,timestamptz,timestamptz,bool}', proargmodes => '{i,o,o,o,o,o,o,o}', - proargnames => '{tablespace,name,size,access,modification,change,creation,isdir}', + proallargtypes => '{oid,text,int8,timestamptz,timestamptz,timestamptz,timestamptz,char}', proargmodes => '{i,o,o,o,o,o,o,o}', + proargnames => '{tablespace,name,size,access,modification,change,creation,type}', prosrc => 'pg_ls_tmpdir_1arg' }, { oid => '5032', descr => 'list directory with metadata', proname => 'pg_ls_dir_metadata', procost => '10', prorows => '20', proretset => 't', provolatile => 'v', prorettype => 'record', proargtypes => 'text bool bool', - proallargtypes => '{text,bool,bool,text,int8,timestamptz,timestamptz,timestamptz,timestamptz,bool}', proargmodes => '{i,i,i,o,o,o,o,o,o,o}', - proargnames => '{dirname,missing_ok,include_dot_dirs,name,size,access,modification,change,creation,isdir}', + proallargtypes => '{text,bool,bool,text,int8,timestamptz,timestamptz,timestamptz,timestamptz,char}', proargmodes => '{i,i,i,o,o,o,o,o,o,o}', + proargnames => '{dirname,missing_ok,include_dot_dirs,name,size,access,modification,change,creation,type}', prosrc => 'pg_ls_dir_metadata' }, { oid => '5033', descr => 'list directory with metadata', proname => 'pg_ls_dir_metadata', procost => '10', prorows => '20', proretset => 't', provolatile => 'v', prorettype => 'record', proargtypes => 'text', - proallargtypes => '{text,text,int8,timestamptz,timestamptz,timestamptz,timestamptz,bool}', proargmodes => '{i,o,o,o,o,o,o,o}', - proargnames => '{dirname,name,size,access,modification,change,creation,isdir}', + proallargtypes => '{text,text,int8,timestamptz,timestamptz,timestamptz,timestamptz,char}', proargmodes => '{i,o,o,o,o,o,o,o}', + proargnames => '{dirname,name,size,access,modification,change,creation,type}', prosrc => 'pg_ls_dir_metadata_1arg' }, { oid => '5034', descr => 'list all files in a directory recursively', proname => 'pg_ls_dir_recurse', prorows => '10000', proretset => 't', provolatile => 'v', prorettype => 'record', proargtypes => 'text', - proallargtypes => '{text,text,int8,timestamptz,timestamptz,timestamptz,timestamptz,bool}', - proargnames => '{dirname,name,size,access,modification,change,creation,isdir}', proargmodes => '{i,o,o,o,o,o,o,o}', - prolang => 'sql', prosrc => "with recursive ls as (select * from pg_ls_dir_metadata(dirname, true, false) union all select ls.name||'/'||a.name, a.size, a.access, a.modification, a.change, a.creation, a.isdir from ls, lateral pg_ls_dir_metadata(dirname||'/'||ls.name, false, false)a where ls.isdir) select * from ls" }, + proallargtypes => '{text,text,int8,timestamptz,timestamptz,timestamptz,timestamptz,char}', + proargnames => '{dirname,name,size,access,modification,change,creation,type}', proargmodes => '{i,o,o,o,o,o,o,o}', + prolang => 'sql', prosrc => "with recursive ls as (select * from pg_ls_dir_metadata(dirname, true, false) union all select ls.name||'/'||a.name, a.size, a.access, a.modification, a.change, a.creation, a.type from ls, lateral pg_ls_dir_metadata(dirname||'/'||ls.name, false, false)a where ls.type='d') select * from ls" }, # hash partitioning constraint function { oid => '5028', descr => 'hash partition CHECK constraint', diff --git a/src/test/regress/expected/misc_functions.out b/src/test/regress/expected/misc_functions.out index cce84a60a9..1bdcca16fc 100644 --- a/src/test/regress/expected/misc_functions.out +++ b/src/test/regress/expected/misc_functions.out @@ -157,8 +157,8 @@ select count(*) > 0 as ok from (select pg_ls_waldir()) ss; -- Test not-run-to-completion cases. select * from pg_ls_waldir() limit 0; - name | size | access | modification | change | creation | isdir -------+------+--------+--------------+--------+----------+------- + name | size | access | modification | change | creation | type +------+------+--------+--------------+--------+----------+------ (0 rows) select count(*) > 0 as ok from (select * from pg_ls_waldir() limit 1) ss; @@ -222,39 +222,39 @@ ERROR: could not open directory "does not exist": No such file or directory -- This tests the missing_ok parameter, which causes pg_ls_tmpdir to succeed even if the tmpdir doesn't exist yet -- The name='' condition is never true, so the function runs to completion but returns zero rows. select * from pg_ls_tmpdir() where name='Does not exist'; - name | size | access | modification | change | creation | isdir -------+------+--------+--------------+--------+----------+------- + name | size | access | modification | change | creation | type +------+------+--------+--------------+--------+----------+------ (0 rows) -select name, isdir from pg_ls_dir_metadata('.') where name='.'; - name | isdir -------+------- - . | t +select name, type from pg_ls_dir_metadata('.') where name='.'; + name | type +------+------ + . | d (1 row) -select name, isdir from pg_ls_dir_metadata('.', false, false) where name='.'; -- include_dot_dirs=false - name | isdir -------+------- +select name, type from pg_ls_dir_metadata('.', false, false) where name='.'; -- include_dot_dirs=false + name | type +------+------ (0 rows) -- Check that expected columns are present select * from pg_ls_dir_metadata('.') limit 0; - name | size | access | modification | change | creation | isdir -------+------+--------+--------------+--------+----------+------- + name | size | access | modification | change | creation | type +------+------+--------+--------------+--------+----------+------ (0 rows) -- Check that we at least succeed in recursing once, and that we don't show the leading dir prefix -SELECT name, isdir FROM pg_ls_dir_recurse('.') WHERE isdir AND name~'^pg_wal'; - name | isdir ------------------------+------- - pg_wal | t - pg_wal/archive_status | t +SELECT name, type FROM pg_ls_dir_recurse('.') WHERE type='d' AND name~'^pg_wal'; + name | type +-----------------------+------ + pg_wal | d + pg_wal/archive_status | d (2 rows) -- Check that expected columns are present SELECT * FROM pg_ls_dir_recurse('.') LIMIT 0; - name | size | access | modification | change | creation | isdir -------+------+--------+--------------+--------+----------+------- + name | size | access | modification | change | creation | type +------+------+--------+--------------+--------+----------+------ (0 rows) -- diff --git a/src/test/regress/output/tablespace.source b/src/test/regress/output/tablespace.source index 1e1e02b589..025c9709a1 100644 --- a/src/test/regress/output/tablespace.source +++ b/src/test/regress/output/tablespace.source @@ -17,15 +17,15 @@ CREATE TABLESPACE regress_tblspace LOCATION '@testtablespace@'; -- The name='' condition is never true, so the function runs to completion but returns zero rows. -- The query is written to ERROR if the tablespace doesn't exist, rather than silently failing to call pg_ls_tmpdir() SELECT c.* FROM (SELECT oid FROM pg_tablespace b WHERE b.spcname='regress_tblspace' UNION SELECT 0 ORDER BY 1 DESC LIMIT 1) AS b , pg_ls_tmpdir(oid) AS c WHERE c.name='Does not exist'; - name | size | access | modification | change | creation | isdir -------+------+--------+--------------+--------+----------+------- + name | size | access | modification | change | creation | type +------+------+--------+--------------+--------+----------+------ (0 rows) -- This tests the missing_ok parameter. If that's not functioning, this would ERROR if the logdir doesn't exist yet. -- The name='' condition is never true, so the function runs to completion but returns zero rows. SELECT * FROM pg_ls_logdir() WHERE name='Does not exist'; - name | size | access | modification | change | creation | isdir -------+------+--------+--------------+--------+----------+------- + name | size | access | modification | change | creation | type +------+------+--------+--------------+--------+----------+------ (0 rows) -- try setting and resetting some properties for the new tablespace diff --git a/src/test/regress/sql/misc_functions.sql b/src/test/regress/sql/misc_functions.sql index 6041c4f3dc..3874625ca1 100644 --- a/src/test/regress/sql/misc_functions.sql +++ b/src/test/regress/sql/misc_functions.sql @@ -69,15 +69,15 @@ select pg_ls_dir('does not exist'); -- fails with missingok=false -- The name='' condition is never true, so the function runs to completion but returns zero rows. select * from pg_ls_tmpdir() where name='Does not exist'; -select name, isdir from pg_ls_dir_metadata('.') where name='.'; +select name, type from pg_ls_dir_metadata('.') where name='.'; -select name, isdir from pg_ls_dir_metadata('.', false, false) where name='.'; -- include_dot_dirs=false +select name, type from pg_ls_dir_metadata('.', false, false) where name='.'; -- include_dot_dirs=false -- Check that expected columns are present select * from pg_ls_dir_metadata('.') limit 0; -- Check that we at least succeed in recursing once, and that we don't show the leading dir prefix -SELECT name, isdir FROM pg_ls_dir_recurse('.') WHERE isdir AND name~'^pg_wal'; +SELECT name, type FROM pg_ls_dir_recurse('.') WHERE type='d' AND name~'^pg_wal'; -- Check that expected columns are present SELECT * FROM pg_ls_dir_recurse('.') LIMIT 0; -- 2.17.0 --2FkSFaIQeDFoAt0B-- ^ permalink raw reply [nested|flat] 11+ messages in thread
* [PATCH 8/8] +html index file @ 2022-03-01 05:18 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 11+ messages in thread From: Justin Pryzby @ 2022-03-01 05:18 UTC (permalink / raw) This allows linking to the artifacts from the last successful build. //freebsd ci-os-only: warnings --- src/tools/ci/copy-changed-docs | 42 ++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/tools/ci/copy-changed-docs b/src/tools/ci/copy-changed-docs index 1c921a8df6f..57dd2823a50 100755 --- a/src/tools/ci/copy-changed-docs +++ b/src/tools/ci/copy-changed-docs @@ -1,29 +1,67 @@ #! /bin/sh # Copy HTML which differ between $old and $new into $outdir set -e old=$1 new=$2 outdir=$3 +branch=$CIRRUS_BRANCH + +# The index is large and changes often +skippages="bookindex.html" # The index is large and changes often skippages="bookindex.html" mkdir "$outdir" cp "$new"/src/sgml/html/*.css "$new"/src/sgml/html/*.svg "$outdir" +# The index is useful to allow a static link (not specific to a cirrus run) to the artifacts for the most-recent, successful CI run for a branch +branchurl=https://api.cirrus-ci.com/v1/artifact/github/$CIRRUS_REPO_FULL_NAME/$CIRRUS_TASK_NAME/html_docs/html... + +index="$outdir/00-index.html" +cat >"$index" <<EOF +<html> +<head><title>Index of docs changed since: $BASE_COMMIT</title></head> +<body> +<!-- A link to documentation for the most recent successful build: $branchurl --> +<h1>Index of docs changed since: $BASE_COMMIT</h1> +<ul> +EOF + changed=`git diff --no-index --name-only "$old"/src/sgml/html "$new"/src/sgml/html` || [ $? -eq 1 ] for f in $changed do # Avoid removed files [ -f "$f" ] || continue echo "$f" |grep -Ew "$skippages" >/dev/null && continue - cp -v "$f" "$outdir" -done + cp -v "$f" "$outdir" >&2 + fn=${f##*/} + # ?branch=... is needed when accessing the artifacts for the static link for the branch + # It's not needed and ignored if accessing artifacts for *this* CI run + echo "<li><a href='$fn?branch=$branch'>$fn</a>" +done >>"$index" + +github=https://github.com/$CIRRUS_REPO_FULL_NAME/commit +cirrus=https://cirrus-ci.com/build + +cat >>"$index" <<EOF +</ul> +<hr> +<code> +<br>This file was written on: `date --rfc-822 --utc` +<br>CIRRUS_CHANGE_TITLE: $CIRRUS_CHANGE_TITLE +<br>CIRRUS_CHANGE_IN_REPO: <a href="$github/$CIRRUS_CHANGE_IN_REPO">$CIRRUS_CHANGE_IN_REPO</a> +<br>CIRRUS_BUILD_ID: <a href="$cirrus/$CIRRUS_BUILD_ID">$CIRRUS_BUILD_ID</a> +<br>CIRRUS_LAST_GREEN_CHANGE: <a href="$github/$CIRRUS_LAST_GREEN_CHANGE">$CIRRUS_LAST_GREEN_CHANGE</a> +<br>CIRRUS_LAST_GREEN_BUILD_ID: <a href="$cirrus/$CIRRUS_LAST_GREEN_BUILD_ID">$CIRRUS_LAST_GREEN_BUILD_ID</a> +</code> +</body></html> +EOF exit 0 -- 2.34.1 --Wo0n/IWMQc9EwEbt-- ^ permalink raw reply [nested|flat] 11+ messages in thread
* [PATCH 10/10] +html index file @ 2022-03-01 05:18 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 11+ messages in thread From: Justin Pryzby @ 2022-03-01 05:18 UTC (permalink / raw) This allows linking to the artifacts from the last successful build, which itself allows *not* rebuilding when sources haven't changed. //freebsd //-os-only: html, --- .cirrus.yml | 2 +- src/tools/ci/copy-changed-docs | 42 ++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 338c6c2be16..5e1612b583e 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -773,7 +773,7 @@ task: task: name: Documentation only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(docs|html).*' - #skip: "!changesInclude('.cirrus.yml', 'doc/**', 'src/tools/ci/copy-changed-docs')" + skip: "!changesInclude('.cirrus.yml', 'doc/**', 'src/tools/ci/copy-changed-docs')" env: CPUS: 2 diff --git a/src/tools/ci/copy-changed-docs b/src/tools/ci/copy-changed-docs index 598e639f695..c60428e1ae1 100755 --- a/src/tools/ci/copy-changed-docs +++ b/src/tools/ci/copy-changed-docs @@ -5,6 +5,10 @@ set -e old=$1 new=$2 outdir=$3 +branch=$CIRRUS_BRANCH + +# The index is large and changes often +skippages="bookindex.html" # The index is large and changes often skippages="bookindex.html" @@ -13,6 +17,19 @@ mkdir "$outdir" cp doc/src/sgml/*.css "$outdir" cp doc/src/sgml/images/*.svg "$outdir" +# The index is useful to allow a static link (not specific to a cirrus run) to the artifacts for the most-recent, successful CI run for a branch +branchurl=https://api.cirrus-ci.com/v1/artifact/github/$CIRRUS_REPO_FULL_NAME/$CIRRUS_TASK_NAME/html_docs/html... + +index="$outdir/00-index.html" +cat >"$index" <<EOF +<html> +<head><title>Index of docs changed since: $BASE_COMMIT</title></head> +<body> +<!-- A link to documentation for the most recent successful build: $branchurl --> +<h1>Index of docs changed since: $BASE_COMMIT</h1> +<ul> +EOF + changed=`git diff --no-index --name-only "$old"/src/sgml/html "$new"/src/sgml/html` || [ $? -eq 1 ] @@ -24,7 +41,28 @@ do echo "$f" |grep -Ew "$skippages" >/dev/null && continue - cp -v "$f" "$outdir" -done + cp -v "$f" "$outdir" >&2 + fn=${f##*/} + # ?branch=... is needed when accessing the artifacts for the static link for the branch + # It's not needed and ignored if accessing artifacts for *this* CI run + echo "<li><a href='$fn?branch=$branch'>$fn</a>" +done >>"$index" + +github=https://github.com/$CIRRUS_REPO_FULL_NAME/commit +cirrus=https://cirrus-ci.com/build + +cat >>"$index" <<EOF +</ul> +<hr> +<code> +<br>This file was written on: `date --rfc-822 --utc` +<br>CIRRUS_CHANGE_TITLE: $CIRRUS_CHANGE_TITLE +<br>CIRRUS_CHANGE_IN_REPO: <a href="$github/$CIRRUS_CHANGE_IN_REPO">$CIRRUS_CHANGE_IN_REPO</a> +<br>CIRRUS_BUILD_ID: <a href="$cirrus/$CIRRUS_BUILD_ID">$CIRRUS_BUILD_ID</a> +<br>CIRRUS_LAST_GREEN_CHANGE: <a href="$github/$CIRRUS_LAST_GREEN_CHANGE">$CIRRUS_LAST_GREEN_CHANGE</a> +<br>CIRRUS_LAST_GREEN_BUILD_ID: <a href="$cirrus/$CIRRUS_LAST_GREEN_BUILD_ID">$CIRRUS_LAST_GREEN_BUILD_ID</a> +</code> +</body></html> +EOF exit 0 -- 2.25.1 --sMkrXc3gAYLRVOjR-- ^ permalink raw reply [nested|flat] 11+ messages in thread
* [PATCH 5/6] +html index file @ 2022-03-01 05:18 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 11+ messages in thread From: Justin Pryzby @ 2022-03-01 05:18 UTC (permalink / raw) This allows linking to the artifacts from the last successful build. //freebsd ci-os-only: warnings --- src/tools/ci/copy-changed-docs | 39 ++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/tools/ci/copy-changed-docs b/src/tools/ci/copy-changed-docs index 1c921a8df6f..0efad386cca 100755 --- a/src/tools/ci/copy-changed-docs +++ b/src/tools/ci/copy-changed-docs @@ -5,6 +5,7 @@ set -e old=$1 new=$2 outdir=$3 +branch=$CIRRUS_BRANCH # The index is large and changes often skippages="bookindex.html" @@ -12,6 +13,19 @@ skippages="bookindex.html" mkdir "$outdir" cp "$new"/src/sgml/html/*.css "$new"/src/sgml/html/*.svg "$outdir" +# The index is useful to allow a static link (not specific to a cirrus run) to the artifacts for the most-recent, successful CI run for a branch +branchurl=https://api.cirrus-ci.com/v1/artifact/github/$CIRRUS_REPO_FULL_NAME/$CIRRUS_TASK_NAME/html_docs/html... + +index="$outdir/00-index.html" +cat >"$index" <<EOF +<html> +<head><title>Index of docs changed since: $BASE_COMMIT</title></head> +<body> +<!-- A link to documentation for the most recent successful build: $branchurl --> +<h1>Index of docs changed since: $BASE_COMMIT</h1> +<ul> +EOF + changed=`git diff --no-index --name-only "$old"/src/sgml/html "$new"/src/sgml/html` || [ $? -eq 1 ] @@ -23,7 +37,28 @@ do echo "$f" |grep -Ew "$skippages" >/dev/null && continue - cp -v "$f" "$outdir" -done + cp -v "$f" "$outdir" >&2 + fn=${f##*/} + # ?branch=... is needed when accessing the artifacts for the static link for the branch + # It's not needed and ignored if accessing artifacts for *this* CI run + echo "<li><a href='$fn?branch=$branch'>$fn</a>" +done >>"$index" + +github=https://github.com/$CIRRUS_REPO_FULL_NAME/commit +cirrus=https://cirrus-ci.com/build + +cat >>"$index" <<EOF +</ul> +<hr> +<code> +<br>This file was written on: `date --rfc-822 --utc` +<br>CIRRUS_CHANGE_TITLE: $CIRRUS_CHANGE_TITLE +<br>CIRRUS_CHANGE_IN_REPO: <a href="$github/$CIRRUS_CHANGE_IN_REPO">$CIRRUS_CHANGE_IN_REPO</a> +<br>CIRRUS_BUILD_ID: <a href="$cirrus/$CIRRUS_BUILD_ID">$CIRRUS_BUILD_ID</a> +<br>CIRRUS_LAST_GREEN_CHANGE: <a href="$github/$CIRRUS_LAST_GREEN_CHANGE">$CIRRUS_LAST_GREEN_CHANGE</a> +<br>CIRRUS_LAST_GREEN_BUILD_ID: <a href="$cirrus/$CIRRUS_LAST_GREEN_BUILD_ID">$CIRRUS_LAST_GREEN_BUILD_ID</a> +</code> +</body></html> +EOF exit 0 -- 2.42.0 --ndI8Dx/wEX5btThR Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0006-WIP-show-changed-docs-with-meson.patch" ^ permalink raw reply [nested|flat] 11+ messages in thread
* [PATCH 5/6] +html index file @ 2022-03-01 05:18 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 11+ messages in thread From: Justin Pryzby @ 2022-03-01 05:18 UTC (permalink / raw) This allows linking to the artifacts from the last successful build. //freebsd ci-os-only: warnings --- src/tools/ci/copy-changed-docs | 39 ++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/tools/ci/copy-changed-docs b/src/tools/ci/copy-changed-docs index 1c921a8df6f..0efad386cca 100755 --- a/src/tools/ci/copy-changed-docs +++ b/src/tools/ci/copy-changed-docs @@ -5,6 +5,7 @@ set -e old=$1 new=$2 outdir=$3 +branch=$CIRRUS_BRANCH # The index is large and changes often skippages="bookindex.html" @@ -12,6 +13,19 @@ skippages="bookindex.html" mkdir "$outdir" cp "$new"/src/sgml/html/*.css "$new"/src/sgml/html/*.svg "$outdir" +# The index is useful to allow a static link (not specific to a cirrus run) to the artifacts for the most-recent, successful CI run for a branch +branchurl=https://api.cirrus-ci.com/v1/artifact/github/$CIRRUS_REPO_FULL_NAME/$CIRRUS_TASK_NAME/html_docs/html... + +index="$outdir/00-index.html" +cat >"$index" <<EOF +<html> +<head><title>Index of docs changed since: $BASE_COMMIT</title></head> +<body> +<!-- A link to documentation for the most recent successful build: $branchurl --> +<h1>Index of docs changed since: $BASE_COMMIT</h1> +<ul> +EOF + changed=`git diff --no-index --name-only "$old"/src/sgml/html "$new"/src/sgml/html` || [ $? -eq 1 ] @@ -23,7 +37,28 @@ do echo "$f" |grep -Ew "$skippages" >/dev/null && continue - cp -v "$f" "$outdir" -done + cp -v "$f" "$outdir" >&2 + fn=${f##*/} + # ?branch=... is needed when accessing the artifacts for the static link for the branch + # It's not needed and ignored if accessing artifacts for *this* CI run + echo "<li><a href='$fn?branch=$branch'>$fn</a>" +done >>"$index" + +github=https://github.com/$CIRRUS_REPO_FULL_NAME/commit +cirrus=https://cirrus-ci.com/build + +cat >>"$index" <<EOF +</ul> +<hr> +<code> +<br>This file was written on: `date --rfc-822 --utc` +<br>CIRRUS_CHANGE_TITLE: $CIRRUS_CHANGE_TITLE +<br>CIRRUS_CHANGE_IN_REPO: <a href="$github/$CIRRUS_CHANGE_IN_REPO">$CIRRUS_CHANGE_IN_REPO</a> +<br>CIRRUS_BUILD_ID: <a href="$cirrus/$CIRRUS_BUILD_ID">$CIRRUS_BUILD_ID</a> +<br>CIRRUS_LAST_GREEN_CHANGE: <a href="$github/$CIRRUS_LAST_GREEN_CHANGE">$CIRRUS_LAST_GREEN_CHANGE</a> +<br>CIRRUS_LAST_GREEN_BUILD_ID: <a href="$cirrus/$CIRRUS_LAST_GREEN_BUILD_ID">$CIRRUS_LAST_GREEN_BUILD_ID</a> +</code> +</body></html> +EOF exit 0 -- 2.42.0 --Rvs4meNCoh6yKfx/ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0006-WIP-show-changed-docs-with-meson.patch" ^ permalink raw reply [nested|flat] 11+ messages in thread
* [PATCH 5/6] +html index file @ 2022-03-01 05:18 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 11+ messages in thread From: Justin Pryzby @ 2022-03-01 05:18 UTC (permalink / raw) This allows linking to the artifacts from the last successful build. //freebsd ci-os-only: warnings --- src/tools/ci/copy-changed-docs | 39 ++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/tools/ci/copy-changed-docs b/src/tools/ci/copy-changed-docs index 1c921a8df6f..0efad386cca 100755 --- a/src/tools/ci/copy-changed-docs +++ b/src/tools/ci/copy-changed-docs @@ -5,6 +5,7 @@ set -e old=$1 new=$2 outdir=$3 +branch=$CIRRUS_BRANCH # The index is large and changes often skippages="bookindex.html" @@ -12,6 +13,19 @@ skippages="bookindex.html" mkdir "$outdir" cp "$new"/src/sgml/html/*.css "$new"/src/sgml/html/*.svg "$outdir" +# The index is useful to allow a static link (not specific to a cirrus run) to the artifacts for the most-recent, successful CI run for a branch +branchurl=https://api.cirrus-ci.com/v1/artifact/github/$CIRRUS_REPO_FULL_NAME/$CIRRUS_TASK_NAME/html_docs/html... + +index="$outdir/00-index.html" +cat >"$index" <<EOF +<html> +<head><title>Index of docs changed since: $BASE_COMMIT</title></head> +<body> +<!-- A link to documentation for the most recent successful build: $branchurl --> +<h1>Index of docs changed since: $BASE_COMMIT</h1> +<ul> +EOF + changed=`git diff --no-index --name-only "$old"/src/sgml/html "$new"/src/sgml/html` || [ $? -eq 1 ] @@ -23,7 +37,28 @@ do echo "$f" |grep -Ew "$skippages" >/dev/null && continue - cp -v "$f" "$outdir" -done + cp -v "$f" "$outdir" >&2 + fn=${f##*/} + # ?branch=... is needed when accessing the artifacts for the static link for the branch + # It's not needed and ignored if accessing artifacts for *this* CI run + echo "<li><a href='$fn?branch=$branch'>$fn</a>" +done >>"$index" + +github=https://github.com/$CIRRUS_REPO_FULL_NAME/commit +cirrus=https://cirrus-ci.com/build + +cat >>"$index" <<EOF +</ul> +<hr> +<code> +<br>This file was written on: `date --rfc-822 --utc` +<br>CIRRUS_CHANGE_TITLE: $CIRRUS_CHANGE_TITLE +<br>CIRRUS_CHANGE_IN_REPO: <a href="$github/$CIRRUS_CHANGE_IN_REPO">$CIRRUS_CHANGE_IN_REPO</a> +<br>CIRRUS_BUILD_ID: <a href="$cirrus/$CIRRUS_BUILD_ID">$CIRRUS_BUILD_ID</a> +<br>CIRRUS_LAST_GREEN_CHANGE: <a href="$github/$CIRRUS_LAST_GREEN_CHANGE">$CIRRUS_LAST_GREEN_CHANGE</a> +<br>CIRRUS_LAST_GREEN_BUILD_ID: <a href="$cirrus/$CIRRUS_LAST_GREEN_BUILD_ID">$CIRRUS_LAST_GREEN_BUILD_ID</a> +</code> +</body></html> +EOF exit 0 -- 2.42.0 --AZUs1t8VY6GH6Ct3 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0006-WIP-show-changed-docs-with-meson.patch" ^ permalink raw reply [nested|flat] 11+ messages in thread
* [PATCH 5/7] +html index file @ 2022-03-01 05:18 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 11+ messages in thread From: Justin Pryzby @ 2022-03-01 05:18 UTC (permalink / raw) This allows linking to the artifacts from the last successful build. //freebsd ci-os-only: warnings --- src/tools/ci/copy-changed-docs | 39 ++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/tools/ci/copy-changed-docs b/src/tools/ci/copy-changed-docs index 1c921a8df6f..0efad386cca 100755 --- a/src/tools/ci/copy-changed-docs +++ b/src/tools/ci/copy-changed-docs @@ -5,6 +5,7 @@ set -e old=$1 new=$2 outdir=$3 +branch=$CIRRUS_BRANCH # The index is large and changes often skippages="bookindex.html" @@ -12,6 +13,19 @@ skippages="bookindex.html" mkdir "$outdir" cp "$new"/src/sgml/html/*.css "$new"/src/sgml/html/*.svg "$outdir" +# The index is useful to allow a static link (not specific to a cirrus run) to the artifacts for the most-recent, successful CI run for a branch +branchurl=https://api.cirrus-ci.com/v1/artifact/github/$CIRRUS_REPO_FULL_NAME/$CIRRUS_TASK_NAME/html_docs/html... + +index="$outdir/00-index.html" +cat >"$index" <<EOF +<html> +<head><title>Index of docs changed since: $BASE_COMMIT</title></head> +<body> +<!-- A link to documentation for the most recent successful build: $branchurl --> +<h1>Index of docs changed since: $BASE_COMMIT</h1> +<ul> +EOF + changed=`git diff --no-index --name-only "$old"/src/sgml/html "$new"/src/sgml/html` || [ $? -eq 1 ] @@ -23,7 +37,28 @@ do echo "$f" |grep -Ew "$skippages" >/dev/null && continue - cp -v "$f" "$outdir" -done + cp -v "$f" "$outdir" >&2 + fn=${f##*/} + # ?branch=... is needed when accessing the artifacts for the static link for the branch + # It's not needed and ignored if accessing artifacts for *this* CI run + echo "<li><a href='$fn?branch=$branch'>$fn</a>" +done >>"$index" + +github=https://github.com/$CIRRUS_REPO_FULL_NAME/commit +cirrus=https://cirrus-ci.com/build + +cat >>"$index" <<EOF +</ul> +<hr> +<code> +<br>This file was written on: `date --rfc-822 --utc` +<br>CIRRUS_CHANGE_TITLE: $CIRRUS_CHANGE_TITLE +<br>CIRRUS_CHANGE_IN_REPO: <a href="$github/$CIRRUS_CHANGE_IN_REPO">$CIRRUS_CHANGE_IN_REPO</a> +<br>CIRRUS_BUILD_ID: <a href="$cirrus/$CIRRUS_BUILD_ID">$CIRRUS_BUILD_ID</a> +<br>CIRRUS_LAST_GREEN_CHANGE: <a href="$github/$CIRRUS_LAST_GREEN_CHANGE">$CIRRUS_LAST_GREEN_CHANGE</a> +<br>CIRRUS_LAST_GREEN_BUILD_ID: <a href="$cirrus/$CIRRUS_LAST_GREEN_BUILD_ID">$CIRRUS_LAST_GREEN_BUILD_ID</a> +</code> +</body></html> +EOF exit 0 -- 2.42.0 --jviKHM0HgsS9J3Sv Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0006-WIP-show-changed-docs-with-meson.patch" ^ permalink raw reply [nested|flat] 11+ messages in thread
* [PATCH 5/6] +html index file @ 2022-03-01 05:18 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 11+ messages in thread From: Justin Pryzby @ 2022-03-01 05:18 UTC (permalink / raw) This allows linking to the artifacts from the last successful build. //freebsd ci-os-only: warnings --- src/tools/ci/copy-changed-docs | 39 ++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/tools/ci/copy-changed-docs b/src/tools/ci/copy-changed-docs index 1c921a8df6f..0efad386cca 100755 --- a/src/tools/ci/copy-changed-docs +++ b/src/tools/ci/copy-changed-docs @@ -5,6 +5,7 @@ set -e old=$1 new=$2 outdir=$3 +branch=$CIRRUS_BRANCH # The index is large and changes often skippages="bookindex.html" @@ -12,6 +13,19 @@ skippages="bookindex.html" mkdir "$outdir" cp "$new"/src/sgml/html/*.css "$new"/src/sgml/html/*.svg "$outdir" +# The index is useful to allow a static link (not specific to a cirrus run) to the artifacts for the most-recent, successful CI run for a branch +branchurl=https://api.cirrus-ci.com/v1/artifact/github/$CIRRUS_REPO_FULL_NAME/$CIRRUS_TASK_NAME/html_docs/html... + +index="$outdir/00-index.html" +cat >"$index" <<EOF +<html> +<head><title>Index of docs changed since: $BASE_COMMIT</title></head> +<body> +<!-- A link to documentation for the most recent successful build: $branchurl --> +<h1>Index of docs changed since: $BASE_COMMIT</h1> +<ul> +EOF + changed=`git diff --no-index --name-only "$old"/src/sgml/html "$new"/src/sgml/html` || [ $? -eq 1 ] @@ -23,7 +37,28 @@ do echo "$f" |grep -Ew "$skippages" >/dev/null && continue - cp -v "$f" "$outdir" -done + cp -v "$f" "$outdir" >&2 + fn=${f##*/} + # ?branch=... is needed when accessing the artifacts for the static link for the branch + # It's not needed and ignored if accessing artifacts for *this* CI run + echo "<li><a href='$fn?branch=$branch'>$fn</a>" +done >>"$index" + +github=https://github.com/$CIRRUS_REPO_FULL_NAME/commit +cirrus=https://cirrus-ci.com/build + +cat >>"$index" <<EOF +</ul> +<hr> +<code> +<br>This file was written on: `date --rfc-822 --utc` +<br>CIRRUS_CHANGE_TITLE: $CIRRUS_CHANGE_TITLE +<br>CIRRUS_CHANGE_IN_REPO: <a href="$github/$CIRRUS_CHANGE_IN_REPO">$CIRRUS_CHANGE_IN_REPO</a> +<br>CIRRUS_BUILD_ID: <a href="$cirrus/$CIRRUS_BUILD_ID">$CIRRUS_BUILD_ID</a> +<br>CIRRUS_LAST_GREEN_CHANGE: <a href="$github/$CIRRUS_LAST_GREEN_CHANGE">$CIRRUS_LAST_GREEN_CHANGE</a> +<br>CIRRUS_LAST_GREEN_BUILD_ID: <a href="$cirrus/$CIRRUS_LAST_GREEN_BUILD_ID">$CIRRUS_LAST_GREEN_BUILD_ID</a> +</code> +</body></html> +EOF exit 0 -- 2.42.0 --r+4ArEqyVZuXSt++ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0006-WIP-show-changed-docs-with-meson.patch" ^ permalink raw reply [nested|flat] 11+ messages in thread
* [PATCH 8/8] +html index file @ 2022-03-01 05:18 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 11+ messages in thread From: Justin Pryzby @ 2022-03-01 05:18 UTC (permalink / raw) This allows linking to the artifacts from the last successful build. //freebsd ci-os-only: warnings --- .cirrus.yml | 4 ++-- src/tools/ci/copy-changed-docs | 39 ++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 68b7229d117..e6f435b6981 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -27,23 +27,23 @@ env: PGCTLTIMEOUT: 120 # avoids spurious failures during parallel tests TEMP_CONFIG: ${CIRRUS_WORKING_DIR}/src/tools/ci/pg_ci_base.conf PG_TEST_EXTRA: kerberos ldap ssl load_balance # The commit that this branch is rebased on. There's no easy way to find this. # This does the right thing for cfbot, which always squishes all patches into a single commit. # And does the right thing for any 1-patch commits. # Patch series manually submitted to cirrus would benefit from setting this to the # number of patches in the series (or directly to the commit the series was rebased on). #BASE_COMMIT: HEAD~1 # For demo purposes: - BASE_COMMIT: HEAD~11 + BASE_COMMIT: HEAD~22 # What files to preserve in case tests fail on_failure_ac: &on_failure_ac log_artifacts: paths: - "**/*.log" - "**/*.diffs" - "**/regress_log_*" type: text/plain on_failure_meson: &on_failure_meson @@ -699,23 +699,23 @@ task: type: text/plain task: name: CompilerWarnings # To limit unnecessary work only run this once the SanityCheck # succeeds. This is particularly important for this task as we intentionally # use always: to continue after failures. Task that did not run count as a # success, so we need to recheck SanityChecks's condition here ... depends_on: SanityCheck - only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' + # only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' env: CPUS: 4 BUILD_JOBS: 4 # Use larger ccache cache, as this task compiles with multiple compilers / # flag combinations CCACHE_MAXSIZE: "1G" CCACHE_DIR: "/tmp/ccache_dir" LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES diff --git a/src/tools/ci/copy-changed-docs b/src/tools/ci/copy-changed-docs index 1c921a8df6f..0efad386cca 100755 --- a/src/tools/ci/copy-changed-docs +++ b/src/tools/ci/copy-changed-docs @@ -1,29 +1,64 @@ #! /bin/sh # Copy HTML which differ between $old and $new into $outdir set -e old=$1 new=$2 outdir=$3 +branch=$CIRRUS_BRANCH # The index is large and changes often skippages="bookindex.html" mkdir "$outdir" cp "$new"/src/sgml/html/*.css "$new"/src/sgml/html/*.svg "$outdir" +# The index is useful to allow a static link (not specific to a cirrus run) to the artifacts for the most-recent, successful CI run for a branch +branchurl=https://api.cirrus-ci.com/v1/artifact/github/$CIRRUS_REPO_FULL_NAME/$CIRRUS_TASK_NAME/html_docs/html... + +index="$outdir/00-index.html" +cat >"$index" <<EOF +<html> +<head><title>Index of docs changed since: $BASE_COMMIT</title></head> +<body> +<!-- A link to documentation for the most recent successful build: $branchurl --> +<h1>Index of docs changed since: $BASE_COMMIT</h1> +<ul> +EOF + changed=`git diff --no-index --name-only "$old"/src/sgml/html "$new"/src/sgml/html` || [ $? -eq 1 ] for f in $changed do # Avoid removed files [ -f "$f" ] || continue echo "$f" |grep -Ew "$skippages" >/dev/null && continue - cp -v "$f" "$outdir" -done + cp -v "$f" "$outdir" >&2 + fn=${f##*/} + # ?branch=... is needed when accessing the artifacts for the static link for the branch + # It's not needed and ignored if accessing artifacts for *this* CI run + echo "<li><a href='$fn?branch=$branch'>$fn</a>" +done >>"$index" + +github=https://github.com/$CIRRUS_REPO_FULL_NAME/commit +cirrus=https://cirrus-ci.com/build + +cat >>"$index" <<EOF +</ul> +<hr> +<code> +<br>This file was written on: `date --rfc-822 --utc` +<br>CIRRUS_CHANGE_TITLE: $CIRRUS_CHANGE_TITLE +<br>CIRRUS_CHANGE_IN_REPO: <a href="$github/$CIRRUS_CHANGE_IN_REPO">$CIRRUS_CHANGE_IN_REPO</a> +<br>CIRRUS_BUILD_ID: <a href="$cirrus/$CIRRUS_BUILD_ID">$CIRRUS_BUILD_ID</a> +<br>CIRRUS_LAST_GREEN_CHANGE: <a href="$github/$CIRRUS_LAST_GREEN_CHANGE">$CIRRUS_LAST_GREEN_CHANGE</a> +<br>CIRRUS_LAST_GREEN_BUILD_ID: <a href="$cirrus/$CIRRUS_LAST_GREEN_BUILD_ID">$CIRRUS_LAST_GREEN_BUILD_ID</a> +</code> +</body></html> +EOF exit 0 -- 2.34.1 --NvorufYXl2Cnpa+A-- ^ permalink raw reply [nested|flat] 11+ messages in thread
* [PATCH 20/23] +html index file @ 2022-03-01 05:18 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 11+ messages in thread From: Justin Pryzby @ 2022-03-01 05:18 UTC (permalink / raw) This allows linking to the artifacts from the last successful build, which itself allows *not* rebuilding when sources haven't changed. //freebsd ci-os-only: html, --- .cirrus.yml | 3 ++- src/tools/ci/copy-changed-docs | 45 ++++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 8fca4de219f..4f0695e455d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -662,7 +662,8 @@ task: BUILD_JOBS: 1 only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(docs|html).*' - #skip: "!changesInclude('.cirrus.yml', 'doc/**', 'src/tools/ci/copy-changed-docs')" + skip: "!changesInclude('.cirrus.yml', 'doc/**', 'src/tools/ci/copy-changed-docs')" + #skip: "!changesInclude('doc/**')" container: image: $CONTAINER_REPO/linux_debian_bullseye_ci:latest diff --git a/src/tools/ci/copy-changed-docs b/src/tools/ci/copy-changed-docs index 1584f974d94..0efad386cca 100755 --- a/src/tools/ci/copy-changed-docs +++ b/src/tools/ci/copy-changed-docs @@ -5,10 +5,27 @@ set -e old=$1 new=$2 outdir=$3 +branch=$CIRRUS_BRANCH + +# The index is large and changes often +skippages="bookindex.html" mkdir "$outdir" cp "$new"/src/sgml/html/*.css "$new"/src/sgml/html/*.svg "$outdir" +# The index is useful to allow a static link (not specific to a cirrus run) to the artifacts for the most-recent, successful CI run for a branch +branchurl=https://api.cirrus-ci.com/v1/artifact/github/$CIRRUS_REPO_FULL_NAME/$CIRRUS_TASK_NAME/html_docs/html... + +index="$outdir/00-index.html" +cat >"$index" <<EOF +<html> +<head><title>Index of docs changed since: $BASE_COMMIT</title></head> +<body> +<!-- A link to documentation for the most recent successful build: $branchurl --> +<h1>Index of docs changed since: $BASE_COMMIT</h1> +<ul> +EOF + changed=`git diff --no-index --name-only "$old"/src/sgml/html "$new"/src/sgml/html` || [ $? -eq 1 ] @@ -17,7 +34,31 @@ do # Avoid removed files [ -f "$f" ] || continue - cp -v "$f" "$outdir" -done + echo "$f" |grep -Ew "$skippages" >/dev/null && + continue + + cp -v "$f" "$outdir" >&2 + fn=${f##*/} + # ?branch=... is needed when accessing the artifacts for the static link for the branch + # It's not needed and ignored if accessing artifacts for *this* CI run + echo "<li><a href='$fn?branch=$branch'>$fn</a>" +done >>"$index" + +github=https://github.com/$CIRRUS_REPO_FULL_NAME/commit +cirrus=https://cirrus-ci.com/build + +cat >>"$index" <<EOF +</ul> +<hr> +<code> +<br>This file was written on: `date --rfc-822 --utc` +<br>CIRRUS_CHANGE_TITLE: $CIRRUS_CHANGE_TITLE +<br>CIRRUS_CHANGE_IN_REPO: <a href="$github/$CIRRUS_CHANGE_IN_REPO">$CIRRUS_CHANGE_IN_REPO</a> +<br>CIRRUS_BUILD_ID: <a href="$cirrus/$CIRRUS_BUILD_ID">$CIRRUS_BUILD_ID</a> +<br>CIRRUS_LAST_GREEN_CHANGE: <a href="$github/$CIRRUS_LAST_GREEN_CHANGE">$CIRRUS_LAST_GREEN_CHANGE</a> +<br>CIRRUS_LAST_GREEN_BUILD_ID: <a href="$cirrus/$CIRRUS_LAST_GREEN_BUILD_ID">$CIRRUS_LAST_GREEN_BUILD_ID</a> +</code> +</body></html> +EOF exit 0 -- 2.17.1 --tKkaNMvYmhQvRCRK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0021-cirrus-warnings-use-.-configure-cache-in-headerschec.patch" ^ permalink raw reply [nested|flat] 11+ messages in thread
* [PATCH 9/9] +html index file @ 2022-03-01 05:18 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 11+ messages in thread From: Justin Pryzby @ 2022-03-01 05:18 UTC (permalink / raw) This allows linking to the artifacts from the last successful build. //freebsd ci-os-only: warnings --- .cirrus.yml | 4 ++-- src/tools/ci/copy-changed-docs | 42 ++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 57359f43867..f36d7d110e0 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -674,8 +674,8 @@ task: # succeeds. This is particularly important for this task as we intentionally # use always: to continue after failures. Task that did not run count as a # success, so we need to recheck SanityChecks's condition here ... - depends_on: SanityCheck - only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' + #depends_on: SanityCheck + only_if: $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:.*warnings' env: CPUS: 4 diff --git a/src/tools/ci/copy-changed-docs b/src/tools/ci/copy-changed-docs index 1c921a8df6f..57dd2823a50 100755 --- a/src/tools/ci/copy-changed-docs +++ b/src/tools/ci/copy-changed-docs @@ -5,6 +5,10 @@ set -e old=$1 new=$2 outdir=$3 +branch=$CIRRUS_BRANCH + +# The index is large and changes often +skippages="bookindex.html" # The index is large and changes often skippages="bookindex.html" @@ -12,6 +16,19 @@ skippages="bookindex.html" mkdir "$outdir" cp "$new"/src/sgml/html/*.css "$new"/src/sgml/html/*.svg "$outdir" +# The index is useful to allow a static link (not specific to a cirrus run) to the artifacts for the most-recent, successful CI run for a branch +branchurl=https://api.cirrus-ci.com/v1/artifact/github/$CIRRUS_REPO_FULL_NAME/$CIRRUS_TASK_NAME/html_docs/html... + +index="$outdir/00-index.html" +cat >"$index" <<EOF +<html> +<head><title>Index of docs changed since: $BASE_COMMIT</title></head> +<body> +<!-- A link to documentation for the most recent successful build: $branchurl --> +<h1>Index of docs changed since: $BASE_COMMIT</h1> +<ul> +EOF + changed=`git diff --no-index --name-only "$old"/src/sgml/html "$new"/src/sgml/html` || [ $? -eq 1 ] @@ -23,7 +40,28 @@ do echo "$f" |grep -Ew "$skippages" >/dev/null && continue - cp -v "$f" "$outdir" -done + cp -v "$f" "$outdir" >&2 + fn=${f##*/} + # ?branch=... is needed when accessing the artifacts for the static link for the branch + # It's not needed and ignored if accessing artifacts for *this* CI run + echo "<li><a href='$fn?branch=$branch'>$fn</a>" +done >>"$index" + +github=https://github.com/$CIRRUS_REPO_FULL_NAME/commit +cirrus=https://cirrus-ci.com/build + +cat >>"$index" <<EOF +</ul> +<hr> +<code> +<br>This file was written on: `date --rfc-822 --utc` +<br>CIRRUS_CHANGE_TITLE: $CIRRUS_CHANGE_TITLE +<br>CIRRUS_CHANGE_IN_REPO: <a href="$github/$CIRRUS_CHANGE_IN_REPO">$CIRRUS_CHANGE_IN_REPO</a> +<br>CIRRUS_BUILD_ID: <a href="$cirrus/$CIRRUS_BUILD_ID">$CIRRUS_BUILD_ID</a> +<br>CIRRUS_LAST_GREEN_CHANGE: <a href="$github/$CIRRUS_LAST_GREEN_CHANGE">$CIRRUS_LAST_GREEN_CHANGE</a> +<br>CIRRUS_LAST_GREEN_BUILD_ID: <a href="$cirrus/$CIRRUS_LAST_GREEN_BUILD_ID">$CIRRUS_LAST_GREEN_BUILD_ID</a> +</code> +</body></html> +EOF exit 0 -- 2.25.1 --61jdw2sOBCFtR2d/-- ^ permalink raw reply [nested|flat] 11+ messages in thread
end of thread, other threads:[~2022-03-01 05:18 UTC | newest] Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2020-03-31 19:40 [PATCH v16 10/10] pg_ls_* to show file type and show special files Justin Pryzby <[email protected]> 2022-03-01 05:18 [PATCH 5/6] +html index file Justin Pryzby <[email protected]> 2022-03-01 05:18 [PATCH 5/6] +html index file Justin Pryzby <[email protected]> 2022-03-01 05:18 [PATCH 5/7] +html index file Justin Pryzby <[email protected]> 2022-03-01 05:18 [PATCH 8/8] +html index file Justin Pryzby <[email protected]> 2022-03-01 05:18 [PATCH 20/23] +html index file Justin Pryzby <[email protected]> 2022-03-01 05:18 [PATCH 9/9] +html index file Justin Pryzby <[email protected]> 2022-03-01 05:18 [PATCH 8/8] +html index file Justin Pryzby <[email protected]> 2022-03-01 05:18 [PATCH 5/6] +html index file Justin Pryzby <[email protected]> 2022-03-01 05:18 [PATCH 5/6] +html index file Justin Pryzby <[email protected]> 2022-03-01 05:18 [PATCH 10/10] +html index file Justin Pryzby <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox